blob: 204d52c723e839b88a076971fbe21b4fb253a0ac [file] [log] [blame]
Ian Rogersef7d42f2014-01-06 12:55:46 -08001/*
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 Chartierd8891782014-03-02 13:28:37 -080018#include "entrypoints/quick/quick_alloc_entrypoints.h"
Ian Rogersef7d42f2014-01-06 12:55:46 -080019#include "entrypoints/quick/quick_entrypoints.h"
20#include "entrypoints/entrypoint_utils.h"
Alexei Zavjalov1d4d7bd2014-05-23 17:51:59 +070021#include "entrypoints/math_entrypoints.h"
Ian Rogersef7d42f2014-01-06 12:55:46 -080022
23namespace art {
24
25// Interpreter entrypoints.
26extern "C" void artInterpreterToInterpreterBridge(Thread* self, MethodHelper& mh,
27 const DexFile::CodeItem* code_item,
28 ShadowFrame* shadow_frame, JValue* result);
29extern "C" void artInterpreterToCompiledCodeBridge(Thread* self, MethodHelper& mh,
30 const DexFile::CodeItem* code_item,
31 ShadowFrame* shadow_frame, JValue* result);
32
33// Portable entrypoints.
34extern "C" void art_portable_resolution_trampoline(mirror::ArtMethod*);
35extern "C" void art_portable_to_interpreter_bridge(mirror::ArtMethod*);
36
37// Cast entrypoints.
Serguei Katkovc3801912014-07-08 17:21:53 +070038extern "C" uint32_t art_quick_assignable_from_code(const mirror::Class* klass,
Alexei Zavjalov1d4d7bd2014-05-23 17:51:59 +070039 const mirror::Class* ref_class);
Ian Rogersef7d42f2014-01-06 12:55:46 -080040extern "C" void art_quick_check_cast(void*, void*);
41
42// DexCache entrypoints.
43extern "C" void* art_quick_initialize_static_storage(uint32_t, void*);
44extern "C" void* art_quick_initialize_type(uint32_t, void*);
45extern "C" void* art_quick_initialize_type_and_verify_access(uint32_t, void*);
46extern "C" void* art_quick_resolve_string(void*, uint32_t);
47
48// Field entrypoints.
49extern "C" int art_quick_set32_instance(uint32_t, void*, int32_t);
50extern "C" int art_quick_set32_static(uint32_t, int32_t);
51extern "C" int art_quick_set64_instance(uint32_t, void*, int64_t);
52extern "C" int art_quick_set64_static(uint32_t, int64_t);
53extern "C" int art_quick_set_obj_instance(uint32_t, void*, void*);
54extern "C" int art_quick_set_obj_static(uint32_t, void*);
55extern "C" int32_t art_quick_get32_instance(uint32_t, void*);
56extern "C" int32_t art_quick_get32_static(uint32_t);
57extern "C" int64_t art_quick_get64_instance(uint32_t, void*);
58extern "C" int64_t art_quick_get64_static(uint32_t);
59extern "C" void* art_quick_get_obj_instance(uint32_t, void*);
60extern "C" void* art_quick_get_obj_static(uint32_t);
61
62// Array entrypoints.
63extern "C" void art_quick_aput_obj_with_null_and_bound_check(void*, uint32_t, void*);
64extern "C" void art_quick_aput_obj_with_bound_check(void*, uint32_t, void*);
65extern "C" void art_quick_aput_obj(void*, uint32_t, void*);
66extern "C" void art_quick_handle_fill_data(void*, void*);
67
68// Lock entrypoints.
69extern "C" void art_quick_lock_object(void*);
70extern "C" void art_quick_unlock_object(void*);
71
72// Math entrypoints.
Ian Rogersef7d42f2014-01-06 12:55:46 -080073extern "C" int64_t art_quick_d2l(double);
74extern "C" int64_t art_quick_f2l(float);
Ian Rogersef7d42f2014-01-06 12:55:46 -080075extern "C" int64_t art_quick_ldiv(int64_t, int64_t);
76extern "C" int64_t art_quick_lmod(int64_t, int64_t);
77extern "C" int64_t art_quick_lmul(int64_t, int64_t);
78extern "C" uint64_t art_quick_lshl(uint64_t, uint32_t);
79extern "C" uint64_t art_quick_lshr(uint64_t, uint32_t);
80extern "C" uint64_t art_quick_lushr(uint64_t, uint32_t);
81
82// Intrinsic entrypoints.
Ian Rogersef7d42f2014-01-06 12:55:46 -080083extern "C" int32_t art_quick_string_compareto(void*, void*);
84extern "C" void* art_quick_memcpy(void*, const void*, size_t);
85
86// Invoke entrypoints.
87extern "C" void art_quick_imt_conflict_trampoline(mirror::ArtMethod*);
88extern "C" void art_quick_resolution_trampoline(mirror::ArtMethod*);
89extern "C" void art_quick_to_interpreter_bridge(mirror::ArtMethod*);
90extern "C" void art_quick_invoke_direct_trampoline_with_access_check(uint32_t, void*);
91extern "C" void art_quick_invoke_interface_trampoline_with_access_check(uint32_t, void*);
92extern "C" void art_quick_invoke_static_trampoline_with_access_check(uint32_t, void*);
93extern "C" void art_quick_invoke_super_trampoline_with_access_check(uint32_t, void*);
94extern "C" void art_quick_invoke_virtual_trampoline_with_access_check(uint32_t, void*);
95
96// Thread entrypoints.
Ian Rogersef7d42f2014-01-06 12:55:46 -080097extern "C" void art_quick_test_suspend();
98
99// Throw entrypoints.
100extern "C" void art_quick_deliver_exception(void*);
101extern "C" void art_quick_throw_array_bounds(int32_t index, int32_t limit);
102extern "C" void art_quick_throw_div_zero();
103extern "C" void art_quick_throw_no_such_method(int32_t method_idx);
104extern "C" void art_quick_throw_null_pointer_exception();
105extern "C" void art_quick_throw_stack_overflow(void*);
106
Andreas Gampe2da88232014-02-27 12:26:20 -0800107// Generic JNI entrypoint
108extern "C" void art_quick_generic_jni_trampoline(mirror::ArtMethod*);
109
Ian Rogersef7d42f2014-01-06 12:55:46 -0800110extern void ResetQuickAllocEntryPoints(QuickEntryPoints* qpoints);
111
112void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints,
113 PortableEntryPoints* ppoints, QuickEntryPoints* qpoints) {
Ian Rogersc3ccc102014-06-25 11:52:14 -0700114#if defined(__APPLE__)
115 UNIMPLEMENTED(FATAL);
116#else
Ian Rogersef7d42f2014-01-06 12:55:46 -0800117 // 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
Serguei Katkovc3801912014-07-08 17:21:53 +0700132 qpoints->pInstanceofNonTrivial = art_quick_assignable_from_code;
Ian Rogersef7d42f2014-01-06 12:55:46 -0800133 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 Gampe2da88232014-02-27 12:26:20 -0800168 qpoints->pQuickGenericJniTrampoline = art_quick_generic_jni_trampoline;
Ian Rogersef7d42f2014-01-06 12:55:46 -0800169
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 Zavjalovbd3682e2014-06-12 03:08:01 +0700179 // qpoints->pFmod = NULL; // Not needed on x86.
Alexei Zavjalov1d4d7bd2014-05-23 17:51:59 +0700180 // qpoints->pL2d = NULL; // Not needed on x86.
Alexei Zavjalovbd3682e2014-06-12 03:08:01 +0700181 // qpoints->pFmodf = NULL; // Not needed on x86.
Alexei Zavjalov1d4d7bd2014-05-23 17:51:59 +0700182 // qpoints->pL2f = NULL; // Not needed on x86.
Ian Rogersef7d42f2014-01-06 12:55:46 -0800183 // points->pD2iz = NULL; // Not needed on x86.
184 // points->pF2iz = NULL; // Not needed on x86.
Alexei Zavjalov1d4d7bd2014-05-23 17:51:59 +0700185 // qpoints->pIdivmod = NULL; // Not needed on x86.
186 qpoints->pD2l = art_d2l;
187 qpoints->pF2l = art_f2l;
Ian Rogersef7d42f2014-01-06 12:55:46 -0800188 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 Zavjalov1d4d7bd2014-05-23 17:51:59 +0700196 // qpoints->pIndexOf = NULL; // Not needed on x86.
Ian Rogersef7d42f2014-01-06 12:55:46 -0800197 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 Rogersef7d42f2014-01-06 12:55:46 -0800211 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 Rogersc3ccc102014-06-25 11:52:14 -0700220#endif // __APPLE__
Ian Rogersef7d42f2014-01-06 12:55:46 -0800221};
222
223} // namespace art