blob: be33b0e235cceb5dfd370c3f9d311597476b30e0 [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
Mingyao Yang98d1cc82014-05-15 17:02:16 -070017#include "entrypoints/jni/jni_entrypoints.h"
Mathieu Chartierd8891782014-03-02 13:28:37 -080018#include "entrypoints/quick/quick_alloc_entrypoints.h"
Andreas Gampee1794562014-11-04 22:26:32 -080019#include "entrypoints/quick/quick_default_externs.h"
Ian Rogers7655f292013-07-29 11:07:13 -070020#include "entrypoints/quick/quick_entrypoints.h"
21#include "entrypoints/entrypoint_utils.h"
22#include "entrypoints/math_entrypoints.h"
Andreas Gampee1794562014-11-04 22:26:32 -080023#include "entrypoints/runtime_asm_entrypoints.h"
Ian Rogers6f3dbba2014-10-14 17:41:57 -070024#include "interpreter/interpreter.h"
Ian Rogers7655f292013-07-29 11:07:13 -070025
26namespace art {
27
Ian Rogers7655f292013-07-29 11:07:13 -070028// Cast entrypoints.
29extern "C" uint32_t artIsAssignableFromCode(const mirror::Class* klass,
30 const mirror::Class* ref_class);
Ian Rogers7655f292013-07-29 11:07:13 -070031
Ian Rogers7655f292013-07-29 11:07:13 -070032
Zheng Xu5667fdb2014-10-23 18:29:55 +080033// Used by soft float.
Ian Rogers7655f292013-07-29 11:07:13 -070034// Single-precision FP arithmetics.
Zheng Xu5667fdb2014-10-23 18:29:55 +080035extern "C" float fmodf(float a, float b); // REM_FLOAT[_2ADDR]
Ian Rogers7655f292013-07-29 11:07:13 -070036// Double-precision FP arithmetics.
Zheng Xu5667fdb2014-10-23 18:29:55 +080037extern "C" double fmod(double a, double b); // REM_DOUBLE[_2ADDR]
38
39// Used by hard float.
Zheng Xu5667fdb2014-10-23 18:29:55 +080040extern "C" float art_quick_fmodf(float a, float b); // REM_FLOAT[_2ADDR]
41extern "C" double art_quick_fmod(double a, double b); // REM_DOUBLE[_2ADDR]
Ian Rogers7655f292013-07-29 11:07:13 -070042
43// Integer arithmetics.
44extern "C" int __aeabi_idivmod(int32_t, int32_t); // [DIV|REM]_INT[_2ADDR|_LIT8|_LIT16]
45
46// Long long arithmetics - REM_LONG[_2ADDR] and DIV_LONG[_2ADDR]
47extern "C" int64_t __aeabi_ldivmod(int64_t, int64_t);
Andreas Gampe277ccbd2014-11-03 21:36:10 -080048
Andreas Gampe3cfa4d02015-10-06 17:04:01 -070049void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) {
Ian Rogers848871b2013-08-05 10:56:33 -070050 // JNI
51 jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub;
52
Ian Rogers7655f292013-07-29 11:07:13 -070053 // Alloc
Hiroshi Yamauchi3b4c1892013-09-12 21:33:12 -070054 ResetQuickAllocEntryPoints(qpoints);
Ian Rogers7655f292013-07-29 11:07:13 -070055
56 // Cast
Ian Rogers848871b2013-08-05 10:56:33 -070057 qpoints->pInstanceofNonTrivial = artIsAssignableFromCode;
Ian Rogers848871b2013-08-05 10:56:33 -070058 qpoints->pCheckCast = art_quick_check_cast;
Ian Rogers7655f292013-07-29 11:07:13 -070059
60 // DexCache
Ian Rogers848871b2013-08-05 10:56:33 -070061 qpoints->pInitializeStaticStorage = art_quick_initialize_static_storage;
62 qpoints->pInitializeTypeAndVerifyAccess = art_quick_initialize_type_and_verify_access;
63 qpoints->pInitializeType = art_quick_initialize_type;
64 qpoints->pResolveString = art_quick_resolve_string;
Ian Rogers7655f292013-07-29 11:07:13 -070065
66 // Field
Fred Shih37f05ef2014-07-16 18:38:08 -070067 qpoints->pSet8Instance = art_quick_set8_instance;
68 qpoints->pSet8Static = art_quick_set8_static;
69 qpoints->pSet16Instance = art_quick_set16_instance;
70 qpoints->pSet16Static = art_quick_set16_static;
Ian Rogers848871b2013-08-05 10:56:33 -070071 qpoints->pSet32Instance = art_quick_set32_instance;
72 qpoints->pSet32Static = art_quick_set32_static;
73 qpoints->pSet64Instance = art_quick_set64_instance;
74 qpoints->pSet64Static = art_quick_set64_static;
75 qpoints->pSetObjInstance = art_quick_set_obj_instance;
76 qpoints->pSetObjStatic = art_quick_set_obj_static;
Fred Shih37f05ef2014-07-16 18:38:08 -070077 qpoints->pGetByteInstance = art_quick_get_byte_instance;
78 qpoints->pGetBooleanInstance = art_quick_get_boolean_instance;
79 qpoints->pGetShortInstance = art_quick_get_short_instance;
80 qpoints->pGetCharInstance = art_quick_get_char_instance;
Ian Rogers848871b2013-08-05 10:56:33 -070081 qpoints->pGet32Instance = art_quick_get32_instance;
82 qpoints->pGet64Instance = art_quick_get64_instance;
83 qpoints->pGetObjInstance = art_quick_get_obj_instance;
Fred Shih37f05ef2014-07-16 18:38:08 -070084 qpoints->pGetByteStatic = art_quick_get_byte_static;
85 qpoints->pGetBooleanStatic = art_quick_get_boolean_static;
86 qpoints->pGetShortStatic = art_quick_get_short_static;
87 qpoints->pGetCharStatic = art_quick_get_char_static;
Ian Rogers848871b2013-08-05 10:56:33 -070088 qpoints->pGet32Static = art_quick_get32_static;
89 qpoints->pGet64Static = art_quick_get64_static;
90 qpoints->pGetObjStatic = art_quick_get_obj_static;
Ian Rogers7655f292013-07-29 11:07:13 -070091
Ian Rogersa9a82542013-10-04 11:17:26 -070092 // Array
93 qpoints->pAputObjectWithNullAndBoundCheck = art_quick_aput_obj_with_null_and_bound_check;
94 qpoints->pAputObjectWithBoundCheck = art_quick_aput_obj_with_bound_check;
95 qpoints->pAputObject = art_quick_aput_obj;
Ian Rogers848871b2013-08-05 10:56:33 -070096 qpoints->pHandleFillArrayData = art_quick_handle_fill_data;
Ian Rogers7655f292013-07-29 11:07:13 -070097
98 // JNI
99 qpoints->pJniMethodStart = JniMethodStart;
100 qpoints->pJniMethodStartSynchronized = JniMethodStartSynchronized;
101 qpoints->pJniMethodEnd = JniMethodEnd;
102 qpoints->pJniMethodEndSynchronized = JniMethodEndSynchronized;
103 qpoints->pJniMethodEndWithReference = JniMethodEndWithReference;
104 qpoints->pJniMethodEndWithReferenceSynchronized = JniMethodEndWithReferenceSynchronized;
Andreas Gampe2da88232014-02-27 12:26:20 -0800105 qpoints->pQuickGenericJniTrampoline = art_quick_generic_jni_trampoline;
Ian Rogers7655f292013-07-29 11:07:13 -0700106
107 // Locks
Ian Rogers848871b2013-08-05 10:56:33 -0700108 qpoints->pLockObject = art_quick_lock_object;
109 qpoints->pUnlockObject = art_quick_unlock_object;
Ian Rogers7655f292013-07-29 11:07:13 -0700110
111 // Math
Ian Rogers7655f292013-07-29 11:07:13 -0700112 qpoints->pIdivmod = __aeabi_idivmod;
Ian Rogers7655f292013-07-29 11:07:13 -0700113 qpoints->pLdiv = __aeabi_ldivmod;
Ian Rogersa9a82542013-10-04 11:17:26 -0700114 qpoints->pLmod = __aeabi_ldivmod; // result returned in r2:r3
Ian Rogers7655f292013-07-29 11:07:13 -0700115 qpoints->pLmul = art_quick_mul_long;
116 qpoints->pShlLong = art_quick_shl_long;
117 qpoints->pShrLong = art_quick_shr_long;
118 qpoints->pUshrLong = art_quick_ushr_long;
Zheng Xu5667fdb2014-10-23 18:29:55 +0800119 if (kArm32QuickCodeUseSoftFloat) {
120 qpoints->pFmod = fmod;
121 qpoints->pFmodf = fmodf;
122 qpoints->pD2l = art_d2l;
123 qpoints->pF2l = art_f2l;
Roland Levillain5b3ee562015-04-14 16:02:41 +0100124 qpoints->pL2f = art_l2f;
Zheng Xu5667fdb2014-10-23 18:29:55 +0800125 } else {
126 qpoints->pFmod = art_quick_fmod;
127 qpoints->pFmodf = art_quick_fmodf;
128 qpoints->pD2l = art_quick_d2l;
129 qpoints->pF2l = art_quick_f2l;
Roland Levillain5b3ee562015-04-14 16:02:41 +0100130 qpoints->pL2f = art_quick_l2f;
Zheng Xu5667fdb2014-10-23 18:29:55 +0800131 }
Ian Rogers7655f292013-07-29 11:07:13 -0700132
Ian Rogers7655f292013-07-29 11:07:13 -0700133 // Intrinsics
134 qpoints->pIndexOf = art_quick_indexof;
Ian Rogers7655f292013-07-29 11:07:13 -0700135 qpoints->pStringCompareTo = art_quick_string_compareto;
136 qpoints->pMemcpy = memcpy;
137
138 // Invocation
Jeff Hao88474b42013-10-23 16:24:40 -0700139 qpoints->pQuickImtConflictTrampoline = art_quick_imt_conflict_trampoline;
Ian Rogers848871b2013-08-05 10:56:33 -0700140 qpoints->pQuickResolutionTrampoline = art_quick_resolution_trampoline;
141 qpoints->pQuickToInterpreterBridge = art_quick_to_interpreter_bridge;
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700142 qpoints->pInvokeDirectTrampolineWithAccessCheck =
143 art_quick_invoke_direct_trampoline_with_access_check;
144 qpoints->pInvokeInterfaceTrampolineWithAccessCheck =
145 art_quick_invoke_interface_trampoline_with_access_check;
146 qpoints->pInvokeStaticTrampolineWithAccessCheck =
147 art_quick_invoke_static_trampoline_with_access_check;
148 qpoints->pInvokeSuperTrampolineWithAccessCheck =
149 art_quick_invoke_super_trampoline_with_access_check;
150 qpoints->pInvokeVirtualTrampolineWithAccessCheck =
151 art_quick_invoke_virtual_trampoline_with_access_check;
Ian Rogers7655f292013-07-29 11:07:13 -0700152
153 // Thread
Ian Rogers848871b2013-08-05 10:56:33 -0700154 qpoints->pTestSuspend = art_quick_test_suspend;
Ian Rogers7655f292013-07-29 11:07:13 -0700155
156 // Throws
Ian Rogers848871b2013-08-05 10:56:33 -0700157 qpoints->pDeliverException = art_quick_deliver_exception;
158 qpoints->pThrowArrayBounds = art_quick_throw_array_bounds;
159 qpoints->pThrowDivZero = art_quick_throw_div_zero;
160 qpoints->pThrowNoSuchMethod = art_quick_throw_no_such_method;
161 qpoints->pThrowNullPointer = art_quick_throw_null_pointer_exception;
162 qpoints->pThrowStackOverflow = art_quick_throw_stack_overflow;
Mingyao Yangd43b3ac2015-04-01 14:03:04 -0700163
Sebastien Hertz07474662015-08-25 15:12:33 +0000164 // Deoptimization from compiled code.
165 qpoints->pDeoptimize = art_quick_deoptimize_from_compiled_code;
Hiroshi Yamauchi1cc71eb2015-05-07 10:47:27 -0700166
Roland Levillain0d5a2812015-11-13 10:07:31 +0000167 // Read barrier.
Hiroshi Yamauchi1cc71eb2015-05-07 10:47:27 -0700168 qpoints->pReadBarrierJni = ReadBarrierJni;
Man Cao1aee9002015-07-14 22:31:42 -0700169 qpoints->pReadBarrierSlow = artReadBarrierSlow;
Roland Levillain0d5a2812015-11-13 10:07:31 +0000170 qpoints->pReadBarrierForRootSlow = artReadBarrierForRootSlow;
Andreas Gampec8ccf682014-09-29 20:07:43 -0700171}
Ian Rogers7655f292013-07-29 11:07:13 -0700172
173} // namespace art