blob: e86aa1c16d6f4f85f15f3418a634f81d65a6efc4 [file] [log] [blame]
Ian Rogers7655f292013-07-29 11:07:13 -07001/*
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
Ian Rogers6f3dbba2014-10-14 17:41:57 -070017#include "atomic.h"
Mingyao Yang98d1cc82014-05-15 17:02:16 -070018#include "entrypoints/interpreter/interpreter_entrypoints.h"
19#include "entrypoints/jni/jni_entrypoints.h"
Ian Rogers7655f292013-07-29 11:07:13 -070020#include "entrypoints/portable/portable_entrypoints.h"
Mathieu Chartierd8891782014-03-02 13:28:37 -080021#include "entrypoints/quick/quick_alloc_entrypoints.h"
Andreas Gampee1794562014-11-04 22:26:32 -080022#include "entrypoints/quick/quick_default_externs.h"
Ian Rogers7655f292013-07-29 11:07:13 -070023#include "entrypoints/quick/quick_entrypoints.h"
24#include "entrypoints/entrypoint_utils.h"
25#include "entrypoints/math_entrypoints.h"
Ian Rogers6f3dbba2014-10-14 17:41:57 -070026#include "entrypoints/runtime_asm_entrypoints.h"
27#include "interpreter/interpreter.h"
Ian Rogers7655f292013-07-29 11:07:13 -070028
29namespace art {
30
Ian Rogers7655f292013-07-29 11:07:13 -070031// Cast entrypoints.
32extern "C" uint32_t artIsAssignableFromCode(const mirror::Class* klass,
33 const mirror::Class* ref_class);
Ian Rogers7655f292013-07-29 11:07:13 -070034
35// Math entrypoints.
36extern int32_t CmpgDouble(double a, double b);
37extern int32_t CmplDouble(double a, double b);
38extern int32_t CmpgFloat(float a, float b);
39extern int32_t CmplFloat(float a, float b);
Ian Rogersa9a82542013-10-04 11:17:26 -070040extern "C" int64_t artLmul(int64_t a, int64_t b);
41extern "C" int64_t artLdiv(int64_t a, int64_t b);
42extern "C" int64_t artLmod(int64_t a, int64_t b);
Ian Rogers7655f292013-07-29 11:07:13 -070043
44// Math conversions.
45extern "C" int32_t __fixsfsi(float op1); // FLOAT_TO_INT
46extern "C" int32_t __fixdfsi(double op1); // DOUBLE_TO_INT
47extern "C" float __floatdisf(int64_t op1); // LONG_TO_FLOAT
48extern "C" double __floatdidf(int64_t op1); // LONG_TO_DOUBLE
49extern "C" int64_t __fixsfdi(float op1); // FLOAT_TO_LONG
50extern "C" int64_t __fixdfdi(double op1); // DOUBLE_TO_LONG
51
52// Single-precision FP arithmetics.
53extern "C" float fmodf(float a, float b); // REM_FLOAT[_2ADDR]
54
55// Double-precision FP arithmetics.
56extern "C" double fmod(double a, double b); // REM_DOUBLE[_2ADDR]
57
58// Long long arithmetics - REM_LONG[_2ADDR] and DIV_LONG[_2ADDR]
59extern "C" int64_t __divdi3(int64_t, int64_t);
60extern "C" int64_t __moddi3(int64_t, int64_t);
Hiroshi Yamauchi3b4c1892013-09-12 21:33:12 -070061
Ian Rogers848871b2013-08-05 10:56:33 -070062void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints,
63 PortableEntryPoints* ppoints, QuickEntryPoints* qpoints) {
64 // Interpreter
65 ipoints->pInterpreterToInterpreterBridge = artInterpreterToInterpreterBridge;
Dragos Sbirlea08bf1962013-08-12 08:53:04 -070066 ipoints->pInterpreterToCompiledCodeBridge = artInterpreterToCompiledCodeBridge;
Ian Rogers848871b2013-08-05 10:56:33 -070067
68 // JNI
69 jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub;
70
71 // Portable
72 ppoints->pPortableResolutionTrampoline = art_portable_resolution_trampoline;
73 ppoints->pPortableToInterpreterBridge = art_portable_to_interpreter_bridge;
74
Ian Rogers7655f292013-07-29 11:07:13 -070075 // Alloc
Hiroshi Yamauchi3b4c1892013-09-12 21:33:12 -070076 ResetQuickAllocEntryPoints(qpoints);
Ian Rogers7655f292013-07-29 11:07:13 -070077
78 // Cast
Ian Rogers848871b2013-08-05 10:56:33 -070079 qpoints->pInstanceofNonTrivial = artIsAssignableFromCode;
Ian Rogers848871b2013-08-05 10:56:33 -070080 qpoints->pCheckCast = art_quick_check_cast;
Ian Rogers7655f292013-07-29 11:07:13 -070081
82 // DexCache
Ian Rogers848871b2013-08-05 10:56:33 -070083 qpoints->pInitializeStaticStorage = art_quick_initialize_static_storage;
84 qpoints->pInitializeTypeAndVerifyAccess = art_quick_initialize_type_and_verify_access;
85 qpoints->pInitializeType = art_quick_initialize_type;
86 qpoints->pResolveString = art_quick_resolve_string;
Ian Rogers7655f292013-07-29 11:07:13 -070087
88 // Field
Fred Shih37f05ef2014-07-16 18:38:08 -070089 qpoints->pSet8Instance = art_quick_set8_instance;
90 qpoints->pSet8Static = art_quick_set8_static;
91 qpoints->pSet16Instance = art_quick_set16_instance;
92 qpoints->pSet16Static = art_quick_set16_static;
Ian Rogers848871b2013-08-05 10:56:33 -070093 qpoints->pSet32Instance = art_quick_set32_instance;
94 qpoints->pSet32Static = art_quick_set32_static;
95 qpoints->pSet64Instance = art_quick_set64_instance;
96 qpoints->pSet64Static = art_quick_set64_static;
97 qpoints->pSetObjInstance = art_quick_set_obj_instance;
98 qpoints->pSetObjStatic = art_quick_set_obj_static;
Fred Shih37f05ef2014-07-16 18:38:08 -070099 qpoints->pGetBooleanInstance = art_quick_get_boolean_instance;
100 qpoints->pGetByteInstance = art_quick_get_byte_instance;
101 qpoints->pGetCharInstance = art_quick_get_char_instance;
102 qpoints->pGetShortInstance = art_quick_get_short_instance;
Ian Rogers848871b2013-08-05 10:56:33 -0700103 qpoints->pGet32Instance = art_quick_get32_instance;
104 qpoints->pGet64Instance = art_quick_get64_instance;
105 qpoints->pGetObjInstance = art_quick_get_obj_instance;
Fred Shih37f05ef2014-07-16 18:38:08 -0700106 qpoints->pGetBooleanStatic = art_quick_get_boolean_static;
107 qpoints->pGetByteStatic = art_quick_get_byte_static;
108 qpoints->pGetCharStatic = art_quick_get_char_static;
109 qpoints->pGetShortStatic = art_quick_get_short_static;
Ian Rogers848871b2013-08-05 10:56:33 -0700110 qpoints->pGet32Static = art_quick_get32_static;
111 qpoints->pGet64Static = art_quick_get64_static;
112 qpoints->pGetObjStatic = art_quick_get_obj_static;
Ian Rogers7655f292013-07-29 11:07:13 -0700113
Ian Rogersa9a82542013-10-04 11:17:26 -0700114 // Array
115 qpoints->pAputObjectWithNullAndBoundCheck = art_quick_aput_obj_with_null_and_bound_check;
116 qpoints->pAputObjectWithBoundCheck = art_quick_aput_obj_with_bound_check;
117 qpoints->pAputObject = art_quick_aput_obj;
Ian Rogers848871b2013-08-05 10:56:33 -0700118 qpoints->pHandleFillArrayData = art_quick_handle_fill_data;
Ian Rogers7655f292013-07-29 11:07:13 -0700119
120 // JNI
121 qpoints->pJniMethodStart = JniMethodStart;
122 qpoints->pJniMethodStartSynchronized = JniMethodStartSynchronized;
123 qpoints->pJniMethodEnd = JniMethodEnd;
124 qpoints->pJniMethodEndSynchronized = JniMethodEndSynchronized;
125 qpoints->pJniMethodEndWithReference = JniMethodEndWithReference;
126 qpoints->pJniMethodEndWithReferenceSynchronized = JniMethodEndWithReferenceSynchronized;
Andreas Gampe2da88232014-02-27 12:26:20 -0800127 qpoints->pQuickGenericJniTrampoline = art_quick_generic_jni_trampoline;
Ian Rogers7655f292013-07-29 11:07:13 -0700128
129 // Locks
Ian Rogers848871b2013-08-05 10:56:33 -0700130 qpoints->pLockObject = art_quick_lock_object;
131 qpoints->pUnlockObject = art_quick_unlock_object;
Ian Rogers7655f292013-07-29 11:07:13 -0700132
133 // Math
134 qpoints->pCmpgDouble = CmpgDouble;
135 qpoints->pCmpgFloat = CmpgFloat;
136 qpoints->pCmplDouble = CmplDouble;
137 qpoints->pCmplFloat = CmplFloat;
138 qpoints->pFmod = fmod;
Douglas Leungd9cb8ae2014-07-09 14:28:35 -0700139 qpoints->pL2d = art_l2d;
Ian Rogers7655f292013-07-29 11:07:13 -0700140 qpoints->pFmodf = fmodf;
Douglas Leungd9cb8ae2014-07-09 14:28:35 -0700141 qpoints->pL2f = art_l2f;
142 qpoints->pD2iz = art_d2i;
143 qpoints->pF2iz = art_f2i;
Ian Rogers7655f292013-07-29 11:07:13 -0700144 qpoints->pIdivmod = NULL;
145 qpoints->pD2l = art_d2l;
146 qpoints->pF2l = art_f2l;
Ian Rogersa9a82542013-10-04 11:17:26 -0700147 qpoints->pLdiv = artLdiv;
148 qpoints->pLmod = artLmod;
149 qpoints->pLmul = artLmul;
Ian Rogers7655f292013-07-29 11:07:13 -0700150 qpoints->pShlLong = art_quick_shl_long;
151 qpoints->pShrLong = art_quick_shr_long;
152 qpoints->pUshrLong = art_quick_ushr_long;
153
Ian Rogers7655f292013-07-29 11:07:13 -0700154 // Intrinsics
155 qpoints->pIndexOf = art_quick_indexof;
Ian Rogers7655f292013-07-29 11:07:13 -0700156 qpoints->pStringCompareTo = art_quick_string_compareto;
157 qpoints->pMemcpy = memcpy;
158
159 // Invocation
Jeff Hao88474b42013-10-23 16:24:40 -0700160 qpoints->pQuickImtConflictTrampoline = art_quick_imt_conflict_trampoline;
Ian Rogers848871b2013-08-05 10:56:33 -0700161 qpoints->pQuickResolutionTrampoline = art_quick_resolution_trampoline;
162 qpoints->pQuickToInterpreterBridge = art_quick_to_interpreter_bridge;
Ian Rogers7655f292013-07-29 11:07:13 -0700163 qpoints->pInvokeDirectTrampolineWithAccessCheck = art_quick_invoke_direct_trampoline_with_access_check;
Ian Rogers7655f292013-07-29 11:07:13 -0700164 qpoints->pInvokeInterfaceTrampolineWithAccessCheck = art_quick_invoke_interface_trampoline_with_access_check;
165 qpoints->pInvokeStaticTrampolineWithAccessCheck = art_quick_invoke_static_trampoline_with_access_check;
166 qpoints->pInvokeSuperTrampolineWithAccessCheck = art_quick_invoke_super_trampoline_with_access_check;
167 qpoints->pInvokeVirtualTrampolineWithAccessCheck = art_quick_invoke_virtual_trampoline_with_access_check;
168
169 // Thread
Ian Rogers848871b2013-08-05 10:56:33 -0700170 qpoints->pTestSuspend = art_quick_test_suspend;
Ian Rogers7655f292013-07-29 11:07:13 -0700171
172 // Throws
Ian Rogers848871b2013-08-05 10:56:33 -0700173 qpoints->pDeliverException = art_quick_deliver_exception;
174 qpoints->pThrowArrayBounds = art_quick_throw_array_bounds;
175 qpoints->pThrowDivZero = art_quick_throw_div_zero;
176 qpoints->pThrowNoSuchMethod = art_quick_throw_no_such_method;
177 qpoints->pThrowNullPointer = art_quick_throw_null_pointer_exception;
178 qpoints->pThrowStackOverflow = art_quick_throw_stack_overflow;
Douglas Leungd9cb8ae2014-07-09 14:28:35 -0700179
180 // Atomic 64-bit load/store
181 qpoints->pA64Load = QuasiAtomic::Read64;
182 qpoints->pA64Store = QuasiAtomic::Write64;
Ian Rogers7655f292013-07-29 11:07:13 -0700183};
184
185} // namespace art