blob: 89f54ddc04c888056f20bc4531cfd118bad3bd74 [file] [log] [blame]
Andreas Gampe1a5c4062015-01-15 12:10:47 -08001/*
2 * Copyright (C) 2014 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
17#include "atomic.h"
Andreas Gampe1a5c4062015-01-15 12:10:47 -080018#include "entrypoints/jni/jni_entrypoints.h"
19#include "entrypoints/quick/quick_alloc_entrypoints.h"
20#include "entrypoints/quick/quick_default_externs.h"
21#include "entrypoints/quick/quick_entrypoints.h"
22#include "entrypoints/entrypoint_utils.h"
23#include "entrypoints/math_entrypoints.h"
24#include "entrypoints/runtime_asm_entrypoints.h"
25#include "interpreter/interpreter.h"
26
27namespace art {
28
29// Cast entrypoints.
30extern "C" uint32_t artIsAssignableFromCode(const mirror::Class* klass,
31 const mirror::Class* ref_class);
32// Math entrypoints.
33extern int32_t CmpgDouble(double a, double b);
34extern int32_t CmplDouble(double a, double b);
35extern int32_t CmpgFloat(float a, float b);
36extern int32_t CmplFloat(float a, float b);
37extern "C" int64_t artLmul(int64_t a, int64_t b);
38extern "C" int64_t artLdiv(int64_t a, int64_t b);
39extern "C" int64_t artLmod(int64_t a, int64_t b);
40
41// Math conversions.
42extern "C" int32_t __fixsfsi(float op1); // FLOAT_TO_INT
43extern "C" int32_t __fixdfsi(double op1); // DOUBLE_TO_INT
44extern "C" float __floatdisf(int64_t op1); // LONG_TO_FLOAT
45extern "C" double __floatdidf(int64_t op1); // LONG_TO_DOUBLE
46extern "C" int64_t __fixsfdi(float op1); // FLOAT_TO_LONG
47extern "C" int64_t __fixdfdi(double op1); // DOUBLE_TO_LONG
48
49// Single-precision FP arithmetics.
50extern "C" float fmodf(float a, float b); // REM_FLOAT[_2ADDR]
51
52// Double-precision FP arithmetics.
53extern "C" double fmod(double a, double b); // REM_DOUBLE[_2ADDR]
54
55// Long long arithmetics - REM_LONG[_2ADDR] and DIV_LONG[_2ADDR]
56extern "C" int64_t __divdi3(int64_t, int64_t);
57extern "C" int64_t __moddi3(int64_t, int64_t);
58
Andreas Gampe3cfa4d02015-10-06 17:04:01 -070059void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) {
Andreas Gampe1a5c4062015-01-15 12:10:47 -080060 // JNI
61 jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub;
62
63 // Alloc
64 ResetQuickAllocEntryPoints(qpoints);
65
66 // Cast
67 qpoints->pInstanceofNonTrivial = artIsAssignableFromCode;
68 qpoints->pCheckCast = art_quick_check_cast;
69
70 // DexCache
71 qpoints->pInitializeStaticStorage = art_quick_initialize_static_storage;
72 qpoints->pInitializeTypeAndVerifyAccess = art_quick_initialize_type_and_verify_access;
73 qpoints->pInitializeType = art_quick_initialize_type;
74 qpoints->pResolveString = art_quick_resolve_string;
75
76 // Field
77 qpoints->pSet8Instance = art_quick_set8_instance;
78 qpoints->pSet8Static = art_quick_set8_static;
79 qpoints->pSet16Instance = art_quick_set16_instance;
80 qpoints->pSet16Static = art_quick_set16_static;
81 qpoints->pSet32Instance = art_quick_set32_instance;
82 qpoints->pSet32Static = art_quick_set32_static;
83 qpoints->pSet64Instance = art_quick_set64_instance;
84 qpoints->pSet64Static = art_quick_set64_static;
85 qpoints->pSetObjInstance = art_quick_set_obj_instance;
86 qpoints->pSetObjStatic = art_quick_set_obj_static;
87 qpoints->pGetBooleanInstance = art_quick_get_boolean_instance;
88 qpoints->pGetByteInstance = art_quick_get_byte_instance;
89 qpoints->pGetCharInstance = art_quick_get_char_instance;
90 qpoints->pGetShortInstance = art_quick_get_short_instance;
91 qpoints->pGet32Instance = art_quick_get32_instance;
92 qpoints->pGet64Instance = art_quick_get64_instance;
93 qpoints->pGetObjInstance = art_quick_get_obj_instance;
94 qpoints->pGetBooleanStatic = art_quick_get_boolean_static;
95 qpoints->pGetByteStatic = art_quick_get_byte_static;
96 qpoints->pGetCharStatic = art_quick_get_char_static;
97 qpoints->pGetShortStatic = art_quick_get_short_static;
98 qpoints->pGet32Static = art_quick_get32_static;
99 qpoints->pGet64Static = art_quick_get64_static;
100 qpoints->pGetObjStatic = art_quick_get_obj_static;
101
102 // Array
103 qpoints->pAputObjectWithNullAndBoundCheck = art_quick_aput_obj_with_null_and_bound_check;
104 qpoints->pAputObjectWithBoundCheck = art_quick_aput_obj_with_bound_check;
105 qpoints->pAputObject = art_quick_aput_obj;
106 qpoints->pHandleFillArrayData = art_quick_handle_fill_data;
107
108 // JNI
109 qpoints->pJniMethodStart = JniMethodStart;
110 qpoints->pJniMethodStartSynchronized = JniMethodStartSynchronized;
111 qpoints->pJniMethodEnd = JniMethodEnd;
112 qpoints->pJniMethodEndSynchronized = JniMethodEndSynchronized;
113 qpoints->pJniMethodEndWithReference = JniMethodEndWithReference;
114 qpoints->pJniMethodEndWithReferenceSynchronized = JniMethodEndWithReferenceSynchronized;
115 qpoints->pQuickGenericJniTrampoline = art_quick_generic_jni_trampoline;
116
117 // Locks
118 qpoints->pLockObject = art_quick_lock_object;
119 qpoints->pUnlockObject = art_quick_unlock_object;
120
121 // Math
122 qpoints->pCmpgDouble = CmpgDouble;
123 qpoints->pCmpgFloat = CmpgFloat;
124 qpoints->pCmplDouble = CmplDouble;
125 qpoints->pCmplFloat = CmplFloat;
126 qpoints->pFmod = fmod;
127 qpoints->pL2d = art_l2d;
128 qpoints->pFmodf = fmodf;
129 qpoints->pL2f = art_l2f;
130 qpoints->pD2iz = art_d2i;
131 qpoints->pF2iz = art_f2i;
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700132 qpoints->pIdivmod = nullptr;
Andreas Gampe1a5c4062015-01-15 12:10:47 -0800133 qpoints->pD2l = art_d2l;
134 qpoints->pF2l = art_f2l;
135 qpoints->pLdiv = artLdiv;
136 qpoints->pLmod = artLmod;
137 qpoints->pLmul = artLmul;
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700138 qpoints->pShlLong = nullptr;
139 qpoints->pShrLong = nullptr;
140 qpoints->pUshrLong = nullptr;
Andreas Gampe1a5c4062015-01-15 12:10:47 -0800141
142 // Intrinsics
143 qpoints->pIndexOf = art_quick_indexof;
144 qpoints->pStringCompareTo = art_quick_string_compareto;
145 qpoints->pMemcpy = memcpy;
146
147 // Invocation
148 qpoints->pQuickImtConflictTrampoline = art_quick_imt_conflict_trampoline;
149 qpoints->pQuickResolutionTrampoline = art_quick_resolution_trampoline;
150 qpoints->pQuickToInterpreterBridge = art_quick_to_interpreter_bridge;
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700151 qpoints->pInvokeDirectTrampolineWithAccessCheck =
152 art_quick_invoke_direct_trampoline_with_access_check;
153 qpoints->pInvokeInterfaceTrampolineWithAccessCheck =
154 art_quick_invoke_interface_trampoline_with_access_check;
155 qpoints->pInvokeStaticTrampolineWithAccessCheck =
156 art_quick_invoke_static_trampoline_with_access_check;
157 qpoints->pInvokeSuperTrampolineWithAccessCheck =
158 art_quick_invoke_super_trampoline_with_access_check;
159 qpoints->pInvokeVirtualTrampolineWithAccessCheck =
160 art_quick_invoke_virtual_trampoline_with_access_check;
Andreas Gampe1a5c4062015-01-15 12:10:47 -0800161
162 // Thread
163 qpoints->pTestSuspend = art_quick_test_suspend;
164
165 // Throws
166 qpoints->pDeliverException = art_quick_deliver_exception;
167 qpoints->pThrowArrayBounds = art_quick_throw_array_bounds;
168 qpoints->pThrowDivZero = art_quick_throw_div_zero;
169 qpoints->pThrowNoSuchMethod = art_quick_throw_no_such_method;
170 qpoints->pThrowNullPointer = art_quick_throw_null_pointer_exception;
171 qpoints->pThrowStackOverflow = art_quick_throw_stack_overflow;
172
Sebastien Hertz07474662015-08-25 15:12:33 +0000173 // Deoptimization from compiled code.
174 qpoints->pDeoptimize = art_quick_deoptimize_from_compiled_code;
Douglas Leung2e8bf552015-07-07 17:27:34 -0700175
Andreas Gampe1a5c4062015-01-15 12:10:47 -0800176 // TODO - use lld/scd instructions for Mips64
177 // Atomic 64-bit load/store
178 qpoints->pA64Load = QuasiAtomic::Read64;
179 qpoints->pA64Store = QuasiAtomic::Write64;
Hiroshi Yamauchi1cc71eb2015-05-07 10:47:27 -0700180
Roland Levillain0d5a2812015-11-13 10:07:31 +0000181 // Read barrier.
Hiroshi Yamauchi1cc71eb2015-05-07 10:47:27 -0700182 qpoints->pReadBarrierJni = ReadBarrierJni;
Man Cao1aee9002015-07-14 22:31:42 -0700183 qpoints->pReadBarrierSlow = artReadBarrierSlow;
Roland Levillain0d5a2812015-11-13 10:07:31 +0000184 qpoints->pReadBarrierForRootSlow = artReadBarrierForRootSlow;
Andreas Gampe1a5c4062015-01-15 12:10:47 -0800185};
186
187} // namespace art