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