blob: 85a0dd2c6a043e256759a61c91972d5cd15f025a [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"
Ian Rogers7655f292013-07-29 11:07:13 -070019#include "entrypoints/portable/portable_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"
Andreas Gampee1794562014-11-04 22:26:32 -080025#include "entrypoints/runtime_asm_entrypoints.h"
Ian Rogers6f3dbba2014-10-14 17:41:57 -070026#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
Ian Rogers7655f292013-07-29 11:07:13 -070034
Zheng Xu5667fdb2014-10-23 18:29:55 +080035// Used by soft float.
Ian Rogers7655f292013-07-29 11:07:13 -070036// Single-precision FP arithmetics.
Zheng Xu5667fdb2014-10-23 18:29:55 +080037extern "C" float fmodf(float a, float b); // REM_FLOAT[_2ADDR]
Ian Rogers7655f292013-07-29 11:07:13 -070038// Double-precision FP arithmetics.
Zheng Xu5667fdb2014-10-23 18:29:55 +080039extern "C" double fmod(double a, double b); // REM_DOUBLE[_2ADDR]
40
41// Used by hard float.
Zheng Xu5667fdb2014-10-23 18:29:55 +080042extern "C" float art_quick_fmodf(float a, float b); // REM_FLOAT[_2ADDR]
43extern "C" double art_quick_fmod(double a, double b); // REM_DOUBLE[_2ADDR]
Ian Rogers7655f292013-07-29 11:07:13 -070044
45// Integer arithmetics.
46extern "C" int __aeabi_idivmod(int32_t, int32_t); // [DIV|REM]_INT[_2ADDR|_LIT8|_LIT16]
47
48// Long long arithmetics - REM_LONG[_2ADDR] and DIV_LONG[_2ADDR]
49extern "C" int64_t __aeabi_ldivmod(int64_t, int64_t);
Andreas Gampe277ccbd2014-11-03 21:36:10 -080050
Ian Rogers848871b2013-08-05 10:56:33 -070051void InitEntryPoints(InterpreterEntryPoints* ipoints, JniEntryPoints* jpoints,
52 PortableEntryPoints* ppoints, QuickEntryPoints* qpoints) {
53 // Interpreter
54 ipoints->pInterpreterToInterpreterBridge = artInterpreterToInterpreterBridge;
Dragos Sbirlea08bf1962013-08-12 08:53:04 -070055 ipoints->pInterpreterToCompiledCodeBridge = artInterpreterToCompiledCodeBridge;
Ian Rogers848871b2013-08-05 10:56:33 -070056
57 // JNI
58 jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub;
59
60 // Portable
61 ppoints->pPortableResolutionTrampoline = art_portable_resolution_trampoline;
62 ppoints->pPortableToInterpreterBridge = art_portable_to_interpreter_bridge;
63
Ian Rogers7655f292013-07-29 11:07:13 -070064 // Alloc
Hiroshi Yamauchi3b4c1892013-09-12 21:33:12 -070065 ResetQuickAllocEntryPoints(qpoints);
Ian Rogers7655f292013-07-29 11:07:13 -070066
67 // Cast
Ian Rogers848871b2013-08-05 10:56:33 -070068 qpoints->pInstanceofNonTrivial = artIsAssignableFromCode;
Ian Rogers848871b2013-08-05 10:56:33 -070069 qpoints->pCheckCast = art_quick_check_cast;
Ian Rogers7655f292013-07-29 11:07:13 -070070
71 // DexCache
Ian Rogers848871b2013-08-05 10:56:33 -070072 qpoints->pInitializeStaticStorage = art_quick_initialize_static_storage;
73 qpoints->pInitializeTypeAndVerifyAccess = art_quick_initialize_type_and_verify_access;
74 qpoints->pInitializeType = art_quick_initialize_type;
75 qpoints->pResolveString = art_quick_resolve_string;
Ian Rogers7655f292013-07-29 11:07:13 -070076
77 // Field
Fred Shih37f05ef2014-07-16 18:38:08 -070078 qpoints->pSet8Instance = art_quick_set8_instance;
79 qpoints->pSet8Static = art_quick_set8_static;
80 qpoints->pSet16Instance = art_quick_set16_instance;
81 qpoints->pSet16Static = art_quick_set16_static;
Ian Rogers848871b2013-08-05 10:56:33 -070082 qpoints->pSet32Instance = art_quick_set32_instance;
83 qpoints->pSet32Static = art_quick_set32_static;
84 qpoints->pSet64Instance = art_quick_set64_instance;
85 qpoints->pSet64Static = art_quick_set64_static;
86 qpoints->pSetObjInstance = art_quick_set_obj_instance;
87 qpoints->pSetObjStatic = art_quick_set_obj_static;
Fred Shih37f05ef2014-07-16 18:38:08 -070088 qpoints->pGetByteInstance = art_quick_get_byte_instance;
89 qpoints->pGetBooleanInstance = art_quick_get_boolean_instance;
90 qpoints->pGetShortInstance = art_quick_get_short_instance;
91 qpoints->pGetCharInstance = art_quick_get_char_instance;
Ian Rogers848871b2013-08-05 10:56:33 -070092 qpoints->pGet32Instance = art_quick_get32_instance;
93 qpoints->pGet64Instance = art_quick_get64_instance;
94 qpoints->pGetObjInstance = art_quick_get_obj_instance;
Fred Shih37f05ef2014-07-16 18:38:08 -070095 qpoints->pGetByteStatic = art_quick_get_byte_static;
96 qpoints->pGetBooleanStatic = art_quick_get_boolean_static;
97 qpoints->pGetShortStatic = art_quick_get_short_static;
98 qpoints->pGetCharStatic = art_quick_get_char_static;
Ian Rogers848871b2013-08-05 10:56:33 -070099 qpoints->pGet32Static = art_quick_get32_static;
100 qpoints->pGet64Static = art_quick_get64_static;
101 qpoints->pGetObjStatic = art_quick_get_obj_static;
Ian Rogers7655f292013-07-29 11:07:13 -0700102
Ian Rogersa9a82542013-10-04 11:17:26 -0700103 // Array
104 qpoints->pAputObjectWithNullAndBoundCheck = art_quick_aput_obj_with_null_and_bound_check;
105 qpoints->pAputObjectWithBoundCheck = art_quick_aput_obj_with_bound_check;
106 qpoints->pAputObject = art_quick_aput_obj;
Ian Rogers848871b2013-08-05 10:56:33 -0700107 qpoints->pHandleFillArrayData = art_quick_handle_fill_data;
Ian Rogers7655f292013-07-29 11:07:13 -0700108
109 // JNI
110 qpoints->pJniMethodStart = JniMethodStart;
111 qpoints->pJniMethodStartSynchronized = JniMethodStartSynchronized;
112 qpoints->pJniMethodEnd = JniMethodEnd;
113 qpoints->pJniMethodEndSynchronized = JniMethodEndSynchronized;
114 qpoints->pJniMethodEndWithReference = JniMethodEndWithReference;
115 qpoints->pJniMethodEndWithReferenceSynchronized = JniMethodEndWithReferenceSynchronized;
Andreas Gampe2da88232014-02-27 12:26:20 -0800116 qpoints->pQuickGenericJniTrampoline = art_quick_generic_jni_trampoline;
Ian Rogers7655f292013-07-29 11:07:13 -0700117
118 // Locks
Ian Rogers848871b2013-08-05 10:56:33 -0700119 qpoints->pLockObject = art_quick_lock_object;
120 qpoints->pUnlockObject = art_quick_unlock_object;
Ian Rogers7655f292013-07-29 11:07:13 -0700121
122 // Math
Ian Rogers7655f292013-07-29 11:07:13 -0700123 qpoints->pIdivmod = __aeabi_idivmod;
Ian Rogers7655f292013-07-29 11:07:13 -0700124 qpoints->pLdiv = __aeabi_ldivmod;
Ian Rogersa9a82542013-10-04 11:17:26 -0700125 qpoints->pLmod = __aeabi_ldivmod; // result returned in r2:r3
Ian Rogers7655f292013-07-29 11:07:13 -0700126 qpoints->pLmul = art_quick_mul_long;
127 qpoints->pShlLong = art_quick_shl_long;
128 qpoints->pShrLong = art_quick_shr_long;
129 qpoints->pUshrLong = art_quick_ushr_long;
Zheng Xu5667fdb2014-10-23 18:29:55 +0800130 if (kArm32QuickCodeUseSoftFloat) {
131 qpoints->pFmod = fmod;
132 qpoints->pFmodf = fmodf;
133 qpoints->pD2l = art_d2l;
134 qpoints->pF2l = art_f2l;
135 } else {
136 qpoints->pFmod = art_quick_fmod;
137 qpoints->pFmodf = art_quick_fmodf;
138 qpoints->pD2l = art_quick_d2l;
139 qpoints->pF2l = art_quick_f2l;
140 }
Ian Rogers7655f292013-07-29 11:07:13 -0700141
Ian Rogers7655f292013-07-29 11:07:13 -0700142 // Intrinsics
143 qpoints->pIndexOf = art_quick_indexof;
Ian Rogers7655f292013-07-29 11:07:13 -0700144 qpoints->pStringCompareTo = art_quick_string_compareto;
145 qpoints->pMemcpy = memcpy;
146
147 // Invocation
Jeff Hao88474b42013-10-23 16:24:40 -0700148 qpoints->pQuickImtConflictTrampoline = art_quick_imt_conflict_trampoline;
Ian Rogers848871b2013-08-05 10:56:33 -0700149 qpoints->pQuickResolutionTrampoline = art_quick_resolution_trampoline;
150 qpoints->pQuickToInterpreterBridge = art_quick_to_interpreter_bridge;
Ian Rogers7655f292013-07-29 11:07:13 -0700151 qpoints->pInvokeDirectTrampolineWithAccessCheck = art_quick_invoke_direct_trampoline_with_access_check;
Ian Rogers7655f292013-07-29 11:07:13 -0700152 qpoints->pInvokeInterfaceTrampolineWithAccessCheck = art_quick_invoke_interface_trampoline_with_access_check;
153 qpoints->pInvokeStaticTrampolineWithAccessCheck = art_quick_invoke_static_trampoline_with_access_check;
154 qpoints->pInvokeSuperTrampolineWithAccessCheck = art_quick_invoke_super_trampoline_with_access_check;
155 qpoints->pInvokeVirtualTrampolineWithAccessCheck = art_quick_invoke_virtual_trampoline_with_access_check;
156
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;
Andreas Gampec8ccf682014-09-29 20:07:43 -0700167}
Ian Rogers7655f292013-07-29 11:07:13 -0700168
169} // namespace art