Andreas Gampe | 53c913b | 2014-08-12 23:19:23 -0700 | [diff] [blame] | 1 | /* |
| 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 Marko | 7bdc6e7 | 2017-11-28 12:37:13 +0000 | [diff] [blame] | 20 | #include <vector> |
| 21 | |
| 22 | #include "arch/instruction_set.h" |
| 23 | #include "base/array_ref.h" |
Vladimir Marko | 76e8795 | 2022-11-16 09:04:28 +0000 | [diff] [blame] | 24 | #include "base/macros.h" |
Andreas Gampe | 53c913b | 2014-08-12 23:19:23 -0700 | [diff] [blame] | 25 | |
Vladimir Marko | 76e8795 | 2022-11-16 09:04:28 +0000 | [diff] [blame] | 26 | namespace art HIDDEN { |
Andreas Gampe | 53c913b | 2014-08-12 23:19:23 -0700 | [diff] [blame] | 27 | |
Vladimir Marko | e953942 | 2022-04-08 09:52:34 +0000 | [diff] [blame] | 28 | class ArenaAllocator; |
Vladimir Marko | 7bdc6e7 | 2017-11-28 12:37:13 +0000 | [diff] [blame] | 29 | class ArtMethod; |
Vladimir Marko | a043111 | 2018-06-25 09:32:54 +0100 | [diff] [blame] | 30 | class CompilerOptions; |
Vladimir Marko | 7bdc6e7 | 2017-11-28 12:37:13 +0000 | [diff] [blame] | 31 | class DexFile; |
Andreas Gampe | 53c913b | 2014-08-12 23:19:23 -0700 | [diff] [blame] | 32 | |
Vladimir Marko | 7bdc6e7 | 2017-11-28 12:37:13 +0000 | [diff] [blame] | 33 | class JniCompiledMethod { |
| 34 | public: |
| 35 | JniCompiledMethod(InstructionSet instruction_set, |
| 36 | std::vector<uint8_t>&& code, |
| 37 | uint32_t frame_size, |
| 38 | uint32_t core_spill_mask, |
| 39 | uint32_t fp_spill_mask, |
| 40 | ArrayRef<const uint8_t> cfi) |
| 41 | : instruction_set_(instruction_set), |
| 42 | code_(std::move(code)), |
| 43 | frame_size_(frame_size), |
| 44 | core_spill_mask_(core_spill_mask), |
| 45 | fp_spill_mask_(fp_spill_mask), |
| 46 | cfi_(cfi.begin(), cfi.end()) {} |
| 47 | |
| 48 | JniCompiledMethod(JniCompiledMethod&& other) = default; |
| 49 | ~JniCompiledMethod() = default; |
| 50 | |
| 51 | InstructionSet GetInstructionSet() const { return instruction_set_; } |
| 52 | ArrayRef<const uint8_t> GetCode() const { return ArrayRef<const uint8_t>(code_); } |
| 53 | uint32_t GetFrameSize() const { return frame_size_; } |
| 54 | uint32_t GetCoreSpillMask() const { return core_spill_mask_; } |
| 55 | uint32_t GetFpSpillMask() const { return fp_spill_mask_; } |
| 56 | ArrayRef<const uint8_t> GetCfi() const { return ArrayRef<const uint8_t>(cfi_); } |
| 57 | |
| 58 | private: |
| 59 | InstructionSet instruction_set_; |
| 60 | std::vector<uint8_t> code_; |
| 61 | uint32_t frame_size_; |
| 62 | uint32_t core_spill_mask_; |
| 63 | uint32_t fp_spill_mask_; |
| 64 | std::vector<uint8_t> cfi_; |
| 65 | }; |
| 66 | |
Vladimir Marko | a043111 | 2018-06-25 09:32:54 +0100 | [diff] [blame] | 67 | JniCompiledMethod ArtQuickJniCompileMethod(const CompilerOptions& compiler_options, |
Vladimir Marko | 7bdc6e7 | 2017-11-28 12:37:13 +0000 | [diff] [blame] | 68 | uint32_t access_flags, |
| 69 | uint32_t method_idx, |
Vladimir Marko | e953942 | 2022-04-08 09:52:34 +0000 | [diff] [blame] | 70 | const DexFile& dex_file, |
| 71 | ArenaAllocator* allocator); |
Andreas Gampe | 53c913b | 2014-08-12 23:19:23 -0700 | [diff] [blame] | 72 | |
| 73 | } // namespace art |
| 74 | |
| 75 | #endif // ART_COMPILER_JNI_QUICK_JNI_COMPILER_H_ |