Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 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 | |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 17 | #include "atomic.h" |
Mingyao Yang | 98d1cc8 | 2014-05-15 17:02:16 -0700 | [diff] [blame] | 18 | #include "entrypoints/interpreter/interpreter_entrypoints.h" |
| 19 | #include "entrypoints/jni/jni_entrypoints.h" |
Mathieu Chartier | d889178 | 2014-03-02 13:28:37 -0800 | [diff] [blame] | 20 | #include "entrypoints/quick/quick_alloc_entrypoints.h" |
Andreas Gampe | e179456 | 2014-11-04 22:26:32 -0800 | [diff] [blame] | 21 | #include "entrypoints/quick/quick_default_externs.h" |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 22 | #include "entrypoints/quick/quick_entrypoints.h" |
| 23 | #include "entrypoints/entrypoint_utils.h" |
| 24 | #include "entrypoints/math_entrypoints.h" |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 25 | #include "entrypoints/runtime_asm_entrypoints.h" |
| 26 | #include "interpreter/interpreter.h" |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 27 | |
| 28 | namespace art { |
| 29 | |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 30 | // Cast entrypoints. |
| 31 | extern "C" uint32_t artIsAssignableFromCode(const mirror::Class* klass, |
| 32 | const mirror::Class* ref_class); |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 33 | |
| 34 | // Math entrypoints. |
| 35 | extern int32_t CmpgDouble(double a, double b); |
| 36 | extern int32_t CmplDouble(double a, double b); |
| 37 | extern int32_t CmpgFloat(float a, float b); |
| 38 | extern int32_t CmplFloat(float a, float b); |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 39 | extern "C" int64_t artLmul(int64_t a, int64_t b); |
| 40 | extern "C" int64_t artLdiv(int64_t a, int64_t b); |
| 41 | extern "C" int64_t artLmod(int64_t a, int64_t b); |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 42 | |
| 43 | // Math conversions. |
| 44 | extern "C" int32_t __fixsfsi(float op1); // FLOAT_TO_INT |
| 45 | extern "C" int32_t __fixdfsi(double op1); // DOUBLE_TO_INT |
| 46 | extern "C" float __floatdisf(int64_t op1); // LONG_TO_FLOAT |
| 47 | extern "C" double __floatdidf(int64_t op1); // LONG_TO_DOUBLE |
| 48 | extern "C" int64_t __fixsfdi(float op1); // FLOAT_TO_LONG |
| 49 | extern "C" int64_t __fixdfdi(double op1); // DOUBLE_TO_LONG |
| 50 | |
| 51 | // Single-precision FP arithmetics. |
| 52 | extern "C" float fmodf(float a, float b); // REM_FLOAT[_2ADDR] |
| 53 | |
| 54 | // Double-precision FP arithmetics. |
| 55 | extern "C" double fmod(double a, double b); // REM_DOUBLE[_2ADDR] |
| 56 | |
| 57 | // Long long arithmetics - REM_LONG[_2ADDR] and DIV_LONG[_2ADDR] |
| 58 | extern "C" int64_t __divdi3(int64_t, int64_t); |
| 59 | extern "C" int64_t __moddi3(int64_t, int64_t); |
Hiroshi Yamauchi | 3b4c189 | 2013-09-12 21:33:12 -0700 | [diff] [blame] | 60 | |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 61 | void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints, |
Elliott Hughes | 956af0f | 2014-12-11 14:34:28 -0800 | [diff] [blame] | 62 | QuickEntryPoints* qpoints) { |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 63 | // Interpreter |
| 64 | ipoints->pInterpreterToInterpreterBridge = artInterpreterToInterpreterBridge; |
Dragos Sbirlea | 08bf196 | 2013-08-12 08:53:04 -0700 | [diff] [blame] | 65 | ipoints->pInterpreterToCompiledCodeBridge = artInterpreterToCompiledCodeBridge; |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 66 | |
| 67 | // JNI |
| 68 | jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub; |
| 69 | |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 70 | // Alloc |
Hiroshi Yamauchi | 3b4c189 | 2013-09-12 21:33:12 -0700 | [diff] [blame] | 71 | ResetQuickAllocEntryPoints(qpoints); |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 72 | |
| 73 | // Cast |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 74 | qpoints->pInstanceofNonTrivial = artIsAssignableFromCode; |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 75 | qpoints->pCheckCast = art_quick_check_cast; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 76 | |
| 77 | // DexCache |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 78 | qpoints->pInitializeStaticStorage = art_quick_initialize_static_storage; |
| 79 | qpoints->pInitializeTypeAndVerifyAccess = art_quick_initialize_type_and_verify_access; |
| 80 | qpoints->pInitializeType = art_quick_initialize_type; |
| 81 | qpoints->pResolveString = art_quick_resolve_string; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 82 | |
| 83 | // Field |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 84 | qpoints->pSet8Instance = art_quick_set8_instance; |
| 85 | qpoints->pSet8Static = art_quick_set8_static; |
| 86 | qpoints->pSet16Instance = art_quick_set16_instance; |
| 87 | qpoints->pSet16Static = art_quick_set16_static; |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 88 | qpoints->pSet32Instance = art_quick_set32_instance; |
| 89 | qpoints->pSet32Static = art_quick_set32_static; |
| 90 | qpoints->pSet64Instance = art_quick_set64_instance; |
| 91 | qpoints->pSet64Static = art_quick_set64_static; |
| 92 | qpoints->pSetObjInstance = art_quick_set_obj_instance; |
| 93 | qpoints->pSetObjStatic = art_quick_set_obj_static; |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 94 | qpoints->pGetBooleanInstance = art_quick_get_boolean_instance; |
| 95 | qpoints->pGetByteInstance = art_quick_get_byte_instance; |
| 96 | qpoints->pGetCharInstance = art_quick_get_char_instance; |
| 97 | qpoints->pGetShortInstance = art_quick_get_short_instance; |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 98 | qpoints->pGet32Instance = art_quick_get32_instance; |
| 99 | qpoints->pGet64Instance = art_quick_get64_instance; |
| 100 | qpoints->pGetObjInstance = art_quick_get_obj_instance; |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 101 | qpoints->pGetBooleanStatic = art_quick_get_boolean_static; |
| 102 | qpoints->pGetByteStatic = art_quick_get_byte_static; |
| 103 | qpoints->pGetCharStatic = art_quick_get_char_static; |
| 104 | qpoints->pGetShortStatic = art_quick_get_short_static; |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 105 | qpoints->pGet32Static = art_quick_get32_static; |
| 106 | qpoints->pGet64Static = art_quick_get64_static; |
| 107 | qpoints->pGetObjStatic = art_quick_get_obj_static; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 108 | |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 109 | // Array |
| 110 | qpoints->pAputObjectWithNullAndBoundCheck = art_quick_aput_obj_with_null_and_bound_check; |
| 111 | qpoints->pAputObjectWithBoundCheck = art_quick_aput_obj_with_bound_check; |
| 112 | qpoints->pAputObject = art_quick_aput_obj; |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 113 | qpoints->pHandleFillArrayData = art_quick_handle_fill_data; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 114 | |
| 115 | // JNI |
| 116 | qpoints->pJniMethodStart = JniMethodStart; |
| 117 | qpoints->pJniMethodStartSynchronized = JniMethodStartSynchronized; |
| 118 | qpoints->pJniMethodEnd = JniMethodEnd; |
| 119 | qpoints->pJniMethodEndSynchronized = JniMethodEndSynchronized; |
| 120 | qpoints->pJniMethodEndWithReference = JniMethodEndWithReference; |
| 121 | qpoints->pJniMethodEndWithReferenceSynchronized = JniMethodEndWithReferenceSynchronized; |
Andreas Gampe | 2da8823 | 2014-02-27 12:26:20 -0800 | [diff] [blame] | 122 | qpoints->pQuickGenericJniTrampoline = art_quick_generic_jni_trampoline; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 123 | |
| 124 | // Locks |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 125 | qpoints->pLockObject = art_quick_lock_object; |
| 126 | qpoints->pUnlockObject = art_quick_unlock_object; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 127 | |
| 128 | // Math |
| 129 | qpoints->pCmpgDouble = CmpgDouble; |
| 130 | qpoints->pCmpgFloat = CmpgFloat; |
| 131 | qpoints->pCmplDouble = CmplDouble; |
| 132 | qpoints->pCmplFloat = CmplFloat; |
| 133 | qpoints->pFmod = fmod; |
Douglas Leung | d9cb8ae | 2014-07-09 14:28:35 -0700 | [diff] [blame] | 134 | qpoints->pL2d = art_l2d; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 135 | qpoints->pFmodf = fmodf; |
Douglas Leung | d9cb8ae | 2014-07-09 14:28:35 -0700 | [diff] [blame] | 136 | qpoints->pL2f = art_l2f; |
| 137 | qpoints->pD2iz = art_d2i; |
| 138 | qpoints->pF2iz = art_f2i; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 139 | qpoints->pIdivmod = NULL; |
| 140 | qpoints->pD2l = art_d2l; |
| 141 | qpoints->pF2l = art_f2l; |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 142 | qpoints->pLdiv = artLdiv; |
| 143 | qpoints->pLmod = artLmod; |
| 144 | qpoints->pLmul = artLmul; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 145 | qpoints->pShlLong = art_quick_shl_long; |
| 146 | qpoints->pShrLong = art_quick_shr_long; |
| 147 | qpoints->pUshrLong = art_quick_ushr_long; |
| 148 | |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 149 | // Intrinsics |
| 150 | qpoints->pIndexOf = art_quick_indexof; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 151 | qpoints->pStringCompareTo = art_quick_string_compareto; |
| 152 | qpoints->pMemcpy = memcpy; |
| 153 | |
| 154 | // Invocation |
Jeff Hao | 88474b4 | 2013-10-23 16:24:40 -0700 | [diff] [blame] | 155 | qpoints->pQuickImtConflictTrampoline = art_quick_imt_conflict_trampoline; |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 156 | qpoints->pQuickResolutionTrampoline = art_quick_resolution_trampoline; |
| 157 | qpoints->pQuickToInterpreterBridge = art_quick_to_interpreter_bridge; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 158 | qpoints->pInvokeDirectTrampolineWithAccessCheck = art_quick_invoke_direct_trampoline_with_access_check; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 159 | qpoints->pInvokeInterfaceTrampolineWithAccessCheck = art_quick_invoke_interface_trampoline_with_access_check; |
| 160 | qpoints->pInvokeStaticTrampolineWithAccessCheck = art_quick_invoke_static_trampoline_with_access_check; |
| 161 | qpoints->pInvokeSuperTrampolineWithAccessCheck = art_quick_invoke_super_trampoline_with_access_check; |
| 162 | qpoints->pInvokeVirtualTrampolineWithAccessCheck = art_quick_invoke_virtual_trampoline_with_access_check; |
| 163 | |
| 164 | // Thread |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 165 | qpoints->pTestSuspend = art_quick_test_suspend; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 166 | |
| 167 | // Throws |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 168 | qpoints->pDeliverException = art_quick_deliver_exception; |
| 169 | qpoints->pThrowArrayBounds = art_quick_throw_array_bounds; |
| 170 | qpoints->pThrowDivZero = art_quick_throw_div_zero; |
| 171 | qpoints->pThrowNoSuchMethod = art_quick_throw_no_such_method; |
| 172 | qpoints->pThrowNullPointer = art_quick_throw_null_pointer_exception; |
| 173 | qpoints->pThrowStackOverflow = art_quick_throw_stack_overflow; |
Douglas Leung | d9cb8ae | 2014-07-09 14:28:35 -0700 | [diff] [blame] | 174 | |
| 175 | // Atomic 64-bit load/store |
| 176 | qpoints->pA64Load = QuasiAtomic::Read64; |
| 177 | qpoints->pA64Store = QuasiAtomic::Write64; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 178 | }; |
| 179 | |
| 180 | } // namespace art |