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