Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [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 | |
| 17 | #include "entrypoints/portable/portable_entrypoints.h" |
Mathieu Chartier | d889178 | 2014-03-02 13:28:37 -0800 | [diff] [blame] | 18 | #include "entrypoints/quick/quick_alloc_entrypoints.h" |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 19 | #include "entrypoints/quick/quick_entrypoints.h" |
| 20 | #include "entrypoints/entrypoint_utils.h" |
Alexei Zavjalov | 1d4d7bd | 2014-05-23 17:51:59 +0700 | [diff] [blame] | 21 | #include "entrypoints/math_entrypoints.h" |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 22 | |
| 23 | namespace art { |
| 24 | |
| 25 | // Interpreter entrypoints. |
| 26 | extern "C" void artInterpreterToInterpreterBridge(Thread* self, MethodHelper& mh, |
| 27 | const DexFile::CodeItem* code_item, |
| 28 | ShadowFrame* shadow_frame, JValue* result); |
| 29 | extern "C" void artInterpreterToCompiledCodeBridge(Thread* self, MethodHelper& mh, |
| 30 | const DexFile::CodeItem* code_item, |
| 31 | ShadowFrame* shadow_frame, JValue* result); |
| 32 | |
| 33 | // Portable entrypoints. |
| 34 | extern "C" void art_portable_resolution_trampoline(mirror::ArtMethod*); |
| 35 | extern "C" void art_portable_to_interpreter_bridge(mirror::ArtMethod*); |
| 36 | |
| 37 | // Cast entrypoints. |
Alexei Zavjalov | 1d4d7bd | 2014-05-23 17:51:59 +0700 | [diff] [blame] | 38 | extern "C" uint32_t artIsAssignableFromCode(const mirror::Class* klass, |
| 39 | const mirror::Class* ref_class); |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 40 | extern "C" void art_quick_check_cast(void*, void*); |
| 41 | |
| 42 | // DexCache entrypoints. |
| 43 | extern "C" void* art_quick_initialize_static_storage(uint32_t, void*); |
| 44 | extern "C" void* art_quick_initialize_type(uint32_t, void*); |
| 45 | extern "C" void* art_quick_initialize_type_and_verify_access(uint32_t, void*); |
| 46 | extern "C" void* art_quick_resolve_string(void*, uint32_t); |
| 47 | |
| 48 | // Field entrypoints. |
| 49 | extern "C" int art_quick_set32_instance(uint32_t, void*, int32_t); |
| 50 | extern "C" int art_quick_set32_static(uint32_t, int32_t); |
| 51 | extern "C" int art_quick_set64_instance(uint32_t, void*, int64_t); |
| 52 | extern "C" int art_quick_set64_static(uint32_t, int64_t); |
| 53 | extern "C" int art_quick_set_obj_instance(uint32_t, void*, void*); |
| 54 | extern "C" int art_quick_set_obj_static(uint32_t, void*); |
| 55 | extern "C" int32_t art_quick_get32_instance(uint32_t, void*); |
| 56 | extern "C" int32_t art_quick_get32_static(uint32_t); |
| 57 | extern "C" int64_t art_quick_get64_instance(uint32_t, void*); |
| 58 | extern "C" int64_t art_quick_get64_static(uint32_t); |
| 59 | extern "C" void* art_quick_get_obj_instance(uint32_t, void*); |
| 60 | extern "C" void* art_quick_get_obj_static(uint32_t); |
| 61 | |
| 62 | // Array entrypoints. |
| 63 | extern "C" void art_quick_aput_obj_with_null_and_bound_check(void*, uint32_t, void*); |
| 64 | extern "C" void art_quick_aput_obj_with_bound_check(void*, uint32_t, void*); |
| 65 | extern "C" void art_quick_aput_obj(void*, uint32_t, void*); |
| 66 | extern "C" void art_quick_handle_fill_data(void*, void*); |
| 67 | |
| 68 | // Lock entrypoints. |
| 69 | extern "C" void art_quick_lock_object(void*); |
| 70 | extern "C" void art_quick_unlock_object(void*); |
| 71 | |
| 72 | // Math entrypoints. |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 73 | extern "C" int64_t art_quick_d2l(double); |
| 74 | extern "C" int64_t art_quick_f2l(float); |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 75 | extern "C" int64_t art_quick_ldiv(int64_t, int64_t); |
| 76 | extern "C" int64_t art_quick_lmod(int64_t, int64_t); |
| 77 | extern "C" int64_t art_quick_lmul(int64_t, int64_t); |
| 78 | extern "C" uint64_t art_quick_lshl(uint64_t, uint32_t); |
| 79 | extern "C" uint64_t art_quick_lshr(uint64_t, uint32_t); |
| 80 | extern "C" uint64_t art_quick_lushr(uint64_t, uint32_t); |
| 81 | |
| 82 | // Intrinsic entrypoints. |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 83 | extern "C" int32_t art_quick_string_compareto(void*, void*); |
| 84 | extern "C" void* art_quick_memcpy(void*, const void*, size_t); |
| 85 | |
| 86 | // Invoke entrypoints. |
| 87 | extern "C" void art_quick_imt_conflict_trampoline(mirror::ArtMethod*); |
| 88 | extern "C" void art_quick_resolution_trampoline(mirror::ArtMethod*); |
| 89 | extern "C" void art_quick_to_interpreter_bridge(mirror::ArtMethod*); |
| 90 | extern "C" void art_quick_invoke_direct_trampoline_with_access_check(uint32_t, void*); |
| 91 | extern "C" void art_quick_invoke_interface_trampoline_with_access_check(uint32_t, void*); |
| 92 | extern "C" void art_quick_invoke_static_trampoline_with_access_check(uint32_t, void*); |
| 93 | extern "C" void art_quick_invoke_super_trampoline_with_access_check(uint32_t, void*); |
| 94 | extern "C" void art_quick_invoke_virtual_trampoline_with_access_check(uint32_t, void*); |
| 95 | |
| 96 | // Thread entrypoints. |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 97 | extern "C" void art_quick_test_suspend(); |
| 98 | |
| 99 | // Throw entrypoints. |
| 100 | extern "C" void art_quick_deliver_exception(void*); |
| 101 | extern "C" void art_quick_throw_array_bounds(int32_t index, int32_t limit); |
| 102 | extern "C" void art_quick_throw_div_zero(); |
| 103 | extern "C" void art_quick_throw_no_such_method(int32_t method_idx); |
| 104 | extern "C" void art_quick_throw_null_pointer_exception(); |
| 105 | extern "C" void art_quick_throw_stack_overflow(void*); |
| 106 | |
Andreas Gampe | 2da8823 | 2014-02-27 12:26:20 -0800 | [diff] [blame] | 107 | // Generic JNI entrypoint |
| 108 | extern "C" void art_quick_generic_jni_trampoline(mirror::ArtMethod*); |
| 109 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 110 | extern void ResetQuickAllocEntryPoints(QuickEntryPoints* qpoints); |
| 111 | |
| 112 | void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints, |
| 113 | PortableEntryPoints* ppoints, QuickEntryPoints* qpoints) { |
Ian Rogers | c3ccc10 | 2014-06-25 11:52:14 -0700 | [diff] [blame] | 114 | #if defined(__APPLE__) |
| 115 | UNIMPLEMENTED(FATAL); |
| 116 | #else |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 117 | // Interpreter |
| 118 | ipoints->pInterpreterToInterpreterBridge = artInterpreterToInterpreterBridge; |
| 119 | ipoints->pInterpreterToCompiledCodeBridge = artInterpreterToCompiledCodeBridge; |
| 120 | |
| 121 | // JNI |
| 122 | jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub; |
| 123 | |
| 124 | // Portable |
| 125 | ppoints->pPortableResolutionTrampoline = art_portable_resolution_trampoline; |
| 126 | ppoints->pPortableToInterpreterBridge = art_portable_to_interpreter_bridge; |
| 127 | |
| 128 | // Alloc |
| 129 | ResetQuickAllocEntryPoints(qpoints); |
| 130 | |
| 131 | // Cast |
Alexei Zavjalov | 1d4d7bd | 2014-05-23 17:51:59 +0700 | [diff] [blame] | 132 | qpoints->pInstanceofNonTrivial = artIsAssignableFromCode; |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 133 | qpoints->pCheckCast = art_quick_check_cast; |
| 134 | |
| 135 | // DexCache |
| 136 | qpoints->pInitializeStaticStorage = art_quick_initialize_static_storage; |
| 137 | qpoints->pInitializeTypeAndVerifyAccess = art_quick_initialize_type_and_verify_access; |
| 138 | qpoints->pInitializeType = art_quick_initialize_type; |
| 139 | qpoints->pResolveString = art_quick_resolve_string; |
| 140 | |
| 141 | // Field |
| 142 | qpoints->pSet32Instance = art_quick_set32_instance; |
| 143 | qpoints->pSet32Static = art_quick_set32_static; |
| 144 | qpoints->pSet64Instance = art_quick_set64_instance; |
| 145 | qpoints->pSet64Static = art_quick_set64_static; |
| 146 | qpoints->pSetObjInstance = art_quick_set_obj_instance; |
| 147 | qpoints->pSetObjStatic = art_quick_set_obj_static; |
| 148 | qpoints->pGet32Instance = art_quick_get32_instance; |
| 149 | qpoints->pGet64Instance = art_quick_get64_instance; |
| 150 | qpoints->pGetObjInstance = art_quick_get_obj_instance; |
| 151 | qpoints->pGet32Static = art_quick_get32_static; |
| 152 | qpoints->pGet64Static = art_quick_get64_static; |
| 153 | qpoints->pGetObjStatic = art_quick_get_obj_static; |
| 154 | |
| 155 | // Array |
| 156 | qpoints->pAputObjectWithNullAndBoundCheck = art_quick_aput_obj_with_null_and_bound_check; |
| 157 | qpoints->pAputObjectWithBoundCheck = art_quick_aput_obj_with_bound_check; |
| 158 | qpoints->pAputObject = art_quick_aput_obj; |
| 159 | qpoints->pHandleFillArrayData = art_quick_handle_fill_data; |
| 160 | |
| 161 | // JNI |
| 162 | qpoints->pJniMethodStart = JniMethodStart; |
| 163 | qpoints->pJniMethodStartSynchronized = JniMethodStartSynchronized; |
| 164 | qpoints->pJniMethodEnd = JniMethodEnd; |
| 165 | qpoints->pJniMethodEndSynchronized = JniMethodEndSynchronized; |
| 166 | qpoints->pJniMethodEndWithReference = JniMethodEndWithReference; |
| 167 | qpoints->pJniMethodEndWithReferenceSynchronized = JniMethodEndWithReferenceSynchronized; |
Andreas Gampe | 2da8823 | 2014-02-27 12:26:20 -0800 | [diff] [blame] | 168 | qpoints->pQuickGenericJniTrampoline = art_quick_generic_jni_trampoline; |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 169 | |
| 170 | // Locks |
| 171 | qpoints->pLockObject = art_quick_lock_object; |
| 172 | qpoints->pUnlockObject = art_quick_unlock_object; |
| 173 | |
| 174 | // Math |
| 175 | // points->pCmpgDouble = NULL; // Not needed on x86. |
| 176 | // points->pCmpgFloat = NULL; // Not needed on x86. |
| 177 | // points->pCmplDouble = NULL; // Not needed on x86. |
| 178 | // points->pCmplFloat = NULL; // Not needed on x86. |
Alexei Zavjalov | bd3682e | 2014-06-12 03:08:01 +0700 | [diff] [blame] | 179 | // qpoints->pFmod = NULL; // Not needed on x86. |
Alexei Zavjalov | 1d4d7bd | 2014-05-23 17:51:59 +0700 | [diff] [blame] | 180 | // qpoints->pL2d = NULL; // Not needed on x86. |
Alexei Zavjalov | bd3682e | 2014-06-12 03:08:01 +0700 | [diff] [blame] | 181 | // qpoints->pFmodf = NULL; // Not needed on x86. |
Alexei Zavjalov | 1d4d7bd | 2014-05-23 17:51:59 +0700 | [diff] [blame] | 182 | // qpoints->pL2f = NULL; // Not needed on x86. |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 183 | // points->pD2iz = NULL; // Not needed on x86. |
| 184 | // points->pF2iz = NULL; // Not needed on x86. |
Alexei Zavjalov | 1d4d7bd | 2014-05-23 17:51:59 +0700 | [diff] [blame] | 185 | // qpoints->pIdivmod = NULL; // Not needed on x86. |
| 186 | qpoints->pD2l = art_d2l; |
| 187 | qpoints->pF2l = art_f2l; |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 188 | qpoints->pLdiv = art_quick_ldiv; |
| 189 | qpoints->pLmod = art_quick_lmod; |
| 190 | qpoints->pLmul = art_quick_lmul; |
| 191 | qpoints->pShlLong = art_quick_lshl; |
| 192 | qpoints->pShrLong = art_quick_lshr; |
| 193 | qpoints->pUshrLong = art_quick_lushr; |
| 194 | |
| 195 | // Intrinsics |
Alexei Zavjalov | 1d4d7bd | 2014-05-23 17:51:59 +0700 | [diff] [blame] | 196 | // qpoints->pIndexOf = NULL; // Not needed on x86. |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 197 | qpoints->pStringCompareTo = art_quick_string_compareto; |
| 198 | qpoints->pMemcpy = art_quick_memcpy; |
| 199 | |
| 200 | // Invocation |
| 201 | qpoints->pQuickImtConflictTrampoline = art_quick_imt_conflict_trampoline; |
| 202 | qpoints->pQuickResolutionTrampoline = art_quick_resolution_trampoline; |
| 203 | qpoints->pQuickToInterpreterBridge = art_quick_to_interpreter_bridge; |
| 204 | qpoints->pInvokeDirectTrampolineWithAccessCheck = art_quick_invoke_direct_trampoline_with_access_check; |
| 205 | qpoints->pInvokeInterfaceTrampolineWithAccessCheck = art_quick_invoke_interface_trampoline_with_access_check; |
| 206 | qpoints->pInvokeStaticTrampolineWithAccessCheck = art_quick_invoke_static_trampoline_with_access_check; |
| 207 | qpoints->pInvokeSuperTrampolineWithAccessCheck = art_quick_invoke_super_trampoline_with_access_check; |
| 208 | qpoints->pInvokeVirtualTrampolineWithAccessCheck = art_quick_invoke_virtual_trampoline_with_access_check; |
| 209 | |
| 210 | // Thread |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 211 | qpoints->pTestSuspend = art_quick_test_suspend; |
| 212 | |
| 213 | // Throws |
| 214 | qpoints->pDeliverException = art_quick_deliver_exception; |
| 215 | qpoints->pThrowArrayBounds = art_quick_throw_array_bounds; |
| 216 | qpoints->pThrowDivZero = art_quick_throw_div_zero; |
| 217 | qpoints->pThrowNoSuchMethod = art_quick_throw_no_such_method; |
| 218 | qpoints->pThrowNullPointer = art_quick_throw_null_pointer_exception; |
| 219 | qpoints->pThrowStackOverflow = art_quick_throw_stack_overflow; |
Ian Rogers | c3ccc10 | 2014-06-25 11:52:14 -0700 | [diff] [blame] | 220 | #endif // __APPLE__ |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 221 | }; |
| 222 | |
| 223 | } // namespace art |