entrypoints_init_arm.cc revision 834b394ee759ed31c5371d8093d7cd8cd90014a8
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/portable/portable_entrypoints.h" 18#include "entrypoints/quick/quick_entrypoints.h" 19#include "entrypoints/entrypoint_utils.h" 20#include "entrypoints/math_entrypoints.h" 21 22namespace art { 23 24// Alloc entrypoints. 25extern "C" void* art_quick_alloc_array_from_code(uint32_t, void*, int32_t); 26extern "C" void* art_quick_alloc_array_from_code_with_access_check(uint32_t, void*, int32_t); 27extern "C" void* art_quick_alloc_object_from_code(uint32_t type_idx, void* method); 28extern "C" void* art_quick_alloc_object_from_code_with_access_check(uint32_t type_idx, void* method); 29extern "C" void* art_quick_check_and_alloc_array_from_code(uint32_t, void*, int32_t); 30extern "C" void* art_quick_check_and_alloc_array_from_code_with_access_check(uint32_t, void*, int32_t); 31 32// Cast entrypoints. 33extern "C" uint32_t artIsAssignableFromCode(const mirror::Class* klass, 34 const mirror::Class* ref_class); 35extern "C" void art_quick_can_put_array_element_from_code(void*, void*); 36extern "C" void art_quick_check_cast_from_code(void*, void*); 37 38// DexCache entrypoints. 39extern "C" void* art_quick_initialize_static_storage_from_code(uint32_t, void*); 40extern "C" void* art_quick_initialize_type_from_code(uint32_t, void*); 41extern "C" void* art_quick_initialize_type_and_verify_access_from_code(uint32_t, void*); 42extern "C" void* art_quick_resolve_string_from_code(void*, uint32_t); 43 44// Exception entrypoints. 45extern "C" void* GetAndClearException(Thread*); 46 47// Field entrypoints. 48extern "C" int art_quick_set32_instance_from_code(uint32_t, void*, int32_t); 49extern "C" int art_quick_set32_static_from_code(uint32_t, int32_t); 50extern "C" int art_quick_set64_instance_from_code(uint32_t, void*, int64_t); 51extern "C" int art_quick_set64_static_from_code(uint32_t, int64_t); 52extern "C" int art_quick_set_obj_instance_from_code(uint32_t, void*, void*); 53extern "C" int art_quick_set_obj_static_from_code(uint32_t, void*); 54extern "C" int32_t art_quick_get32_instance_from_code(uint32_t, void*); 55extern "C" int32_t art_quick_get32_static_from_code(uint32_t); 56extern "C" int64_t art_quick_get64_instance_from_code(uint32_t, void*); 57extern "C" int64_t art_quick_get64_static_from_code(uint32_t); 58extern "C" void* art_quick_get_obj_instance_from_code(uint32_t, void*); 59extern "C" void* art_quick_get_obj_static_from_code(uint32_t); 60 61// FillArray entrypoint. 62extern "C" void art_quick_handle_fill_data_from_code(void*, void*); 63 64// Lock entrypoints. 65extern "C" void art_quick_lock_object_from_code(void*); 66extern "C" void art_quick_unlock_object_from_code(void*); 67 68// Math entrypoints. 69extern int32_t CmpgDouble(double a, double b); 70extern int32_t CmplDouble(double a, double b); 71extern int32_t CmpgFloat(float a, float b); 72extern int32_t CmplFloat(float a, float b); 73 74// Math conversions. 75extern "C" int32_t __aeabi_f2iz(float op1); // FLOAT_TO_INT 76extern "C" int32_t __aeabi_d2iz(double op1); // DOUBLE_TO_INT 77extern "C" float __aeabi_l2f(int64_t op1); // LONG_TO_FLOAT 78extern "C" double __aeabi_l2d(int64_t op1); // LONG_TO_DOUBLE 79 80// Single-precision FP arithmetics. 81extern "C" float fmodf(float a, float b); // REM_FLOAT[_2ADDR] 82 83// Double-precision FP arithmetics. 84extern "C" double fmod(double a, double b); // REM_DOUBLE[_2ADDR] 85 86// Integer arithmetics. 87extern "C" int __aeabi_idivmod(int32_t, int32_t); // [DIV|REM]_INT[_2ADDR|_LIT8|_LIT16] 88 89// Long long arithmetics - REM_LONG[_2ADDR] and DIV_LONG[_2ADDR] 90extern "C" int64_t __aeabi_ldivmod(int64_t, int64_t); 91extern "C" int64_t art_quick_mul_long(int64_t, int64_t); 92extern "C" uint64_t art_quick_shl_long(uint64_t, uint32_t); 93extern "C" uint64_t art_quick_shr_long(uint64_t, uint32_t); 94extern "C" uint64_t art_quick_ushr_long(uint64_t, uint32_t); 95 96// Interpreter entrypoints. 97extern "C" void artInterpreterToInterpreterEntry(Thread* self, MethodHelper& mh, 98 const DexFile::CodeItem* code_item, 99 ShadowFrame* shadow_frame, JValue* result); 100extern "C" void artInterpreterToQuickEntry(Thread* self, MethodHelper& mh, 101 const DexFile::CodeItem* code_item, 102 ShadowFrame* shadow_frame, JValue* result); 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" const void* artPortableResolutionTrampoline(mirror::AbstractMethod* called, 111 mirror::Object* receiver, 112 mirror::AbstractMethod** sp, Thread* thread); 113extern "C" const void* artQuickResolutionTrampoline(mirror::AbstractMethod* called, 114 mirror::Object* receiver, 115 mirror::AbstractMethod** sp, Thread* thread); 116extern "C" void art_quick_invoke_direct_trampoline_with_access_check(uint32_t, void*); 117extern "C" void art_quick_invoke_interface_trampoline(uint32_t, void*); 118extern "C" void art_quick_invoke_interface_trampoline_with_access_check(uint32_t, void*); 119extern "C" void art_quick_invoke_static_trampoline_with_access_check(uint32_t, void*); 120extern "C" void art_quick_invoke_super_trampoline_with_access_check(uint32_t, void*); 121extern "C" void art_quick_invoke_virtual_trampoline_with_access_check(uint32_t, void*); 122 123// Thread entrypoints. 124extern void CheckSuspendFromCode(Thread* thread); 125extern "C" void art_quick_test_suspend(); 126 127// Throw entrypoints. 128extern "C" void art_quick_deliver_exception_from_code(void*); 129extern "C" void art_quick_throw_array_bounds_from_code(int32_t index, int32_t limit); 130extern "C" void art_quick_throw_div_zero_from_code(); 131extern "C" void art_quick_throw_no_such_method_from_code(int32_t method_idx); 132extern "C" void art_quick_throw_null_pointer_exception_from_code(); 133extern "C" void art_quick_throw_stack_overflow_from_code(void*); 134 135void InitEntryPoints(QuickEntryPoints* qpoints, PortableEntryPoints* ppoints) { 136 // Alloc 137 qpoints->pAllocArrayFromCode = art_quick_alloc_array_from_code; 138 qpoints->pAllocArrayFromCodeWithAccessCheck = art_quick_alloc_array_from_code_with_access_check; 139 qpoints->pAllocObjectFromCode = art_quick_alloc_object_from_code; 140 qpoints->pAllocObjectFromCodeWithAccessCheck = art_quick_alloc_object_from_code_with_access_check; 141 qpoints->pCheckAndAllocArrayFromCode = art_quick_check_and_alloc_array_from_code; 142 qpoints->pCheckAndAllocArrayFromCodeWithAccessCheck = art_quick_check_and_alloc_array_from_code_with_access_check; 143 144 // Cast 145 qpoints->pInstanceofNonTrivialFromCode = artIsAssignableFromCode; 146 qpoints->pCanPutArrayElementFromCode = art_quick_can_put_array_element_from_code; 147 qpoints->pCheckCastFromCode = art_quick_check_cast_from_code; 148 149 // DexCache 150 qpoints->pInitializeStaticStorage = art_quick_initialize_static_storage_from_code; 151 qpoints->pInitializeTypeAndVerifyAccessFromCode = art_quick_initialize_type_and_verify_access_from_code; 152 qpoints->pInitializeTypeFromCode = art_quick_initialize_type_from_code; 153 qpoints->pResolveStringFromCode = art_quick_resolve_string_from_code; 154 155 // Field 156 qpoints->pSet32Instance = art_quick_set32_instance_from_code; 157 qpoints->pSet32Static = art_quick_set32_static_from_code; 158 qpoints->pSet64Instance = art_quick_set64_instance_from_code; 159 qpoints->pSet64Static = art_quick_set64_static_from_code; 160 qpoints->pSetObjInstance = art_quick_set_obj_instance_from_code; 161 qpoints->pSetObjStatic = art_quick_set_obj_static_from_code; 162 qpoints->pGet32Instance = art_quick_get32_instance_from_code; 163 qpoints->pGet64Instance = art_quick_get64_instance_from_code; 164 qpoints->pGetObjInstance = art_quick_get_obj_instance_from_code; 165 qpoints->pGet32Static = art_quick_get32_static_from_code; 166 qpoints->pGet64Static = art_quick_get64_static_from_code; 167 qpoints->pGetObjStatic = art_quick_get_obj_static_from_code; 168 169 // FillArray 170 qpoints->pHandleFillArrayDataFromCode = art_quick_handle_fill_data_from_code; 171 172 // JNI 173 qpoints->pJniMethodStart = JniMethodStart; 174 qpoints->pJniMethodStartSynchronized = JniMethodStartSynchronized; 175 qpoints->pJniMethodEnd = JniMethodEnd; 176 qpoints->pJniMethodEndSynchronized = JniMethodEndSynchronized; 177 qpoints->pJniMethodEndWithReference = JniMethodEndWithReference; 178 qpoints->pJniMethodEndWithReferenceSynchronized = JniMethodEndWithReferenceSynchronized; 179 180 // Locks 181 qpoints->pLockObjectFromCode = art_quick_lock_object_from_code; 182 qpoints->pUnlockObjectFromCode = art_quick_unlock_object_from_code; 183 184 // Math 185 qpoints->pCmpgDouble = CmpgDouble; 186 qpoints->pCmpgFloat = CmpgFloat; 187 qpoints->pCmplDouble = CmplDouble; 188 qpoints->pCmplFloat = CmplFloat; 189 qpoints->pFmod = fmod; 190 qpoints->pSqrt = sqrt; 191 qpoints->pL2d = __aeabi_l2d; 192 qpoints->pFmodf = fmodf; 193 qpoints->pL2f = __aeabi_l2f; 194 qpoints->pD2iz = __aeabi_d2iz; 195 qpoints->pF2iz = __aeabi_f2iz; 196 qpoints->pIdivmod = __aeabi_idivmod; 197 qpoints->pD2l = art_d2l; 198 qpoints->pF2l = art_f2l; 199 qpoints->pLdiv = __aeabi_ldivmod; 200 qpoints->pLdivmod = __aeabi_ldivmod; // result returned in r2:r3 201 qpoints->pLmul = art_quick_mul_long; 202 qpoints->pShlLong = art_quick_shl_long; 203 qpoints->pShrLong = art_quick_shr_long; 204 qpoints->pUshrLong = art_quick_ushr_long; 205 206 // Interpreter 207 qpoints->pInterpreterToInterpreterEntry = artInterpreterToInterpreterEntry; 208 qpoints->pInterpreterToQuickEntry = artInterpreterToQuickEntry; 209 210 // Intrinsics 211 qpoints->pIndexOf = art_quick_indexof; 212 qpoints->pMemcmp16 = __memcmp16; 213 qpoints->pStringCompareTo = art_quick_string_compareto; 214 qpoints->pMemcpy = memcpy; 215 216 // Invocation 217 qpoints->pQuickResolutionTrampolineFromCode = artQuickResolutionTrampoline; 218 qpoints->pInvokeDirectTrampolineWithAccessCheck = art_quick_invoke_direct_trampoline_with_access_check; 219 qpoints->pInvokeInterfaceTrampoline = art_quick_invoke_interface_trampoline; 220 qpoints->pInvokeInterfaceTrampolineWithAccessCheck = art_quick_invoke_interface_trampoline_with_access_check; 221 qpoints->pInvokeStaticTrampolineWithAccessCheck = art_quick_invoke_static_trampoline_with_access_check; 222 qpoints->pInvokeSuperTrampolineWithAccessCheck = art_quick_invoke_super_trampoline_with_access_check; 223 qpoints->pInvokeVirtualTrampolineWithAccessCheck = art_quick_invoke_virtual_trampoline_with_access_check; 224 225 // Thread 226 qpoints->pCheckSuspendFromCode = CheckSuspendFromCode; 227 qpoints->pTestSuspendFromCode = art_quick_test_suspend; 228 229 // Throws 230 qpoints->pDeliverException = art_quick_deliver_exception_from_code; 231 qpoints->pThrowArrayBoundsFromCode = art_quick_throw_array_bounds_from_code; 232 qpoints->pThrowDivZeroFromCode = art_quick_throw_div_zero_from_code; 233 qpoints->pThrowNoSuchMethodFromCode = art_quick_throw_no_such_method_from_code; 234 qpoints->pThrowNullPointerFromCode = art_quick_throw_null_pointer_exception_from_code; 235 qpoints->pThrowStackOverflowFromCode = art_quick_throw_stack_overflow_from_code; 236 237 // Portable 238 ppoints->pPortableResolutionTrampolineFromCode = artPortableResolutionTrampoline; 239}; 240 241} // namespace art 242