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"
18 #include "entrypoints/jni/jni_entrypoints.h"
19 #include "entrypoints/quick/quick_alloc_entrypoints.h"
20 #include "entrypoints/quick/quick_default_externs.h"
21 #include "entrypoints/quick/quick_entrypoints.h"
22 #include "entrypoints/entrypoint_utils.h"
23 #include "entrypoints/math_entrypoints.h"
24 #include "entrypoints/runtime_asm_entrypoints.h"
25 #include "interpreter/interpreter.h"
26
27 namespace art {
28
29 // Cast entrypoints.
30 extern "C" uint32_t art_quick_assignable_from_code(const mirror::Class* klass,
31 const mirror::Class* ref_class);
32
33 // Single-precision FP arithmetics.
34 extern "C" float art_quick_fmodf(float a, float b); // REM_FLOAT[_2ADDR]
35
36 // Double-precision FP arithmetics.
37 extern "C" double art_quick_fmod(double a, double b); // REM_DOUBLE[_2ADDR]
38
39
InitEntryPoints(InterpreterEntryPoints * ipoints,JniEntryPoints * jpoints,QuickEntryPoints * qpoints)40 void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints,
41 QuickEntryPoints* qpoints) {
42 // Interpreter
43 ipoints->pInterpreterToInterpreterBridge = artInterpreterToInterpreterBridge;
44 ipoints->pInterpreterToCompiledCodeBridge = artInterpreterToCompiledCodeBridge;
45
46 // JNI
47 jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub;
48
49 // Alloc
50 ResetQuickAllocEntryPoints(qpoints);
51
52 // Cast
53 qpoints->pInstanceofNonTrivial = art_quick_assignable_from_code;
54 qpoints->pCheckCast = art_quick_check_cast;
55
56 // DexCache
57 qpoints->pInitializeStaticStorage = art_quick_initialize_static_storage;
58 qpoints->pInitializeTypeAndVerifyAccess = art_quick_initialize_type_and_verify_access;
59 qpoints->pInitializeType = art_quick_initialize_type;
60 qpoints->pResolveString = art_quick_resolve_string;
61
62 // Field
63 qpoints->pSet8Instance = art_quick_set8_instance;
64 qpoints->pSet8Static = art_quick_set8_static;
65 qpoints->pSet16Instance = art_quick_set16_instance;
66 qpoints->pSet16Static = art_quick_set16_static;
67 qpoints->pSet32Instance = art_quick_set32_instance;
68 qpoints->pSet32Static = art_quick_set32_static;
69 qpoints->pSet64Instance = art_quick_set64_instance;
70 qpoints->pSet64Static = art_quick_set64_static;
71 qpoints->pSetObjInstance = art_quick_set_obj_instance;
72 qpoints->pSetObjStatic = art_quick_set_obj_static;
73 qpoints->pGetBooleanInstance = art_quick_get_boolean_instance;
74 qpoints->pGetByteInstance = art_quick_get_byte_instance;
75 qpoints->pGetCharInstance = art_quick_get_char_instance;
76 qpoints->pGetShortInstance = art_quick_get_short_instance;
77 qpoints->pGet32Instance = art_quick_get32_instance;
78 qpoints->pGet64Instance = art_quick_get64_instance;
79 qpoints->pGetObjInstance = art_quick_get_obj_instance;
80 qpoints->pGetBooleanStatic = art_quick_get_boolean_static;
81 qpoints->pGetByteStatic = art_quick_get_byte_static;
82 qpoints->pGetCharStatic = art_quick_get_char_static;
83 qpoints->pGetShortStatic = art_quick_get_short_static;
84 qpoints->pGet32Static = art_quick_get32_static;
85 qpoints->pGet64Static = art_quick_get64_static;
86 qpoints->pGetObjStatic = art_quick_get_obj_static;
87
88 // Array
89 qpoints->pAputObjectWithNullAndBoundCheck = art_quick_aput_obj_with_null_and_bound_check;
90 qpoints->pAputObjectWithBoundCheck = art_quick_aput_obj_with_bound_check;
91 qpoints->pAputObject = art_quick_aput_obj;
92 qpoints->pHandleFillArrayData = art_quick_handle_fill_data;
93
94 // JNI
95 qpoints->pJniMethodStart = JniMethodStart;
96 qpoints->pJniMethodStartSynchronized = JniMethodStartSynchronized;
97 qpoints->pJniMethodEnd = JniMethodEnd;
98 qpoints->pJniMethodEndSynchronized = JniMethodEndSynchronized;
99 qpoints->pJniMethodEndWithReference = JniMethodEndWithReference;
100 qpoints->pJniMethodEndWithReferenceSynchronized = JniMethodEndWithReferenceSynchronized;
101 qpoints->pQuickGenericJniTrampoline = art_quick_generic_jni_trampoline;
102
103 // Locks
104 qpoints->pLockObject = art_quick_lock_object;
105 qpoints->pUnlockObject = art_quick_unlock_object;
106
107 // Math
108 // TODO null entrypoints not needed for ARM64 - generate inline.
109 qpoints->pCmpgDouble = nullptr;
110 qpoints->pCmpgFloat = nullptr;
111 qpoints->pCmplDouble = nullptr;
112 qpoints->pCmplFloat = nullptr;
113 qpoints->pFmod = art_quick_fmod;
114 qpoints->pL2d = nullptr;
115 qpoints->pFmodf = art_quick_fmodf;
116 qpoints->pL2f = nullptr;
117 qpoints->pD2iz = nullptr;
118 qpoints->pF2iz = nullptr;
119 qpoints->pIdivmod = nullptr;
120 qpoints->pD2l = nullptr;
121 qpoints->pF2l = nullptr;
122 qpoints->pLdiv = nullptr;
123 qpoints->pLmod = nullptr;
124 qpoints->pLmul = nullptr;
125 qpoints->pShlLong = nullptr;
126 qpoints->pShrLong = nullptr;
127 qpoints->pUshrLong = nullptr;
128
129 // Intrinsics
130 qpoints->pIndexOf = art_quick_indexof;
131 qpoints->pStringCompareTo = art_quick_string_compareto;
132 qpoints->pMemcpy = art_quick_memcpy;
133
134 // Invocation
135 qpoints->pQuickImtConflictTrampoline = art_quick_imt_conflict_trampoline;
136 qpoints->pQuickResolutionTrampoline = art_quick_resolution_trampoline;
137 qpoints->pQuickToInterpreterBridge = art_quick_to_interpreter_bridge;
138 qpoints->pInvokeDirectTrampolineWithAccessCheck =
139 art_quick_invoke_direct_trampoline_with_access_check;
140 qpoints->pInvokeInterfaceTrampolineWithAccessCheck =
141 art_quick_invoke_interface_trampoline_with_access_check;
142 qpoints->pInvokeStaticTrampolineWithAccessCheck =
143 art_quick_invoke_static_trampoline_with_access_check;
144 qpoints->pInvokeSuperTrampolineWithAccessCheck =
145 art_quick_invoke_super_trampoline_with_access_check;
146 qpoints->pInvokeVirtualTrampolineWithAccessCheck =
147 art_quick_invoke_virtual_trampoline_with_access_check;
148
149 // Thread
150 qpoints->pTestSuspend = art_quick_test_suspend;
151
152 // Throws
153 qpoints->pDeliverException = art_quick_deliver_exception;
154 qpoints->pThrowArrayBounds = art_quick_throw_array_bounds;
155 qpoints->pThrowDivZero = art_quick_throw_div_zero;
156 qpoints->pThrowNoSuchMethod = art_quick_throw_no_such_method;
157 qpoints->pThrowNullPointer = art_quick_throw_null_pointer_exception;
158 qpoints->pThrowStackOverflow = art_quick_throw_stack_overflow;
159
160 // Deoptimize
161 qpoints->pDeoptimize = art_quick_deoptimize;
162
163 // Read barrier
164 qpoints->pReadBarrierJni = ReadBarrierJni;
165 };
166
167 } // namespace art
168