blob: 1a661c479f65aeddf519512a20aba6c921a65fbc [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"
Mathieu Chartierd8891782014-03-02 13:28:37 -080020#include "entrypoints/quick/quick_alloc_entrypoints.h"
Andreas Gampee1794562014-11-04 22:26:32 -080021#include "entrypoints/quick/quick_default_externs.h"
Ian Rogers7655f292013-07-29 11:07:13 -070022#include "entrypoints/quick/quick_entrypoints.h"
23#include "entrypoints/entrypoint_utils.h"
24#include "entrypoints/math_entrypoints.h"
Ian Rogers6f3dbba2014-10-14 17:41:57 -070025#include "entrypoints/runtime_asm_entrypoints.h"
26#include "interpreter/interpreter.h"
Ian Rogers7655f292013-07-29 11:07:13 -070027
28namespace art {
29
Ian Rogers7655f292013-07-29 11:07:13 -070030// Cast entrypoints.
31extern "C" uint32_t artIsAssignableFromCode(const mirror::Class* klass,
32 const mirror::Class* ref_class);
Ian Rogers7655f292013-07-29 11:07:13 -070033
34// Math entrypoints.
35extern int32_t CmpgDouble(double a, double b);
36extern int32_t CmplDouble(double a, double b);
37extern int32_t CmpgFloat(float a, float b);
38extern int32_t CmplFloat(float a, float b);
Ian Rogersa9a82542013-10-04 11:17:26 -070039extern "C" int64_t artLmul(int64_t a, int64_t b);
40extern "C" int64_t artLdiv(int64_t a, int64_t b);
41extern "C" int64_t artLmod(int64_t a, int64_t b);
Ian Rogers7655f292013-07-29 11:07:13 -070042
43// Math conversions.
44extern "C" int32_t __fixsfsi(float op1); // FLOAT_TO_INT
45extern "C" int32_t __fixdfsi(double op1); // DOUBLE_TO_INT
46extern "C" float __floatdisf(int64_t op1); // LONG_TO_FLOAT
47extern "C" double __floatdidf(int64_t op1); // LONG_TO_DOUBLE
48extern "C" int64_t __fixsfdi(float op1); // FLOAT_TO_LONG
49extern "C" int64_t __fixdfdi(double op1); // DOUBLE_TO_LONG
50
51// Single-precision FP arithmetics.
52extern "C" float fmodf(float a, float b); // REM_FLOAT[_2ADDR]
53
54// Double-precision FP arithmetics.
55extern "C" double fmod(double a, double b); // REM_DOUBLE[_2ADDR]
56
57// Long long arithmetics - REM_LONG[_2ADDR] and DIV_LONG[_2ADDR]
58extern "C" int64_t __divdi3(int64_t, int64_t);
59extern "C" int64_t __moddi3(int64_t, int64_t);
Hiroshi Yamauchi3b4c1892013-09-12 21:33:12 -070060
Ian Rogers848871b2013-08-05 10:56:33 -070061void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints,
Elliott Hughes956af0f2014-12-11 14:34:28 -080062 QuickEntryPoints* qpoints) {
Ian Rogers848871b2013-08-05 10:56:33 -070063 // Interpreter
64 ipoints->pInterpreterToInterpreterBridge = artInterpreterToInterpreterBridge;
Dragos Sbirlea08bf1962013-08-12 08:53:04 -070065 ipoints->pInterpreterToCompiledCodeBridge = artInterpreterToCompiledCodeBridge;
Ian Rogers848871b2013-08-05 10:56:33 -070066
67 // JNI
68 jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub;
69
Ian Rogers7655f292013-07-29 11:07:13 -070070 // Alloc
Hiroshi Yamauchi3b4c1892013-09-12 21:33:12 -070071 ResetQuickAllocEntryPoints(qpoints);
Ian Rogers7655f292013-07-29 11:07:13 -070072
73 // Cast
Ian Rogers848871b2013-08-05 10:56:33 -070074 qpoints->pInstanceofNonTrivial = artIsAssignableFromCode;
Ian Rogers848871b2013-08-05 10:56:33 -070075 qpoints->pCheckCast = art_quick_check_cast;
Ian Rogers7655f292013-07-29 11:07:13 -070076
77 // DexCache
Ian Rogers848871b2013-08-05 10:56:33 -070078 qpoints->pInitializeStaticStorage = art_quick_initialize_static_storage;
79 qpoints->pInitializeTypeAndVerifyAccess = art_quick_initialize_type_and_verify_access;
80 qpoints->pInitializeType = art_quick_initialize_type;
81 qpoints->pResolveString = art_quick_resolve_string;
Ian Rogers7655f292013-07-29 11:07:13 -070082
83 // Field
Fred Shih37f05ef2014-07-16 18:38:08 -070084 qpoints->pSet8Instance = art_quick_set8_instance;
85 qpoints->pSet8Static = art_quick_set8_static;
86 qpoints->pSet16Instance = art_quick_set16_instance;
87 qpoints->pSet16Static = art_quick_set16_static;
Ian Rogers848871b2013-08-05 10:56:33 -070088 qpoints->pSet32Instance = art_quick_set32_instance;
89 qpoints->pSet32Static = art_quick_set32_static;
90 qpoints->pSet64Instance = art_quick_set64_instance;
91 qpoints->pSet64Static = art_quick_set64_static;
92 qpoints->pSetObjInstance = art_quick_set_obj_instance;
93 qpoints->pSetObjStatic = art_quick_set_obj_static;
Fred Shih37f05ef2014-07-16 18:38:08 -070094 qpoints->pGetBooleanInstance = art_quick_get_boolean_instance;
95 qpoints->pGetByteInstance = art_quick_get_byte_instance;
96 qpoints->pGetCharInstance = art_quick_get_char_instance;
97 qpoints->pGetShortInstance = art_quick_get_short_instance;
Ian Rogers848871b2013-08-05 10:56:33 -070098 qpoints->pGet32Instance = art_quick_get32_instance;
99 qpoints->pGet64Instance = art_quick_get64_instance;
100 qpoints->pGetObjInstance = art_quick_get_obj_instance;
Fred Shih37f05ef2014-07-16 18:38:08 -0700101 qpoints->pGetBooleanStatic = art_quick_get_boolean_static;
102 qpoints->pGetByteStatic = art_quick_get_byte_static;
103 qpoints->pGetCharStatic = art_quick_get_char_static;
104 qpoints->pGetShortStatic = art_quick_get_short_static;
Ian Rogers848871b2013-08-05 10:56:33 -0700105 qpoints->pGet32Static = art_quick_get32_static;
106 qpoints->pGet64Static = art_quick_get64_static;
107 qpoints->pGetObjStatic = art_quick_get_obj_static;
Ian Rogers7655f292013-07-29 11:07:13 -0700108
Ian Rogersa9a82542013-10-04 11:17:26 -0700109 // Array
110 qpoints->pAputObjectWithNullAndBoundCheck = art_quick_aput_obj_with_null_and_bound_check;
111 qpoints->pAputObjectWithBoundCheck = art_quick_aput_obj_with_bound_check;
112 qpoints->pAputObject = art_quick_aput_obj;
Ian Rogers848871b2013-08-05 10:56:33 -0700113 qpoints->pHandleFillArrayData = art_quick_handle_fill_data;
Ian Rogers7655f292013-07-29 11:07:13 -0700114
115 // JNI
116 qpoints->pJniMethodStart = JniMethodStart;
117 qpoints->pJniMethodStartSynchronized = JniMethodStartSynchronized;
118 qpoints->pJniMethodEnd = JniMethodEnd;
119 qpoints->pJniMethodEndSynchronized = JniMethodEndSynchronized;
120 qpoints->pJniMethodEndWithReference = JniMethodEndWithReference;
121 qpoints->pJniMethodEndWithReferenceSynchronized = JniMethodEndWithReferenceSynchronized;
Andreas Gampe2da88232014-02-27 12:26:20 -0800122 qpoints->pQuickGenericJniTrampoline = art_quick_generic_jni_trampoline;
Ian Rogers7655f292013-07-29 11:07:13 -0700123
124 // Locks
Ian Rogers848871b2013-08-05 10:56:33 -0700125 qpoints->pLockObject = art_quick_lock_object;
126 qpoints->pUnlockObject = art_quick_unlock_object;
Ian Rogers7655f292013-07-29 11:07:13 -0700127
128 // Math
129 qpoints->pCmpgDouble = CmpgDouble;
130 qpoints->pCmpgFloat = CmpgFloat;
131 qpoints->pCmplDouble = CmplDouble;
132 qpoints->pCmplFloat = CmplFloat;
133 qpoints->pFmod = fmod;
Douglas Leungd9cb8ae2014-07-09 14:28:35 -0700134 qpoints->pL2d = art_l2d;
Ian Rogers7655f292013-07-29 11:07:13 -0700135 qpoints->pFmodf = fmodf;
Douglas Leungd9cb8ae2014-07-09 14:28:35 -0700136 qpoints->pL2f = art_l2f;
137 qpoints->pD2iz = art_d2i;
138 qpoints->pF2iz = art_f2i;
Ian Rogers7655f292013-07-29 11:07:13 -0700139 qpoints->pIdivmod = NULL;
140 qpoints->pD2l = art_d2l;
141 qpoints->pF2l = art_f2l;
Ian Rogersa9a82542013-10-04 11:17:26 -0700142 qpoints->pLdiv = artLdiv;
143 qpoints->pLmod = artLmod;
144 qpoints->pLmul = artLmul;
Ian Rogers7655f292013-07-29 11:07:13 -0700145 qpoints->pShlLong = art_quick_shl_long;
146 qpoints->pShrLong = art_quick_shr_long;
147 qpoints->pUshrLong = art_quick_ushr_long;
148
Ian Rogers7655f292013-07-29 11:07:13 -0700149 // Intrinsics
150 qpoints->pIndexOf = art_quick_indexof;
Ian Rogers7655f292013-07-29 11:07:13 -0700151 qpoints->pStringCompareTo = art_quick_string_compareto;
152 qpoints->pMemcpy = memcpy;
153
154 // Invocation
Jeff Hao88474b42013-10-23 16:24:40 -0700155 qpoints->pQuickImtConflictTrampoline = art_quick_imt_conflict_trampoline;
Ian Rogers848871b2013-08-05 10:56:33 -0700156 qpoints->pQuickResolutionTrampoline = art_quick_resolution_trampoline;
157 qpoints->pQuickToInterpreterBridge = art_quick_to_interpreter_bridge;
Ian Rogers7655f292013-07-29 11:07:13 -0700158 qpoints->pInvokeDirectTrampolineWithAccessCheck = art_quick_invoke_direct_trampoline_with_access_check;
Ian Rogers7655f292013-07-29 11:07:13 -0700159 qpoints->pInvokeInterfaceTrampolineWithAccessCheck = art_quick_invoke_interface_trampoline_with_access_check;
160 qpoints->pInvokeStaticTrampolineWithAccessCheck = art_quick_invoke_static_trampoline_with_access_check;
161 qpoints->pInvokeSuperTrampolineWithAccessCheck = art_quick_invoke_super_trampoline_with_access_check;
162 qpoints->pInvokeVirtualTrampolineWithAccessCheck = art_quick_invoke_virtual_trampoline_with_access_check;
163
164 // Thread
Ian Rogers848871b2013-08-05 10:56:33 -0700165 qpoints->pTestSuspend = art_quick_test_suspend;
Ian Rogers7655f292013-07-29 11:07:13 -0700166
167 // Throws
Ian Rogers848871b2013-08-05 10:56:33 -0700168 qpoints->pDeliverException = art_quick_deliver_exception;
169 qpoints->pThrowArrayBounds = art_quick_throw_array_bounds;
170 qpoints->pThrowDivZero = art_quick_throw_div_zero;
171 qpoints->pThrowNoSuchMethod = art_quick_throw_no_such_method;
172 qpoints->pThrowNullPointer = art_quick_throw_null_pointer_exception;
173 qpoints->pThrowStackOverflow = art_quick_throw_stack_overflow;
Douglas Leungd9cb8ae2014-07-09 14:28:35 -0700174
175 // Atomic 64-bit load/store
176 qpoints->pA64Load = QuasiAtomic::Read64;
177 qpoints->pA64Store = QuasiAtomic::Write64;
Ian Rogers7655f292013-07-29 11:07:13 -0700178};
179
180} // namespace art