entrypoints_init_arm.cc revision d889178ec78930538d9d6a66c3df9ee9afaffbb4
1/*
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#include "entrypoints/interpreter/interpreter_entrypoints.h"
18#include "entrypoints/portable/portable_entrypoints.h"
19#include "entrypoints/quick/quick_alloc_entrypoints.h"
20#include "entrypoints/quick/quick_entrypoints.h"
21#include "entrypoints/entrypoint_utils.h"
22#include "entrypoints/math_entrypoints.h"
23
24namespace art {
25
26// Interpreter entrypoints.
27extern "C" void artInterpreterToInterpreterBridge(Thread* self, MethodHelper& mh,
28                                                 const DexFile::CodeItem* code_item,
29                                                 ShadowFrame* shadow_frame, JValue* result);
30extern "C" void artInterpreterToCompiledCodeBridge(Thread* self, MethodHelper& mh,
31                                           const DexFile::CodeItem* code_item,
32                                           ShadowFrame* shadow_frame, JValue* result);
33
34// Portable entrypoints.
35extern "C" void art_portable_resolution_trampoline(mirror::ArtMethod*);
36extern "C" void art_portable_to_interpreter_bridge(mirror::ArtMethod*);
37
38// Cast entrypoints.
39extern "C" uint32_t artIsAssignableFromCode(const mirror::Class* klass,
40                                            const mirror::Class* ref_class);
41extern "C" void art_quick_check_cast(void*, void*);
42
43// DexCache entrypoints.
44extern "C" void* art_quick_initialize_static_storage(uint32_t, void*);
45extern "C" void* art_quick_initialize_type(uint32_t, void*);
46extern "C" void* art_quick_initialize_type_and_verify_access(uint32_t, void*);
47extern "C" void* art_quick_resolve_string(void*, uint32_t);
48
49// Exception entrypoints.
50extern "C" void* GetAndClearException(Thread*);
51
52// Field entrypoints.
53extern "C" int art_quick_set32_instance(uint32_t, void*, int32_t);
54extern "C" int art_quick_set32_static(uint32_t, int32_t);
55extern "C" int art_quick_set64_instance(uint32_t, void*, int64_t);
56extern "C" int art_quick_set64_static(uint32_t, int64_t);
57extern "C" int art_quick_set_obj_instance(uint32_t, void*, void*);
58extern "C" int art_quick_set_obj_static(uint32_t, void*);
59extern "C" int32_t art_quick_get32_instance(uint32_t, void*);
60extern "C" int32_t art_quick_get32_static(uint32_t);
61extern "C" int64_t art_quick_get64_instance(uint32_t, void*);
62extern "C" int64_t art_quick_get64_static(uint32_t);
63extern "C" void* art_quick_get_obj_instance(uint32_t, void*);
64extern "C" void* art_quick_get_obj_static(uint32_t);
65
66// Array entrypoints.
67extern "C" void art_quick_aput_obj_with_null_and_bound_check(void*, uint32_t, void*);
68extern "C" void art_quick_aput_obj_with_bound_check(void*, uint32_t, void*);
69extern "C" void art_quick_aput_obj(void*, uint32_t, void*);
70extern "C" void art_quick_handle_fill_data(void*, void*);
71
72// Lock entrypoints.
73extern "C" void art_quick_lock_object(void*);
74extern "C" void art_quick_unlock_object(void*);
75
76// Math entrypoints.
77extern int32_t CmpgDouble(double a, double b);
78extern int32_t CmplDouble(double a, double b);
79extern int32_t CmpgFloat(float a, float b);
80extern int32_t CmplFloat(float a, float b);
81
82// Math conversions.
83extern "C" int32_t __aeabi_f2iz(float op1);        // FLOAT_TO_INT
84extern "C" int32_t __aeabi_d2iz(double op1);       // DOUBLE_TO_INT
85extern "C" float __aeabi_l2f(int64_t op1);         // LONG_TO_FLOAT
86extern "C" double __aeabi_l2d(int64_t op1);        // LONG_TO_DOUBLE
87
88// Single-precision FP arithmetics.
89extern "C" float fmodf(float a, float b);          // REM_FLOAT[_2ADDR]
90
91// Double-precision FP arithmetics.
92extern "C" double fmod(double a, double b);         // REM_DOUBLE[_2ADDR]
93
94// Integer arithmetics.
95extern "C" int __aeabi_idivmod(int32_t, int32_t);  // [DIV|REM]_INT[_2ADDR|_LIT8|_LIT16]
96
97// Long long arithmetics - REM_LONG[_2ADDR] and DIV_LONG[_2ADDR]
98extern "C" int64_t __aeabi_ldivmod(int64_t, int64_t);
99extern "C" int64_t art_quick_mul_long(int64_t, int64_t);
100extern "C" uint64_t art_quick_shl_long(uint64_t, uint32_t);
101extern "C" uint64_t art_quick_shr_long(uint64_t, uint32_t);
102extern "C" uint64_t art_quick_ushr_long(uint64_t, uint32_t);
103
104// Intrinsic entrypoints.
105extern "C" int32_t __memcmp16(void*, void*, int32_t);
106extern "C" int32_t art_quick_indexof(void*, uint32_t, uint32_t, uint32_t);
107extern "C" int32_t art_quick_string_compareto(void*, void*);
108
109// Invoke entrypoints.
110extern "C" void art_quick_imt_conflict_trampoline(mirror::ArtMethod*);
111extern "C" void art_quick_resolution_trampoline(mirror::ArtMethod*);
112extern "C" void art_quick_to_interpreter_bridge(mirror::ArtMethod*);
113extern "C" void art_quick_invoke_direct_trampoline_with_access_check(uint32_t, void*);
114extern "C" void art_quick_invoke_interface_trampoline_with_access_check(uint32_t, void*);
115extern "C" void art_quick_invoke_static_trampoline_with_access_check(uint32_t, void*);
116extern "C" void art_quick_invoke_super_trampoline_with_access_check(uint32_t, void*);
117extern "C" void art_quick_invoke_virtual_trampoline_with_access_check(uint32_t, void*);
118
119// Thread entrypoints.
120extern void CheckSuspendFromCode(Thread* thread);
121extern "C" void art_quick_test_suspend();
122
123// Throw entrypoints.
124extern "C" void art_quick_deliver_exception(void*);
125extern "C" void art_quick_throw_array_bounds(int32_t index, int32_t limit);
126extern "C" void art_quick_throw_div_zero();
127extern "C" void art_quick_throw_no_such_method(int32_t method_idx);
128extern "C" void art_quick_throw_null_pointer_exception();
129extern "C" void art_quick_throw_stack_overflow(void*);
130
131// Generic JNI downcall
132extern "C" void art_quick_generic_jni_trampoline(mirror::ArtMethod*);
133
134void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints,
135                     PortableEntryPoints* ppoints, QuickEntryPoints* qpoints) {
136  // Interpreter
137  ipoints->pInterpreterToInterpreterBridge = artInterpreterToInterpreterBridge;
138  ipoints->pInterpreterToCompiledCodeBridge = artInterpreterToCompiledCodeBridge;
139
140  // JNI
141  jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub;
142
143  // Portable
144  ppoints->pPortableResolutionTrampoline = art_portable_resolution_trampoline;
145  ppoints->pPortableToInterpreterBridge = art_portable_to_interpreter_bridge;
146
147  // Alloc
148  ResetQuickAllocEntryPoints(qpoints);
149
150  // Cast
151  qpoints->pInstanceofNonTrivial = artIsAssignableFromCode;
152  qpoints->pCheckCast = art_quick_check_cast;
153
154  // DexCache
155  qpoints->pInitializeStaticStorage = art_quick_initialize_static_storage;
156  qpoints->pInitializeTypeAndVerifyAccess = art_quick_initialize_type_and_verify_access;
157  qpoints->pInitializeType = art_quick_initialize_type;
158  qpoints->pResolveString = art_quick_resolve_string;
159
160  // Field
161  qpoints->pSet32Instance = art_quick_set32_instance;
162  qpoints->pSet32Static = art_quick_set32_static;
163  qpoints->pSet64Instance = art_quick_set64_instance;
164  qpoints->pSet64Static = art_quick_set64_static;
165  qpoints->pSetObjInstance = art_quick_set_obj_instance;
166  qpoints->pSetObjStatic = art_quick_set_obj_static;
167  qpoints->pGet32Instance = art_quick_get32_instance;
168  qpoints->pGet64Instance = art_quick_get64_instance;
169  qpoints->pGetObjInstance = art_quick_get_obj_instance;
170  qpoints->pGet32Static = art_quick_get32_static;
171  qpoints->pGet64Static = art_quick_get64_static;
172  qpoints->pGetObjStatic = art_quick_get_obj_static;
173
174  // Array
175  qpoints->pAputObjectWithNullAndBoundCheck = art_quick_aput_obj_with_null_and_bound_check;
176  qpoints->pAputObjectWithBoundCheck = art_quick_aput_obj_with_bound_check;
177  qpoints->pAputObject = art_quick_aput_obj;
178  qpoints->pHandleFillArrayData = art_quick_handle_fill_data;
179
180  // JNI
181  qpoints->pJniMethodStart = JniMethodStart;
182  qpoints->pJniMethodStartSynchronized = JniMethodStartSynchronized;
183  qpoints->pJniMethodEnd = JniMethodEnd;
184  qpoints->pJniMethodEndSynchronized = JniMethodEndSynchronized;
185  qpoints->pJniMethodEndWithReference = JniMethodEndWithReference;
186  qpoints->pJniMethodEndWithReferenceSynchronized = JniMethodEndWithReferenceSynchronized;
187  qpoints->pQuickGenericJniTrampoline = art_quick_generic_jni_trampoline;
188
189  // Locks
190  qpoints->pLockObject = art_quick_lock_object;
191  qpoints->pUnlockObject = art_quick_unlock_object;
192
193  // Math
194  qpoints->pCmpgDouble = CmpgDouble;
195  qpoints->pCmpgFloat = CmpgFloat;
196  qpoints->pCmplDouble = CmplDouble;
197  qpoints->pCmplFloat = CmplFloat;
198  qpoints->pFmod = fmod;
199  qpoints->pSqrt = sqrt;
200  qpoints->pL2d = __aeabi_l2d;
201  qpoints->pFmodf = fmodf;
202  qpoints->pL2f = __aeabi_l2f;
203  qpoints->pD2iz = __aeabi_d2iz;
204  qpoints->pF2iz = __aeabi_f2iz;
205  qpoints->pIdivmod = __aeabi_idivmod;
206  qpoints->pD2l = art_d2l;
207  qpoints->pF2l = art_f2l;
208  qpoints->pLdiv = __aeabi_ldivmod;
209  qpoints->pLmod = __aeabi_ldivmod;  // result returned in r2:r3
210  qpoints->pLmul = art_quick_mul_long;
211  qpoints->pShlLong = art_quick_shl_long;
212  qpoints->pShrLong = art_quick_shr_long;
213  qpoints->pUshrLong = art_quick_ushr_long;
214
215  // Intrinsics
216  qpoints->pIndexOf = art_quick_indexof;
217  qpoints->pMemcmp16 = __memcmp16;
218  qpoints->pStringCompareTo = art_quick_string_compareto;
219  qpoints->pMemcpy = memcpy;
220
221  // Invocation
222  qpoints->pQuickImtConflictTrampoline = art_quick_imt_conflict_trampoline;
223  qpoints->pQuickResolutionTrampoline = art_quick_resolution_trampoline;
224  qpoints->pQuickToInterpreterBridge = art_quick_to_interpreter_bridge;
225  qpoints->pInvokeDirectTrampolineWithAccessCheck = art_quick_invoke_direct_trampoline_with_access_check;
226  qpoints->pInvokeInterfaceTrampolineWithAccessCheck = art_quick_invoke_interface_trampoline_with_access_check;
227  qpoints->pInvokeStaticTrampolineWithAccessCheck = art_quick_invoke_static_trampoline_with_access_check;
228  qpoints->pInvokeSuperTrampolineWithAccessCheck = art_quick_invoke_super_trampoline_with_access_check;
229  qpoints->pInvokeVirtualTrampolineWithAccessCheck = art_quick_invoke_virtual_trampoline_with_access_check;
230
231  // Thread
232  qpoints->pCheckSuspend = CheckSuspendFromCode;
233  qpoints->pTestSuspend = art_quick_test_suspend;
234
235  // Throws
236  qpoints->pDeliverException = art_quick_deliver_exception;
237  qpoints->pThrowArrayBounds = art_quick_throw_array_bounds;
238  qpoints->pThrowDivZero = art_quick_throw_div_zero;
239  qpoints->pThrowNoSuchMethod = art_quick_throw_no_such_method;
240  qpoints->pThrowNullPointer = art_quick_throw_null_pointer_exception;
241  qpoints->pThrowStackOverflow = art_quick_throw_stack_overflow;
242};
243
244}  // namespace art
245