blob: 313fcd361e4249eaba1c2d581ab272cbda2c109d [file] [log] [blame]
Andreas Gampe53c913b2014-08-12 23:19:23 -07001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ART_COMPILER_JNI_QUICK_JNI_COMPILER_H_
18#define ART_COMPILER_JNI_QUICK_JNI_COMPILER_H_
19
Vladimir Marko7bdc6e72017-11-28 12:37:13 +000020#include <vector>
21
22#include "arch/instruction_set.h"
23#include "base/array_ref.h"
Andreas Gampe53c913b2014-08-12 23:19:23 -070024
25namespace art {
26
Vladimir Marko7bdc6e72017-11-28 12:37:13 +000027class ArtMethod;
Vladimir Markoa0431112018-06-25 09:32:54 +010028class CompilerOptions;
Vladimir Marko7bdc6e72017-11-28 12:37:13 +000029class DexFile;
Andreas Gampe53c913b2014-08-12 23:19:23 -070030
Vladimir Marko7bdc6e72017-11-28 12:37:13 +000031class JniCompiledMethod {
32 public:
33 JniCompiledMethod(InstructionSet instruction_set,
34 std::vector<uint8_t>&& code,
35 uint32_t frame_size,
36 uint32_t core_spill_mask,
37 uint32_t fp_spill_mask,
38 ArrayRef<const uint8_t> cfi)
39 : instruction_set_(instruction_set),
40 code_(std::move(code)),
41 frame_size_(frame_size),
42 core_spill_mask_(core_spill_mask),
43 fp_spill_mask_(fp_spill_mask),
44 cfi_(cfi.begin(), cfi.end()) {}
45
46 JniCompiledMethod(JniCompiledMethod&& other) = default;
47 ~JniCompiledMethod() = default;
48
49 InstructionSet GetInstructionSet() const { return instruction_set_; }
50 ArrayRef<const uint8_t> GetCode() const { return ArrayRef<const uint8_t>(code_); }
51 uint32_t GetFrameSize() const { return frame_size_; }
52 uint32_t GetCoreSpillMask() const { return core_spill_mask_; }
53 uint32_t GetFpSpillMask() const { return fp_spill_mask_; }
54 ArrayRef<const uint8_t> GetCfi() const { return ArrayRef<const uint8_t>(cfi_); }
55
56 private:
57 InstructionSet instruction_set_;
58 std::vector<uint8_t> code_;
59 uint32_t frame_size_;
60 uint32_t core_spill_mask_;
61 uint32_t fp_spill_mask_;
62 std::vector<uint8_t> cfi_;
63};
64
Vladimir Markoa0431112018-06-25 09:32:54 +010065JniCompiledMethod ArtQuickJniCompileMethod(const CompilerOptions& compiler_options,
Vladimir Marko7bdc6e72017-11-28 12:37:13 +000066 uint32_t access_flags,
67 uint32_t method_idx,
68 const DexFile& dex_file);
Andreas Gampe53c913b2014-08-12 23:19:23 -070069
70} // namespace art
71
72#endif // ART_COMPILER_JNI_QUICK_JNI_COMPILER_H_