Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 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" |
Mingyao Yang | 98d1cc8 | 2014-05-15 17:02:16 -0700 | [diff] [blame] | 18 | #include "entrypoints/jni/jni_entrypoints.h" |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 19 | #include "entrypoints/portable/portable_entrypoints.h" |
| 20 | #include "entrypoints/quick/quick_entrypoints.h" |
| 21 | #include "entrypoints/entrypoint_utils.h" |
| 22 | #include "entrypoints/math_entrypoints.h" |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame^] | 23 | #include "entrypoints/runtime_asm_entrypoints.h" |
| 24 | #include "interpreter/interpreter.h" |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 25 | |
| 26 | namespace art { |
| 27 | |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 28 | // Portable entrypoints. |
| 29 | extern "C" void art_portable_resolution_trampoline(mirror::ArtMethod*); |
| 30 | extern "C" void art_portable_to_interpreter_bridge(mirror::ArtMethod*); |
| 31 | |
| 32 | // Cast entrypoints. |
Serban Constantinescu | 86797a7 | 2014-06-19 16:17:56 +0100 | [diff] [blame] | 33 | extern "C" uint32_t art_quick_assignable_from_code(const mirror::Class* klass, |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 34 | const mirror::Class* ref_class); |
| 35 | extern "C" void art_quick_check_cast(void*, void*); |
| 36 | |
| 37 | // DexCache entrypoints. |
| 38 | extern "C" void* art_quick_initialize_static_storage(uint32_t, void*); |
| 39 | extern "C" void* art_quick_initialize_type(uint32_t, void*); |
| 40 | extern "C" void* art_quick_initialize_type_and_verify_access(uint32_t, void*); |
| 41 | extern "C" void* art_quick_resolve_string(void*, uint32_t); |
| 42 | |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 43 | // Field entrypoints. |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 44 | extern "C" int art_quick_set8_instance(uint32_t, void*, int8_t); |
| 45 | extern "C" int art_quick_set8_static(uint32_t, int8_t); |
| 46 | extern "C" int art_quick_set16_instance(uint32_t, void*, int16_t); |
| 47 | extern "C" int art_quick_set16_static(uint32_t, int16_t); |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 48 | extern "C" int art_quick_set32_instance(uint32_t, void*, int32_t); |
| 49 | extern "C" int art_quick_set32_static(uint32_t, int32_t); |
| 50 | extern "C" int art_quick_set64_instance(uint32_t, void*, int64_t); |
| 51 | extern "C" int art_quick_set64_static(uint32_t, int64_t); |
| 52 | extern "C" int art_quick_set_obj_instance(uint32_t, void*, void*); |
| 53 | extern "C" int art_quick_set_obj_static(uint32_t, void*); |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 54 | extern "C" uint8_t art_quick_get_boolean_instance(uint32_t, void*); |
| 55 | extern "C" int8_t art_quick_get_byte_instance(uint32_t, void*); |
| 56 | extern "C" uint8_t art_quick_get_boolean_static(uint32_t); |
| 57 | extern "C" int8_t art_quick_get_byte_static(uint32_t); |
| 58 | extern "C" uint16_t art_quick_get_char_instance(uint32_t, void*); |
| 59 | extern "C" int16_t art_quick_get_short_instance(uint32_t, void*); |
| 60 | extern "C" uint16_t art_quick_get_char_static(uint32_t); |
| 61 | extern "C" int16_t art_quick_get_short_static(uint32_t); |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 62 | extern "C" int32_t art_quick_get32_instance(uint32_t, void*); |
| 63 | extern "C" int32_t art_quick_get32_static(uint32_t); |
| 64 | extern "C" int64_t art_quick_get64_instance(uint32_t, void*); |
| 65 | extern "C" int64_t art_quick_get64_static(uint32_t); |
| 66 | extern "C" void* art_quick_get_obj_instance(uint32_t, void*); |
| 67 | extern "C" void* art_quick_get_obj_static(uint32_t); |
| 68 | |
| 69 | // Array entrypoints. |
| 70 | extern "C" void art_quick_aput_obj_with_null_and_bound_check(void*, uint32_t, void*); |
| 71 | extern "C" void art_quick_aput_obj_with_bound_check(void*, uint32_t, void*); |
| 72 | extern "C" void art_quick_aput_obj(void*, uint32_t, void*); |
| 73 | extern "C" void art_quick_handle_fill_data(void*, void*); |
| 74 | |
| 75 | // Lock entrypoints. |
| 76 | extern "C" void art_quick_lock_object(void*); |
| 77 | extern "C" void art_quick_unlock_object(void*); |
| 78 | |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 79 | // Single-precision FP arithmetics. |
Zheng Xu | 0210d11 | 2014-06-17 12:25:48 +0800 | [diff] [blame] | 80 | extern "C" float art_quick_fmodf(float a, float b); // REM_FLOAT[_2ADDR] |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 81 | |
| 82 | // Double-precision FP arithmetics. |
Zheng Xu | 0210d11 | 2014-06-17 12:25:48 +0800 | [diff] [blame] | 83 | extern "C" double art_quick_fmod(double a, double b); // REM_DOUBLE[_2ADDR] |
| 84 | |
| 85 | // Memcpy |
| 86 | extern "C" void* art_quick_memcpy(void* __restrict, const void* __restrict, size_t); |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 87 | |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 88 | // Intrinsic entrypoints. |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 89 | extern "C" int32_t art_quick_indexof(void*, uint32_t, uint32_t, uint32_t); |
| 90 | extern "C" int32_t art_quick_string_compareto(void*, void*); |
| 91 | |
| 92 | // Invoke entrypoints. |
| 93 | extern "C" void art_quick_imt_conflict_trampoline(mirror::ArtMethod*); |
| 94 | extern "C" void art_quick_resolution_trampoline(mirror::ArtMethod*); |
| 95 | extern "C" void art_quick_to_interpreter_bridge(mirror::ArtMethod*); |
| 96 | extern "C" void art_quick_invoke_direct_trampoline_with_access_check(uint32_t, void*); |
| 97 | extern "C" void art_quick_invoke_interface_trampoline_with_access_check(uint32_t, void*); |
| 98 | extern "C" void art_quick_invoke_static_trampoline_with_access_check(uint32_t, void*); |
| 99 | extern "C" void art_quick_invoke_super_trampoline_with_access_check(uint32_t, void*); |
| 100 | extern "C" void art_quick_invoke_virtual_trampoline_with_access_check(uint32_t, void*); |
| 101 | |
| 102 | // Thread entrypoints. |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 103 | extern "C" void art_quick_test_suspend(); |
| 104 | |
| 105 | // Throw entrypoints. |
| 106 | extern "C" void art_quick_deliver_exception(void*); |
| 107 | extern "C" void art_quick_throw_array_bounds(int32_t index, int32_t limit); |
| 108 | extern "C" void art_quick_throw_div_zero(); |
| 109 | extern "C" void art_quick_throw_no_such_method(int32_t method_idx); |
| 110 | extern "C" void art_quick_throw_null_pointer_exception(); |
| 111 | extern "C" void art_quick_throw_stack_overflow(void*); |
| 112 | |
| 113 | extern void ResetQuickAllocEntryPoints(QuickEntryPoints* qpoints); |
| 114 | |
| 115 | // Generic JNI downcall |
| 116 | extern "C" void art_quick_generic_jni_trampoline(mirror::ArtMethod*); |
| 117 | |
| 118 | void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints, |
| 119 | PortableEntryPoints* ppoints, QuickEntryPoints* qpoints) { |
| 120 | // Interpreter |
| 121 | ipoints->pInterpreterToInterpreterBridge = artInterpreterToInterpreterBridge; |
| 122 | ipoints->pInterpreterToCompiledCodeBridge = artInterpreterToCompiledCodeBridge; |
| 123 | |
| 124 | // JNI |
| 125 | jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub; |
| 126 | |
| 127 | // Portable |
| 128 | ppoints->pPortableResolutionTrampoline = art_portable_resolution_trampoline; |
| 129 | ppoints->pPortableToInterpreterBridge = art_portable_to_interpreter_bridge; |
| 130 | |
| 131 | // Alloc |
| 132 | ResetQuickAllocEntryPoints(qpoints); |
| 133 | |
| 134 | // Cast |
Serban Constantinescu | 86797a7 | 2014-06-19 16:17:56 +0100 | [diff] [blame] | 135 | qpoints->pInstanceofNonTrivial = art_quick_assignable_from_code; |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 136 | qpoints->pCheckCast = art_quick_check_cast; |
| 137 | |
| 138 | // DexCache |
| 139 | qpoints->pInitializeStaticStorage = art_quick_initialize_static_storage; |
| 140 | qpoints->pInitializeTypeAndVerifyAccess = art_quick_initialize_type_and_verify_access; |
| 141 | qpoints->pInitializeType = art_quick_initialize_type; |
| 142 | qpoints->pResolveString = art_quick_resolve_string; |
| 143 | |
| 144 | // Field |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 145 | qpoints->pSet8Instance = art_quick_set8_instance; |
| 146 | qpoints->pSet8Static = art_quick_set8_static; |
| 147 | qpoints->pSet16Instance = art_quick_set16_instance; |
| 148 | qpoints->pSet16Static = art_quick_set16_static; |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 149 | qpoints->pSet32Instance = art_quick_set32_instance; |
| 150 | qpoints->pSet32Static = art_quick_set32_static; |
| 151 | qpoints->pSet64Instance = art_quick_set64_instance; |
| 152 | qpoints->pSet64Static = art_quick_set64_static; |
| 153 | qpoints->pSetObjInstance = art_quick_set_obj_instance; |
| 154 | qpoints->pSetObjStatic = art_quick_set_obj_static; |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 155 | qpoints->pGetBooleanInstance = art_quick_get_boolean_instance; |
| 156 | qpoints->pGetByteInstance = art_quick_get_byte_instance; |
| 157 | qpoints->pGetCharInstance = art_quick_get_char_instance; |
| 158 | qpoints->pGetShortInstance = art_quick_get_short_instance; |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 159 | qpoints->pGet32Instance = art_quick_get32_instance; |
| 160 | qpoints->pGet64Instance = art_quick_get64_instance; |
| 161 | qpoints->pGetObjInstance = art_quick_get_obj_instance; |
Fred Shih | 37f05ef | 2014-07-16 18:38:08 -0700 | [diff] [blame] | 162 | qpoints->pGetBooleanStatic = art_quick_get_boolean_static; |
| 163 | qpoints->pGetByteStatic = art_quick_get_byte_static; |
| 164 | qpoints->pGetCharStatic = art_quick_get_char_static; |
| 165 | qpoints->pGetShortStatic = art_quick_get_short_static; |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 166 | qpoints->pGet32Static = art_quick_get32_static; |
| 167 | qpoints->pGet64Static = art_quick_get64_static; |
| 168 | qpoints->pGetObjStatic = art_quick_get_obj_static; |
| 169 | |
| 170 | // Array |
| 171 | qpoints->pAputObjectWithNullAndBoundCheck = art_quick_aput_obj_with_null_and_bound_check; |
| 172 | qpoints->pAputObjectWithBoundCheck = art_quick_aput_obj_with_bound_check; |
| 173 | qpoints->pAputObject = art_quick_aput_obj; |
| 174 | qpoints->pHandleFillArrayData = art_quick_handle_fill_data; |
| 175 | |
| 176 | // JNI |
| 177 | qpoints->pJniMethodStart = JniMethodStart; |
| 178 | qpoints->pJniMethodStartSynchronized = JniMethodStartSynchronized; |
| 179 | qpoints->pJniMethodEnd = JniMethodEnd; |
| 180 | qpoints->pJniMethodEndSynchronized = JniMethodEndSynchronized; |
| 181 | qpoints->pJniMethodEndWithReference = JniMethodEndWithReference; |
| 182 | qpoints->pJniMethodEndWithReferenceSynchronized = JniMethodEndWithReferenceSynchronized; |
| 183 | qpoints->pQuickGenericJniTrampoline = art_quick_generic_jni_trampoline; |
| 184 | |
| 185 | // Locks |
| 186 | qpoints->pLockObject = art_quick_lock_object; |
| 187 | qpoints->pUnlockObject = art_quick_unlock_object; |
| 188 | |
| 189 | // Math |
Zheng Xu | 0210d11 | 2014-06-17 12:25:48 +0800 | [diff] [blame] | 190 | // TODO nullptr entrypoints not needed for ARM64 - generate inline. |
| 191 | qpoints->pCmpgDouble = nullptr; |
| 192 | qpoints->pCmpgFloat = nullptr; |
| 193 | qpoints->pCmplDouble = nullptr; |
| 194 | qpoints->pCmplFloat = nullptr; |
| 195 | qpoints->pFmod = art_quick_fmod; |
| 196 | qpoints->pL2d = nullptr; |
| 197 | qpoints->pFmodf = art_quick_fmodf; |
| 198 | qpoints->pL2f = nullptr; |
| 199 | qpoints->pD2iz = nullptr; |
| 200 | qpoints->pF2iz = nullptr; |
| 201 | qpoints->pIdivmod = nullptr; |
| 202 | qpoints->pD2l = nullptr; |
| 203 | qpoints->pF2l = nullptr; |
| 204 | qpoints->pLdiv = nullptr; |
| 205 | qpoints->pLmod = nullptr; |
| 206 | qpoints->pLmul = nullptr; |
| 207 | qpoints->pShlLong = nullptr; |
| 208 | qpoints->pShrLong = nullptr; |
| 209 | qpoints->pUshrLong = nullptr; |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 210 | |
| 211 | // Intrinsics |
| 212 | qpoints->pIndexOf = art_quick_indexof; |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 213 | qpoints->pStringCompareTo = art_quick_string_compareto; |
Zheng Xu | 0210d11 | 2014-06-17 12:25:48 +0800 | [diff] [blame] | 214 | qpoints->pMemcpy = art_quick_memcpy; |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 215 | |
| 216 | // Invocation |
| 217 | qpoints->pQuickImtConflictTrampoline = art_quick_imt_conflict_trampoline; |
| 218 | qpoints->pQuickResolutionTrampoline = art_quick_resolution_trampoline; |
| 219 | qpoints->pQuickToInterpreterBridge = art_quick_to_interpreter_bridge; |
| 220 | qpoints->pInvokeDirectTrampolineWithAccessCheck = art_quick_invoke_direct_trampoline_with_access_check; |
| 221 | qpoints->pInvokeInterfaceTrampolineWithAccessCheck = art_quick_invoke_interface_trampoline_with_access_check; |
| 222 | qpoints->pInvokeStaticTrampolineWithAccessCheck = art_quick_invoke_static_trampoline_with_access_check; |
| 223 | qpoints->pInvokeSuperTrampolineWithAccessCheck = art_quick_invoke_super_trampoline_with_access_check; |
| 224 | qpoints->pInvokeVirtualTrampolineWithAccessCheck = art_quick_invoke_virtual_trampoline_with_access_check; |
| 225 | |
| 226 | // Thread |
Stuart Monteith | b95a534 | 2014-03-12 13:32:32 +0000 | [diff] [blame] | 227 | qpoints->pTestSuspend = art_quick_test_suspend; |
| 228 | |
| 229 | // Throws |
| 230 | qpoints->pDeliverException = art_quick_deliver_exception; |
| 231 | qpoints->pThrowArrayBounds = art_quick_throw_array_bounds; |
| 232 | qpoints->pThrowDivZero = art_quick_throw_div_zero; |
| 233 | qpoints->pThrowNoSuchMethod = art_quick_throw_no_such_method; |
| 234 | qpoints->pThrowNullPointer = art_quick_throw_null_pointer_exception; |
| 235 | qpoints->pThrowStackOverflow = art_quick_throw_stack_overflow; |
| 236 | }; |
| 237 | |
| 238 | } // namespace art |