blob: e593f39fd81332689de5c9550405e9403ab9fc6b [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"
Ian Rogers6f3dbba2014-10-14 17:41:57 -070021#include "entrypoints/runtime_asm_entrypoints.h"
22#include "interpreter/interpreter.h"
Ian Rogers7655f292013-07-29 11:07:13 -070023
24namespace art {
25
Ian Rogers848871b2013-08-05 10:56:33 -070026// Cast entrypoints.
27extern "C" uint32_t art_quick_is_assignable(const mirror::Class* klass,
Andreas Gampee1794562014-11-04 22:26:32 -080028 const mirror::Class* ref_class);
Hiroshi Yamauchi3b4c1892013-09-12 21:33:12 -070029
Man Cao1aee9002015-07-14 22:31:42 -070030// Read barrier entrypoints.
Roland Levillain7c1559a2015-12-15 10:55:36 +000031extern "C" mirror::Object* art_quick_read_barrier_mark(mirror::Object*);
Man Cao1aee9002015-07-14 22:31:42 -070032extern "C" mirror::Object* art_quick_read_barrier_slow(mirror::Object*, mirror::Object*, uint32_t);
Roland Levillain0d5a2812015-11-13 10:07:31 +000033extern "C" mirror::Object* art_quick_read_barrier_for_root_slow(GcRoot<mirror::Object>*);
Man Cao1aee9002015-07-14 22:31:42 -070034
Andreas Gampe3cfa4d02015-10-06 17:04:01 -070035void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) {
Ian Rogers848871b2013-08-05 10:56:33 -070036 // JNI
37 jpoints->pDlsymLookup = art_jni_dlsym_lookup_stub;
38
Ian Rogers7655f292013-07-29 11:07:13 -070039 // Alloc
Hiroshi Yamauchi3b4c1892013-09-12 21:33:12 -070040 ResetQuickAllocEntryPoints(qpoints);
Ian Rogers7655f292013-07-29 11:07:13 -070041
42 // Cast
Ian Rogers848871b2013-08-05 10:56:33 -070043 qpoints->pInstanceofNonTrivial = art_quick_is_assignable;
Ian Rogers848871b2013-08-05 10:56:33 -070044 qpoints->pCheckCast = art_quick_check_cast;
Ian Rogers7655f292013-07-29 11:07:13 -070045
46 // DexCache
Ian Rogers848871b2013-08-05 10:56:33 -070047 qpoints->pInitializeStaticStorage = art_quick_initialize_static_storage;
48 qpoints->pInitializeTypeAndVerifyAccess = art_quick_initialize_type_and_verify_access;
49 qpoints->pInitializeType = art_quick_initialize_type;
50 qpoints->pResolveString = art_quick_resolve_string;
Ian Rogers7655f292013-07-29 11:07:13 -070051
52 // Field
Fred Shih37f05ef2014-07-16 18:38:08 -070053 qpoints->pSet8Instance = art_quick_set8_instance;
54 qpoints->pSet8Static = art_quick_set8_static;
55 qpoints->pSet16Instance = art_quick_set16_instance;
56 qpoints->pSet16Static = art_quick_set16_static;
Ian Rogers848871b2013-08-05 10:56:33 -070057 qpoints->pSet32Instance = art_quick_set32_instance;
58 qpoints->pSet32Static = art_quick_set32_static;
59 qpoints->pSet64Instance = art_quick_set64_instance;
60 qpoints->pSet64Static = art_quick_set64_static;
61 qpoints->pSetObjInstance = art_quick_set_obj_instance;
62 qpoints->pSetObjStatic = art_quick_set_obj_static;
Fred Shih37f05ef2014-07-16 18:38:08 -070063 qpoints->pGetByteInstance = art_quick_get_byte_instance;
64 qpoints->pGetBooleanInstance = art_quick_get_boolean_instance;
65 qpoints->pGetShortInstance = art_quick_get_short_instance;
66 qpoints->pGetCharInstance = art_quick_get_char_instance;
Ian Rogers848871b2013-08-05 10:56:33 -070067 qpoints->pGet32Instance = art_quick_get32_instance;
68 qpoints->pGet64Instance = art_quick_get64_instance;
69 qpoints->pGetObjInstance = art_quick_get_obj_instance;
Fred Shih37f05ef2014-07-16 18:38:08 -070070 qpoints->pGetByteStatic = art_quick_get_byte_static;
71 qpoints->pGetBooleanStatic = art_quick_get_boolean_static;
72 qpoints->pGetShortStatic = art_quick_get_short_static;
73 qpoints->pGetCharStatic = art_quick_get_char_static;
Ian Rogers848871b2013-08-05 10:56:33 -070074 qpoints->pGet32Static = art_quick_get32_static;
75 qpoints->pGet64Static = art_quick_get64_static;
76 qpoints->pGetObjStatic = art_quick_get_obj_static;
Ian Rogers7655f292013-07-29 11:07:13 -070077
Ian Rogersa9a82542013-10-04 11:17:26 -070078 // Array
79 qpoints->pAputObjectWithNullAndBoundCheck = art_quick_aput_obj_with_null_and_bound_check;
80 qpoints->pAputObjectWithBoundCheck = art_quick_aput_obj_with_bound_check;
81 qpoints->pAputObject = art_quick_aput_obj;
Ian Rogers848871b2013-08-05 10:56:33 -070082 qpoints->pHandleFillArrayData = art_quick_handle_fill_data;
Ian Rogers7655f292013-07-29 11:07:13 -070083
84 // JNI
85 qpoints->pJniMethodStart = JniMethodStart;
86 qpoints->pJniMethodStartSynchronized = JniMethodStartSynchronized;
87 qpoints->pJniMethodEnd = JniMethodEnd;
88 qpoints->pJniMethodEndSynchronized = JniMethodEndSynchronized;
89 qpoints->pJniMethodEndWithReference = JniMethodEndWithReference;
90 qpoints->pJniMethodEndWithReferenceSynchronized = JniMethodEndWithReferenceSynchronized;
Andreas Gampe2da88232014-02-27 12:26:20 -080091 qpoints->pQuickGenericJniTrampoline = art_quick_generic_jni_trampoline;
Ian Rogers7655f292013-07-29 11:07:13 -070092
93 // Locks
Ian Rogers848871b2013-08-05 10:56:33 -070094 qpoints->pLockObject = art_quick_lock_object;
95 qpoints->pUnlockObject = art_quick_unlock_object;
Ian Rogers7655f292013-07-29 11:07:13 -070096
Mark Mendella4f12202015-08-06 15:23:34 -040097 // More math.
98 qpoints->pCos = cos;
99 qpoints->pSin = sin;
100 qpoints->pAcos = acos;
101 qpoints->pAsin = asin;
102 qpoints->pAtan = atan;
103 qpoints->pAtan2 = atan2;
104 qpoints->pCbrt = cbrt;
105 qpoints->pCosh = cosh;
106 qpoints->pExp = exp;
107 qpoints->pExpm1 = expm1;
108 qpoints->pHypot = hypot;
109 qpoints->pLog = log;
110 qpoints->pLog10 = log10;
111 qpoints->pNextAfter = nextafter;
112 qpoints->pSinh = sinh;
113 qpoints->pTan = tan;
114 qpoints->pTanh = tanh;
115
Ian Rogers7655f292013-07-29 11:07:13 -0700116 // Math
Ian Rogers848871b2013-08-05 10:56:33 -0700117 qpoints->pD2l = art_quick_d2l;
118 qpoints->pF2l = art_quick_f2l;
119 qpoints->pLdiv = art_quick_ldiv;
Ian Rogersa9a82542013-10-04 11:17:26 -0700120 qpoints->pLmod = art_quick_lmod;
Ian Rogers848871b2013-08-05 10:56:33 -0700121 qpoints->pLmul = art_quick_lmul;
122 qpoints->pShlLong = art_quick_lshl;
123 qpoints->pShrLong = art_quick_lshr;
124 qpoints->pUshrLong = art_quick_lushr;
Ian Rogers7655f292013-07-29 11:07:13 -0700125
126 // Intrinsics
Mark Mendell4028a6c2014-02-19 20:06:20 -0800127 // qpoints->pIndexOf = nullptr; // Not needed on x86
Ian Rogers7655f292013-07-29 11:07:13 -0700128 qpoints->pStringCompareTo = art_quick_string_compareto;
129 qpoints->pMemcpy = art_quick_memcpy;
130
131 // Invocation
Jeff Hao88474b42013-10-23 16:24:40 -0700132 qpoints->pQuickImtConflictTrampoline = art_quick_imt_conflict_trampoline;
Ian Rogers848871b2013-08-05 10:56:33 -0700133 qpoints->pQuickResolutionTrampoline = art_quick_resolution_trampoline;
134 qpoints->pQuickToInterpreterBridge = art_quick_to_interpreter_bridge;
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700135 qpoints->pInvokeDirectTrampolineWithAccessCheck =
136 art_quick_invoke_direct_trampoline_with_access_check;
137 qpoints->pInvokeInterfaceTrampolineWithAccessCheck =
138 art_quick_invoke_interface_trampoline_with_access_check;
139 qpoints->pInvokeStaticTrampolineWithAccessCheck =
140 art_quick_invoke_static_trampoline_with_access_check;
141 qpoints->pInvokeSuperTrampolineWithAccessCheck =
142 art_quick_invoke_super_trampoline_with_access_check;
143 qpoints->pInvokeVirtualTrampolineWithAccessCheck =
144 art_quick_invoke_virtual_trampoline_with_access_check;
Ian Rogers7655f292013-07-29 11:07:13 -0700145
146 // Thread
Ian Rogers848871b2013-08-05 10:56:33 -0700147 qpoints->pTestSuspend = art_quick_test_suspend;
Ian Rogers7655f292013-07-29 11:07:13 -0700148
149 // Throws
Ian Rogers848871b2013-08-05 10:56:33 -0700150 qpoints->pDeliverException = art_quick_deliver_exception;
151 qpoints->pThrowArrayBounds = art_quick_throw_array_bounds;
152 qpoints->pThrowDivZero = art_quick_throw_div_zero;
153 qpoints->pThrowNoSuchMethod = art_quick_throw_no_such_method;
154 qpoints->pThrowNullPointer = art_quick_throw_null_pointer_exception;
155 qpoints->pThrowStackOverflow = art_quick_throw_stack_overflow;
Mingyao Yangd43b3ac2015-04-01 14:03:04 -0700156
157 // Deoptimize
Sebastien Hertz07474662015-08-25 15:12:33 +0000158 qpoints->pDeoptimize = art_quick_deoptimize_from_compiled_code;
Hiroshi Yamauchi1cc71eb2015-05-07 10:47:27 -0700159
Roland Levillain0d5a2812015-11-13 10:07:31 +0000160 // Read barrier.
Hiroshi Yamauchi1cc71eb2015-05-07 10:47:27 -0700161 qpoints->pReadBarrierJni = ReadBarrierJni;
Roland Levillain7c1559a2015-12-15 10:55:36 +0000162 qpoints->pReadBarrierMark = art_quick_read_barrier_mark;
Man Cao1aee9002015-07-14 22:31:42 -0700163 qpoints->pReadBarrierSlow = art_quick_read_barrier_slow;
Roland Levillain0d5a2812015-11-13 10:07:31 +0000164 qpoints->pReadBarrierForRootSlow = art_quick_read_barrier_for_root_slow;
Ian Rogers7655f292013-07-29 11:07:13 -0700165};
166
167} // namespace art