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