blob: cafc868789bdaf94dd11c0b9809e21b63ed3de42 [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 Rogers848871b2013-08-05 10:56:33 -070017#include "entrypoints/interpreter/interpreter_entrypoints.h"
Mingyao Yang98d1cc82014-05-15 17:02:16 -070018#include "entrypoints/jni/jni_entrypoints.h"
Mathieu Chartierd8891782014-03-02 13:28:37 -080019#include "entrypoints/quick/quick_alloc_entrypoints.h"
Andreas Gampee1794562014-11-04 22:26:32 -080020#include "entrypoints/quick/quick_default_externs.h"
Ian Rogers7655f292013-07-29 11:07:13 -070021#include "entrypoints/quick/quick_entrypoints.h"
22#include "entrypoints/entrypoint_utils.h"
23#include "entrypoints/math_entrypoints.h"
Andreas Gampee1794562014-11-04 22:26:32 -080024#include "entrypoints/runtime_asm_entrypoints.h"
Ian Rogers6f3dbba2014-10-14 17:41:57 -070025#include "interpreter/interpreter.h"
Ian Rogers7655f292013-07-29 11:07:13 -070026
27namespace art {
28
Ian Rogers7655f292013-07-29 11:07:13 -070029// Cast entrypoints.
30extern "C" uint32_t artIsAssignableFromCode(const mirror::Class* klass,
31 const mirror::Class* ref_class);
Ian Rogers7655f292013-07-29 11:07:13 -070032
Ian Rogers7655f292013-07-29 11:07:13 -070033
Zheng Xu5667fdb2014-10-23 18:29:55 +080034// Used by soft float.
Ian Rogers7655f292013-07-29 11:07:13 -070035// Single-precision FP arithmetics.
Zheng Xu5667fdb2014-10-23 18:29:55 +080036extern "C" float fmodf(float a, float b); // REM_FLOAT[_2ADDR]
Ian Rogers7655f292013-07-29 11:07:13 -070037// Double-precision FP arithmetics.
Zheng Xu5667fdb2014-10-23 18:29:55 +080038extern "C" double fmod(double a, double b); // REM_DOUBLE[_2ADDR]
39
40// Used by hard float.
Zheng Xu5667fdb2014-10-23 18:29:55 +080041extern "C" float art_quick_fmodf(float a, float b); // REM_FLOAT[_2ADDR]
42extern "C" double art_quick_fmod(double a, double b); // REM_DOUBLE[_2ADDR]
Ian Rogers7655f292013-07-29 11:07:13 -070043
44// Integer arithmetics.
45extern "C" int __aeabi_idivmod(int32_t, int32_t); // [DIV|REM]_INT[_2ADDR|_LIT8|_LIT16]
46
47// Long long arithmetics - REM_LONG[_2ADDR] and DIV_LONG[_2ADDR]
48extern "C" int64_t __aeabi_ldivmod(int64_t, int64_t);
Andreas Gampe277ccbd2014-11-03 21:36:10 -080049
Ian Rogers848871b2013-08-05 10:56:33 -070050void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints,
Elliott Hughes956af0f2014-12-11 14:34:28 -080051 QuickEntryPoints* qpoints) {
Ian Rogers848871b2013-08-05 10:56:33 -070052 // Interpreter
53 ipoints->pInterpreterToInterpreterBridge = artInterpreterToInterpreterBridge;
Dragos Sbirlea08bf1962013-08-12 08:53:04 -070054 ipoints->pInterpreterToCompiledCodeBridge = artInterpreterToCompiledCodeBridge;
Ian Rogers848871b2013-08-05 10:56:33 -070055
56 // JNI
57 jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub;
58
Ian Rogers7655f292013-07-29 11:07:13 -070059 // Alloc
Hiroshi Yamauchi3b4c1892013-09-12 21:33:12 -070060 ResetQuickAllocEntryPoints(qpoints);
Ian Rogers7655f292013-07-29 11:07:13 -070061
62 // Cast
Ian Rogers848871b2013-08-05 10:56:33 -070063 qpoints->pInstanceofNonTrivial = artIsAssignableFromCode;
Ian Rogers848871b2013-08-05 10:56:33 -070064 qpoints->pCheckCast = art_quick_check_cast;
Ian Rogers7655f292013-07-29 11:07:13 -070065
66 // DexCache
Ian Rogers848871b2013-08-05 10:56:33 -070067 qpoints->pInitializeStaticStorage = art_quick_initialize_static_storage;
68 qpoints->pInitializeTypeAndVerifyAccess = art_quick_initialize_type_and_verify_access;
69 qpoints->pInitializeType = art_quick_initialize_type;
70 qpoints->pResolveString = art_quick_resolve_string;
Ian Rogers7655f292013-07-29 11:07:13 -070071
72 // Field
Fred Shih37f05ef2014-07-16 18:38:08 -070073 qpoints->pSet8Instance = art_quick_set8_instance;
74 qpoints->pSet8Static = art_quick_set8_static;
75 qpoints->pSet16Instance = art_quick_set16_instance;
76 qpoints->pSet16Static = art_quick_set16_static;
Ian Rogers848871b2013-08-05 10:56:33 -070077 qpoints->pSet32Instance = art_quick_set32_instance;
78 qpoints->pSet32Static = art_quick_set32_static;
79 qpoints->pSet64Instance = art_quick_set64_instance;
80 qpoints->pSet64Static = art_quick_set64_static;
81 qpoints->pSetObjInstance = art_quick_set_obj_instance;
82 qpoints->pSetObjStatic = art_quick_set_obj_static;
Fred Shih37f05ef2014-07-16 18:38:08 -070083 qpoints->pGetByteInstance = art_quick_get_byte_instance;
84 qpoints->pGetBooleanInstance = art_quick_get_boolean_instance;
85 qpoints->pGetShortInstance = art_quick_get_short_instance;
86 qpoints->pGetCharInstance = art_quick_get_char_instance;
Ian Rogers848871b2013-08-05 10:56:33 -070087 qpoints->pGet32Instance = art_quick_get32_instance;
88 qpoints->pGet64Instance = art_quick_get64_instance;
89 qpoints->pGetObjInstance = art_quick_get_obj_instance;
Fred Shih37f05ef2014-07-16 18:38:08 -070090 qpoints->pGetByteStatic = art_quick_get_byte_static;
91 qpoints->pGetBooleanStatic = art_quick_get_boolean_static;
92 qpoints->pGetShortStatic = art_quick_get_short_static;
93 qpoints->pGetCharStatic = art_quick_get_char_static;
Ian Rogers848871b2013-08-05 10:56:33 -070094 qpoints->pGet32Static = art_quick_get32_static;
95 qpoints->pGet64Static = art_quick_get64_static;
96 qpoints->pGetObjStatic = art_quick_get_obj_static;
Ian Rogers7655f292013-07-29 11:07:13 -070097
Ian Rogersa9a82542013-10-04 11:17:26 -070098 // Array
99 qpoints->pAputObjectWithNullAndBoundCheck = art_quick_aput_obj_with_null_and_bound_check;
100 qpoints->pAputObjectWithBoundCheck = art_quick_aput_obj_with_bound_check;
101 qpoints->pAputObject = art_quick_aput_obj;
Ian Rogers848871b2013-08-05 10:56:33 -0700102 qpoints->pHandleFillArrayData = art_quick_handle_fill_data;
Ian Rogers7655f292013-07-29 11:07:13 -0700103
104 // JNI
105 qpoints->pJniMethodStart = JniMethodStart;
106 qpoints->pJniMethodStartSynchronized = JniMethodStartSynchronized;
107 qpoints->pJniMethodEnd = JniMethodEnd;
108 qpoints->pJniMethodEndSynchronized = JniMethodEndSynchronized;
109 qpoints->pJniMethodEndWithReference = JniMethodEndWithReference;
110 qpoints->pJniMethodEndWithReferenceSynchronized = JniMethodEndWithReferenceSynchronized;
Andreas Gampe2da88232014-02-27 12:26:20 -0800111 qpoints->pQuickGenericJniTrampoline = art_quick_generic_jni_trampoline;
Ian Rogers7655f292013-07-29 11:07:13 -0700112
113 // Locks
Ian Rogers848871b2013-08-05 10:56:33 -0700114 qpoints->pLockObject = art_quick_lock_object;
115 qpoints->pUnlockObject = art_quick_unlock_object;
Ian Rogers7655f292013-07-29 11:07:13 -0700116
117 // Math
Ian Rogers7655f292013-07-29 11:07:13 -0700118 qpoints->pIdivmod = __aeabi_idivmod;
Ian Rogers7655f292013-07-29 11:07:13 -0700119 qpoints->pLdiv = __aeabi_ldivmod;
Ian Rogersa9a82542013-10-04 11:17:26 -0700120 qpoints->pLmod = __aeabi_ldivmod; // result returned in r2:r3
Ian Rogers7655f292013-07-29 11:07:13 -0700121 qpoints->pLmul = art_quick_mul_long;
122 qpoints->pShlLong = art_quick_shl_long;
123 qpoints->pShrLong = art_quick_shr_long;
124 qpoints->pUshrLong = art_quick_ushr_long;
Zheng Xu5667fdb2014-10-23 18:29:55 +0800125 if (kArm32QuickCodeUseSoftFloat) {
126 qpoints->pFmod = fmod;
127 qpoints->pFmodf = fmodf;
128 qpoints->pD2l = art_d2l;
129 qpoints->pF2l = art_f2l;
130 } else {
131 qpoints->pFmod = art_quick_fmod;
132 qpoints->pFmodf = art_quick_fmodf;
133 qpoints->pD2l = art_quick_d2l;
134 qpoints->pF2l = art_quick_f2l;
135 }
Ian Rogers7655f292013-07-29 11:07:13 -0700136
Ian Rogers7655f292013-07-29 11:07:13 -0700137 // Intrinsics
138 qpoints->pIndexOf = art_quick_indexof;
Ian Rogers7655f292013-07-29 11:07:13 -0700139 qpoints->pStringCompareTo = art_quick_string_compareto;
140 qpoints->pMemcpy = memcpy;
141
142 // Invocation
Jeff Hao88474b42013-10-23 16:24:40 -0700143 qpoints->pQuickImtConflictTrampoline = art_quick_imt_conflict_trampoline;
Ian Rogers848871b2013-08-05 10:56:33 -0700144 qpoints->pQuickResolutionTrampoline = art_quick_resolution_trampoline;
145 qpoints->pQuickToInterpreterBridge = art_quick_to_interpreter_bridge;
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700146 qpoints->pInvokeDirectTrampolineWithAccessCheck =
147 art_quick_invoke_direct_trampoline_with_access_check;
148 qpoints->pInvokeInterfaceTrampolineWithAccessCheck =
149 art_quick_invoke_interface_trampoline_with_access_check;
150 qpoints->pInvokeStaticTrampolineWithAccessCheck =
151 art_quick_invoke_static_trampoline_with_access_check;
152 qpoints->pInvokeSuperTrampolineWithAccessCheck =
153 art_quick_invoke_super_trampoline_with_access_check;
154 qpoints->pInvokeVirtualTrampolineWithAccessCheck =
155 art_quick_invoke_virtual_trampoline_with_access_check;
Ian Rogers7655f292013-07-29 11:07:13 -0700156
157 // Thread
Ian Rogers848871b2013-08-05 10:56:33 -0700158 qpoints->pTestSuspend = art_quick_test_suspend;
Ian Rogers7655f292013-07-29 11:07:13 -0700159
160 // Throws
Ian Rogers848871b2013-08-05 10:56:33 -0700161 qpoints->pDeliverException = art_quick_deliver_exception;
162 qpoints->pThrowArrayBounds = art_quick_throw_array_bounds;
163 qpoints->pThrowDivZero = art_quick_throw_div_zero;
164 qpoints->pThrowNoSuchMethod = art_quick_throw_no_such_method;
165 qpoints->pThrowNullPointer = art_quick_throw_null_pointer_exception;
166 qpoints->pThrowStackOverflow = art_quick_throw_stack_overflow;
Mingyao Yangd43b3ac2015-04-01 14:03:04 -0700167
168 qpoints->pDeoptimize = art_quick_deoptimize;
Hiroshi Yamauchi1cc71eb2015-05-07 10:47:27 -0700169
170 // Read barrier
171 qpoints->pReadBarrierJni = ReadBarrierJni;
Andreas Gampec8ccf682014-09-29 20:07:43 -0700172}
Ian Rogers7655f292013-07-29 11:07:13 -0700173
174} // namespace art