Nicolas Geoffray | 013d1ee | 2019-12-04 16:18:15 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2019 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_RUNTIME_NTERP_HELPERS_H_ |
| 18 | #define ART_RUNTIME_NTERP_HELPERS_H_ |
| 19 | |
| 20 | #include "quick/quick_method_frame_info.h" |
| 21 | |
| 22 | namespace art { |
| 23 | |
| 24 | class ArtMethod; |
| 25 | |
| 26 | /** |
Nicolas Geoffray | 0039182 | 2019-12-10 10:17:23 +0000 | [diff] [blame] | 27 | * The frame size nterp will use for the given method. |
| 28 | */ |
Nicolas Geoffray | c39af94 | 2021-01-25 08:43:57 +0000 | [diff] [blame] | 29 | size_t NterpGetFrameSize(ArtMethod* method, InstructionSet isa = kRuntimeISA) |
Nicolas Geoffray | 0039182 | 2019-12-10 10:17:23 +0000 | [diff] [blame] | 30 | REQUIRES_SHARED(Locks::mutator_lock_); |
| 31 | |
| 32 | /** |
Nicolas Geoffray | 013d1ee | 2019-12-04 16:18:15 +0000 | [diff] [blame] | 33 | * Returns the QuickMethodFrameInfo of the given frame corresponding to the |
| 34 | * given method. |
| 35 | */ |
| 36 | QuickMethodFrameInfo NterpFrameInfo(ArtMethod** frame) |
| 37 | REQUIRES_SHARED(Locks::mutator_lock_); |
| 38 | |
| 39 | /** |
| 40 | * Returns the dex PC at which the given nterp frame is executing. |
| 41 | */ |
| 42 | uint32_t NterpGetDexPC(ArtMethod** frame) |
| 43 | REQUIRES_SHARED(Locks::mutator_lock_); |
| 44 | |
| 45 | /** |
| 46 | * Returns the reference array to be used by the GC to visit references in an |
| 47 | * nterp frame. |
| 48 | */ |
| 49 | uintptr_t NterpGetReferenceArray(ArtMethod** frame) |
| 50 | REQUIRES_SHARED(Locks::mutator_lock_); |
| 51 | |
| 52 | /** |
| 53 | * Returns the dex register array to be used by the GC to update references in |
| 54 | * an nterp frame. |
| 55 | */ |
| 56 | uintptr_t NterpGetRegistersArray(ArtMethod** frame) |
| 57 | REQUIRES_SHARED(Locks::mutator_lock_); |
| 58 | |
| 59 | /** |
| 60 | * Returns the nterp landing pad for catching an exception. |
| 61 | */ |
| 62 | uintptr_t NterpGetCatchHandler(); |
| 63 | |
| 64 | /** |
| 65 | * Returns the value of dex register number `vreg` in the given frame. |
| 66 | */ |
| 67 | uint32_t NterpGetVReg(ArtMethod** frame, uint16_t vreg) |
| 68 | REQUIRES_SHARED(Locks::mutator_lock_); |
| 69 | |
Nicolas Geoffray | d7651b1 | 2019-12-18 14:57:30 +0000 | [diff] [blame] | 70 | /** |
| 71 | * Returns the value of dex register number `vreg` in the given frame if it is a |
| 72 | * reference. Return 0 otehrwise. |
| 73 | */ |
| 74 | uint32_t NterpGetVRegReference(ArtMethod** frame, uint16_t vreg) |
| 75 | REQUIRES_SHARED(Locks::mutator_lock_); |
| 76 | |
Nicolas Geoffray | c39af94 | 2021-01-25 08:43:57 +0000 | [diff] [blame] | 77 | /** |
| 78 | * Returns whether the given method can run with nterp. The instruction set can |
| 79 | * be passed for cross-compilation. |
| 80 | */ |
| 81 | bool CanMethodUseNterp(ArtMethod* method, InstructionSet isa = kRuntimeISA) |
| 82 | REQUIRES_SHARED(Locks::mutator_lock_); |
| 83 | |
Nicolas Geoffray | 013d1ee | 2019-12-04 16:18:15 +0000 | [diff] [blame] | 84 | } // namespace art |
| 85 | |
| 86 | #endif // ART_RUNTIME_NTERP_HELPERS_H_ |