blob: 1a8e67546eb894142d6f1253bb153fcb16ec7816 [file] [log] [blame]
Ian Rogers57b86d42012-03-27 16:05:41 -07001/*
2 * Copyright (C) 2012 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_SRC_OAT_RUNTIME_OAT_SUPPORT_ENTRYPOINTS_H_
18#define ART_SRC_OAT_RUNTIME_OAT_SUPPORT_ENTRYPOINTS_H_
19
20#include "runtime.h"
21
22#define ENTRYPOINT_OFFSET(x) \
23 (static_cast<uintptr_t>(OFFSETOF_MEMBER(Thread, entrypoints_)) + \
24 static_cast<uintptr_t>(OFFSETOF_MEMBER(EntryPoints, x)))
25
26namespace art {
27
28class Class;
29class Method;
30class Thread;
31
32struct PACKED EntryPoints {
33 // Alloc
34 void* (*pAllocArrayFromCode)(uint32_t, void*, int32_t);
35 void* (*pAllocArrayFromCodeWithAccessCheck)(uint32_t, void*, int32_t);
36 void* (*pAllocObjectFromCode)(uint32_t, void*);
37 void* (*pAllocObjectFromCodeWithAccessCheck)(uint32_t, void*);
38 void* (*pCheckAndAllocArrayFromCode)(uint32_t, void*, int32_t);
39 void* (*pCheckAndAllocArrayFromCodeWithAccessCheck)(uint32_t, void*, int32_t);
40
41 // Cast
42 uint32_t (*pInstanceofNonTrivialFromCode)(const Class*, const Class*);
43 void (*pCanPutArrayElementFromCode)(void*, void*);
44 void (*pCheckCastFromCode)(void*, void*);
45
46 // Debug
47 void (*pDebugMe)(Method*, uint32_t);
48 void (*pUpdateDebuggerFromCode)(void*, void*, int32_t, void*);
49
50 // DexCache
51 void* (*pInitializeStaticStorage)(uint32_t, void*);
52 void* (*pInitializeTypeAndVerifyAccessFromCode)(uint32_t, void*);
53 void* (*pInitializeTypeFromCode)(uint32_t, void*);
54 void* (*pResolveStringFromCode)(void*, uint32_t);
55
56 // Field
57 int (*pSet32Instance)(uint32_t, void*, int32_t); // field_idx, obj, src
58 int (*pSet32Static)(uint32_t, int32_t);
59 int (*pSet64Instance)(uint32_t, void*, int64_t);
60 int (*pSet64Static)(uint32_t, int64_t);
61 int (*pSetObjInstance)(uint32_t, void*, void*);
62 int (*pSetObjStatic)(uint32_t, void*);
63 int32_t (*pGet32Instance)(uint32_t, void*);
64 int32_t (*pGet32Static)(uint32_t);
65 int64_t (*pGet64Instance)(uint32_t, void*);
66 int64_t (*pGet64Static)(uint32_t);
67 void* (*pGetObjInstance)(uint32_t, void*);
68 void* (*pGetObjStatic)(uint32_t);
69
70 // FillArray
71 void (*pHandleFillArrayDataFromCode)(void*, void*);
72
73 // JNI
74 Object* (*pDecodeJObjectInThread)(Thread* thread, jobject obj);
75 void* (*pFindNativeMethod)(Thread* thread);
76
77 // Locks
78 void (*pLockObjectFromCode)(void*);
79 void (*pUnlockObjectFromCode)(void*);
80
81 // Math
82 int32_t (*pCmpgDouble)(double, double);
83 int32_t (*pCmpgFloat)(float, float);
84 int32_t (*pCmplDouble)(double, double);
85 int32_t (*pCmplFloat)(float, float);
86 double (*pDadd)(double, double);
87 double (*pDdiv)(double, double);
88 double (*pDmul)(double, double);
89 double (*pDsub)(double, double);
90 double (*pF2d)(float);
91 double (*pFmod)(double, double);
92 double (*pI2d)(int);
93 double (*pL2d)(int64_t);
94 float (*pD2f)(double);
95 float (*pFadd)(float, float);
96 float (*pFdiv)(float, float);
97 float (*pFmodf)(float, float);
98 float (*pFmul)(float, float);
99 float (*pFsub)(float, float);
100 float (*pI2f)(int32_t);
101 float (*pL2f)(int64_t);
102 int32_t (*pD2iz)(double);
103 int32_t (*pF2iz)(float);
104 int32_t (*pIdiv)(int32_t, int32_t);
105 int32_t (*pIdivmod)(int32_t, int32_t);
106 int64_t (*pD2l)(double);
107 int64_t (*pF2l)(float);
108 int64_t (*pLadd)(int64_t, int64_t);
109 int64_t (*pLand)(int64_t, int64_t);
Ian Rogers55bd45f2012-04-04 17:31:20 -0700110 int64_t (*pLdiv)(int64_t, int64_t);
Ian Rogers57b86d42012-03-27 16:05:41 -0700111 int64_t (*pLdivmod)(int64_t, int64_t);
112 int64_t (*pLmul)(int64_t, int64_t);
113 int64_t (*pLor)(int64_t, int64_t);
114 int64_t (*pLsub)(int64_t, int64_t);
115 int64_t (*pLxor)(int64_t, int64_t);
116 uint64_t (*pShlLong)(uint64_t, uint32_t);
117 uint64_t (*pShrLong)(uint64_t, uint32_t);
118 uint64_t (*pUshrLong)(uint64_t, uint32_t);
119
120 // Intrinsics
121 int32_t (*pIndexOf)(void*, uint32_t, uint32_t, uint32_t);
122 int32_t (*pMemcmp16)(void*, void*, int32_t);
123 int32_t (*pStringCompareTo)(void*, void*);
124 void* (*pMemcpy)(void*, const void*, size_t);
125
126 // Invocation
127 Method* (*pFindInterfaceMethodInCache)(Class*, uint32_t, const Method*, struct DvmDex*);
128 const void* (*pUnresolvedDirectMethodTrampolineFromCode)(Method*, Method**, Thread*,
129 Runtime::TrampolineType);
130 void (*pInvokeDirectTrampolineWithAccessCheck)(uint32_t, void*);
131 void (*pInvokeInterfaceTrampoline)(uint32_t, void*);
132 void (*pInvokeInterfaceTrampolineWithAccessCheck)(uint32_t, void*);
133 void (*pInvokeStaticTrampolineWithAccessCheck)(uint32_t, void*);
134 void (*pInvokeSuperTrampolineWithAccessCheck)(uint32_t, void*);
135 void (*pInvokeVirtualTrampolineWithAccessCheck)(uint32_t, void*);
136
137 // Thread
138 void (*pCheckSuspendFromCode)(Thread*); // Stub that is called when the suspend count is non-zero
139 void (*pTestSuspendFromCode)(); // Stub that is periodically called to test the suspend count
140
141 // Throws
142 void (*pDeliverException)(void*);
143 void (*pThrowAbstractMethodErrorFromCode)(Method* m, Thread* thread, Method** sp);
144 void (*pThrowArrayBoundsFromCode)(int32_t, int32_t);
145 void (*pThrowDivZeroFromCode)();
146 void (*pThrowNoSuchMethodFromCode)(int32_t);
147 void (*pThrowNullPointerFromCode)();
148 void (*pThrowStackOverflowFromCode)(void*);
149 void (*pThrowVerificationErrorFromCode)(int32_t, int32_t);
150};
151
152// Initialize an entry point data structure.
153void InitEntryPoints(EntryPoints* points);
154
155// Change the debugger entry point in the data structure.
156void ChangeDebuggerEntryPoint(EntryPoints* points, bool enabled);
157
158// Is the given return_pc the trace exit return pc?
159bool IsTraceExitPc(uintptr_t pc);
160
161// Return address of stub that logs method entries.
162void* GetLogTraceEntryPoint();
163
164} // namespace art
165
166#endif // ART_SRC_OAT_RUNTIME_OAT_SUPPORT_ENTRYPOINTS_H_