blob: 0f9e75886c8578705ead05ebbd21e2b665059d15 [file] [log] [blame]
Nicolas Geoffray013d1ee2019-12-04 16:18:15 +00001/*
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
22namespace art {
23
24class ArtMethod;
25
26/**
Nicolas Geoffray00391822019-12-10 10:17:23 +000027 * The frame size nterp will use for the given method.
28 */
Nicolas Geoffrayc39af942021-01-25 08:43:57 +000029size_t NterpGetFrameSize(ArtMethod* method, InstructionSet isa = kRuntimeISA)
Nicolas Geoffray00391822019-12-10 10:17:23 +000030 REQUIRES_SHARED(Locks::mutator_lock_);
31
32/**
Nicolas Geoffray013d1ee2019-12-04 16:18:15 +000033 * Returns the QuickMethodFrameInfo of the given frame corresponding to the
34 * given method.
35 */
36QuickMethodFrameInfo 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 */
42uint32_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 */
49uintptr_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 */
56uintptr_t NterpGetRegistersArray(ArtMethod** frame)
57 REQUIRES_SHARED(Locks::mutator_lock_);
58
59/**
60 * Returns the nterp landing pad for catching an exception.
61 */
62uintptr_t NterpGetCatchHandler();
63
64/**
65 * Returns the value of dex register number `vreg` in the given frame.
66 */
67uint32_t NterpGetVReg(ArtMethod** frame, uint16_t vreg)
68 REQUIRES_SHARED(Locks::mutator_lock_);
69
Nicolas Geoffrayd7651b12019-12-18 14:57:30 +000070/**
71 * Returns the value of dex register number `vreg` in the given frame if it is a
72 * reference. Return 0 otehrwise.
73 */
74uint32_t NterpGetVRegReference(ArtMethod** frame, uint16_t vreg)
75 REQUIRES_SHARED(Locks::mutator_lock_);
76
Nicolas Geoffrayc39af942021-01-25 08:43:57 +000077/**
78 * Returns whether the given method can run with nterp. The instruction set can
79 * be passed for cross-compilation.
80 */
81bool CanMethodUseNterp(ArtMethod* method, InstructionSet isa = kRuntimeISA)
82 REQUIRES_SHARED(Locks::mutator_lock_);
83
Nicolas Geoffray013d1ee2019-12-04 16:18:15 +000084} // namespace art
85
86#endif // ART_RUNTIME_NTERP_HELPERS_H_