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 | |
Mingyao Yang | 98d1cc8 | 2014-05-15 17:02:16 -0700 | [diff] [blame] | 17 | #include "entrypoints/jni/jni_entrypoints.h" |
Mathieu Chartier | d889178 | 2014-03-02 13:28:37 -0800 | [diff] [blame] | 18 | #include "entrypoints/quick/quick_alloc_entrypoints.h" |
Andreas Gampe | e179456 | 2014-11-04 22:26:32 -0800 | [diff] [blame] | 19 | #include "entrypoints/quick/quick_default_externs.h" |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 20 | #include "entrypoints/quick/quick_entrypoints.h" |
| 21 | #include "entrypoints/entrypoint_utils.h" |
| 22 | #include "entrypoints/math_entrypoints.h" |
Andreas Gampe | e179456 | 2014-11-04 22:26:32 -0800 | [diff] [blame] | 23 | #include "entrypoints/runtime_asm_entrypoints.h" |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 24 | #include "interpreter/interpreter.h" |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 25 | |
| 26 | namespace art { |
| 27 | |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 28 | // Cast entrypoints. |
| 29 | extern "C" uint32_t artIsAssignableFromCode(const mirror::Class* klass, |
| 30 | const mirror::Class* ref_class); |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 31 | |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 32 | |
Zheng Xu | 5667fdb | 2014-10-23 18:29:55 +0800 | [diff] [blame] | 33 | // Used by soft float. |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 34 | // Single-precision FP arithmetics. |
Zheng Xu | 5667fdb | 2014-10-23 18:29:55 +0800 | [diff] [blame] | 35 | extern "C" float fmodf(float a, float b); // REM_FLOAT[_2ADDR] |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 36 | // Double-precision FP arithmetics. |
Zheng Xu | 5667fdb | 2014-10-23 18:29:55 +0800 | [diff] [blame] | 37 | extern "C" double fmod(double a, double b); // REM_DOUBLE[_2ADDR] |
| 38 | |
| 39 | // Used by hard float. |
Zheng Xu | 5667fdb | 2014-10-23 18:29:55 +0800 | [diff] [blame] | 40 | extern "C" float art_quick_fmodf(float a, float b); // REM_FLOAT[_2ADDR] |
| 41 | extern "C" double art_quick_fmod(double a, double b); // REM_DOUBLE[_2ADDR] |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 42 | |
| 43 | // Integer arithmetics. |
| 44 | extern "C" int __aeabi_idivmod(int32_t, int32_t); // [DIV|REM]_INT[_2ADDR|_LIT8|_LIT16] |
| 45 | |
| 46 | // Long long arithmetics - REM_LONG[_2ADDR] and DIV_LONG[_2ADDR] |
| 47 | extern "C" int64_t __aeabi_ldivmod(int64_t, int64_t); |
Andreas Gampe | 277ccbd | 2014-11-03 21:36:10 -0800 | [diff] [blame] | 48 | |
Andreas Gampe | 3cfa4d0 | 2015-10-06 17:04:01 -0700 | [diff] [blame] | 49 | void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) { |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 50 | // JNI |
| 51 | jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub; |
| 52 | |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 53 | // Alloc |
Hiroshi Yamauchi | 3b4c189 | 2013-09-12 21:33:12 -0700 | [diff] [blame] | 54 | ResetQuickAllocEntryPoints(qpoints); |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 55 | |
| 56 | // Cast |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 57 | qpoints->pInstanceofNonTrivial = artIsAssignableFromCode; |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 58 | qpoints->pCheckCast = art_quick_check_cast; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 59 | |
| 60 | // DexCache |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 61 | qpoints->pInitializeStaticStorage = art_quick_initialize_static_storage; |
| 62 | qpoints->pInitializeTypeAndVerifyAccess = art_quick_initialize_type_and_verify_access; |
| 63 | qpoints->pInitializeType = art_quick_initialize_type; |
| 64 | qpoints->pResolveString = art_quick_resolve_string; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 65 | |
| 66 | // Field |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 67 | qpoints->pSet8Instance = art_quick_set8_instance; |
| 68 | qpoints->pSet8Static = art_quick_set8_static; |
| 69 | qpoints->pSet16Instance = art_quick_set16_instance; |
| 70 | qpoints->pSet16Static = art_quick_set16_static; |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 71 | qpoints->pSet32Instance = art_quick_set32_instance; |
| 72 | qpoints->pSet32Static = art_quick_set32_static; |
| 73 | qpoints->pSet64Instance = art_quick_set64_instance; |
| 74 | qpoints->pSet64Static = art_quick_set64_static; |
| 75 | qpoints->pSetObjInstance = art_quick_set_obj_instance; |
| 76 | qpoints->pSetObjStatic = art_quick_set_obj_static; |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 77 | qpoints->pGetByteInstance = art_quick_get_byte_instance; |
| 78 | qpoints->pGetBooleanInstance = art_quick_get_boolean_instance; |
| 79 | qpoints->pGetShortInstance = art_quick_get_short_instance; |
| 80 | qpoints->pGetCharInstance = art_quick_get_char_instance; |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 81 | qpoints->pGet32Instance = art_quick_get32_instance; |
| 82 | qpoints->pGet64Instance = art_quick_get64_instance; |
| 83 | qpoints->pGetObjInstance = art_quick_get_obj_instance; |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 84 | qpoints->pGetByteStatic = art_quick_get_byte_static; |
| 85 | qpoints->pGetBooleanStatic = art_quick_get_boolean_static; |
| 86 | qpoints->pGetShortStatic = art_quick_get_short_static; |
| 87 | qpoints->pGetCharStatic = art_quick_get_char_static; |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 88 | qpoints->pGet32Static = art_quick_get32_static; |
| 89 | qpoints->pGet64Static = art_quick_get64_static; |
| 90 | qpoints->pGetObjStatic = art_quick_get_obj_static; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 91 | |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 92 | // Array |
| 93 | qpoints->pAputObjectWithNullAndBoundCheck = art_quick_aput_obj_with_null_and_bound_check; |
| 94 | qpoints->pAputObjectWithBoundCheck = art_quick_aput_obj_with_bound_check; |
| 95 | qpoints->pAputObject = art_quick_aput_obj; |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 96 | qpoints->pHandleFillArrayData = art_quick_handle_fill_data; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 97 | |
| 98 | // JNI |
| 99 | qpoints->pJniMethodStart = JniMethodStart; |
| 100 | qpoints->pJniMethodStartSynchronized = JniMethodStartSynchronized; |
| 101 | qpoints->pJniMethodEnd = JniMethodEnd; |
| 102 | qpoints->pJniMethodEndSynchronized = JniMethodEndSynchronized; |
| 103 | qpoints->pJniMethodEndWithReference = JniMethodEndWithReference; |
| 104 | qpoints->pJniMethodEndWithReferenceSynchronized = JniMethodEndWithReferenceSynchronized; |
Andreas Gampe | 2da8823 | 2014-02-27 12:26:20 -0800 | [diff] [blame] | 105 | qpoints->pQuickGenericJniTrampoline = art_quick_generic_jni_trampoline; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 106 | |
| 107 | // Locks |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 108 | qpoints->pLockObject = art_quick_lock_object; |
| 109 | qpoints->pUnlockObject = art_quick_unlock_object; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 110 | |
| 111 | // Math |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 112 | qpoints->pIdivmod = __aeabi_idivmod; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 113 | qpoints->pLdiv = __aeabi_ldivmod; |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 114 | qpoints->pLmod = __aeabi_ldivmod; // result returned in r2:r3 |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 115 | qpoints->pLmul = art_quick_mul_long; |
| 116 | qpoints->pShlLong = art_quick_shl_long; |
| 117 | qpoints->pShrLong = art_quick_shr_long; |
| 118 | qpoints->pUshrLong = art_quick_ushr_long; |
Zheng Xu | 5667fdb | 2014-10-23 18:29:55 +0800 | [diff] [blame] | 119 | if (kArm32QuickCodeUseSoftFloat) { |
| 120 | qpoints->pFmod = fmod; |
| 121 | qpoints->pFmodf = fmodf; |
| 122 | qpoints->pD2l = art_d2l; |
| 123 | qpoints->pF2l = art_f2l; |
Roland Levillain | 5b3ee56 | 2015-04-14 16:02:41 +0100 | [diff] [blame] | 124 | qpoints->pL2f = art_l2f; |
Zheng Xu | 5667fdb | 2014-10-23 18:29:55 +0800 | [diff] [blame] | 125 | } else { |
| 126 | qpoints->pFmod = art_quick_fmod; |
| 127 | qpoints->pFmodf = art_quick_fmodf; |
| 128 | qpoints->pD2l = art_quick_d2l; |
| 129 | qpoints->pF2l = art_quick_f2l; |
Roland Levillain | 5b3ee56 | 2015-04-14 16:02:41 +0100 | [diff] [blame] | 130 | qpoints->pL2f = art_quick_l2f; |
Zheng Xu | 5667fdb | 2014-10-23 18:29:55 +0800 | [diff] [blame] | 131 | } |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 132 | |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 133 | // Intrinsics |
| 134 | qpoints->pIndexOf = art_quick_indexof; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 135 | qpoints->pStringCompareTo = art_quick_string_compareto; |
| 136 | qpoints->pMemcpy = memcpy; |
| 137 | |
| 138 | // Invocation |
Jeff Hao | 88474b4 | 2013-10-23 16:24:40 -0700 | [diff] [blame] | 139 | qpoints->pQuickImtConflictTrampoline = art_quick_imt_conflict_trampoline; |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 140 | qpoints->pQuickResolutionTrampoline = art_quick_resolution_trampoline; |
| 141 | qpoints->pQuickToInterpreterBridge = art_quick_to_interpreter_bridge; |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 142 | qpoints->pInvokeDirectTrampolineWithAccessCheck = |
| 143 | art_quick_invoke_direct_trampoline_with_access_check; |
| 144 | qpoints->pInvokeInterfaceTrampolineWithAccessCheck = |
| 145 | art_quick_invoke_interface_trampoline_with_access_check; |
| 146 | qpoints->pInvokeStaticTrampolineWithAccessCheck = |
| 147 | art_quick_invoke_static_trampoline_with_access_check; |
| 148 | qpoints->pInvokeSuperTrampolineWithAccessCheck = |
| 149 | art_quick_invoke_super_trampoline_with_access_check; |
| 150 | qpoints->pInvokeVirtualTrampolineWithAccessCheck = |
| 151 | art_quick_invoke_virtual_trampoline_with_access_check; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 152 | |
| 153 | // Thread |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 154 | qpoints->pTestSuspend = art_quick_test_suspend; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 155 | |
| 156 | // Throws |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 157 | qpoints->pDeliverException = art_quick_deliver_exception; |
| 158 | qpoints->pThrowArrayBounds = art_quick_throw_array_bounds; |
| 159 | qpoints->pThrowDivZero = art_quick_throw_div_zero; |
| 160 | qpoints->pThrowNoSuchMethod = art_quick_throw_no_such_method; |
| 161 | qpoints->pThrowNullPointer = art_quick_throw_null_pointer_exception; |
| 162 | qpoints->pThrowStackOverflow = art_quick_throw_stack_overflow; |
Mingyao Yang | d43b3ac | 2015-04-01 14:03:04 -0700 | [diff] [blame] | 163 | |
Sebastien Hertz | 0747466 | 2015-08-25 15:12:33 +0000 | [diff] [blame] | 164 | // Deoptimization from compiled code. |
| 165 | qpoints->pDeoptimize = art_quick_deoptimize_from_compiled_code; |
Hiroshi Yamauchi | 1cc71eb | 2015-05-07 10:47:27 -0700 | [diff] [blame] | 166 | |
Roland Levillain | 0d5a281 | 2015-11-13 10:07:31 +0000 | [diff] [blame] | 167 | // Read barrier. |
Hiroshi Yamauchi | 1cc71eb | 2015-05-07 10:47:27 -0700 | [diff] [blame] | 168 | qpoints->pReadBarrierJni = ReadBarrierJni; |
Man Cao | 1aee900 | 2015-07-14 22:31:42 -0700 | [diff] [blame] | 169 | qpoints->pReadBarrierSlow = artReadBarrierSlow; |
Roland Levillain | 0d5a281 | 2015-11-13 10:07:31 +0000 | [diff] [blame] | 170 | qpoints->pReadBarrierForRootSlow = artReadBarrierForRootSlow; |
Andreas Gampe | c8ccf68 | 2014-09-29 20:07:43 -0700 | [diff] [blame] | 171 | } |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 172 | |
| 173 | } // namespace art |