blob: 8f18ff320449bc9df5cc4af3b2dc087c96897e0d [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"
Andreas Gampec7ed09b2016-04-25 20:08:55 -070020#include "entrypoints/quick/quick_default_init_entrypoints.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
Roland Levillain02b75802016-07-13 11:54:35 +010033// Read barrier entrypoints.
34// art_quick_read_barrier_mark_regX uses an non-standard calling
35// convention: it expects its input in register X and returns its
36// result in that same register.
37extern "C" mirror::Object* art_quick_read_barrier_mark_reg01(mirror::Object*);
38extern "C" mirror::Object* art_quick_read_barrier_mark_reg02(mirror::Object*);
39extern "C" mirror::Object* art_quick_read_barrier_mark_reg03(mirror::Object*);
40extern "C" mirror::Object* art_quick_read_barrier_mark_reg04(mirror::Object*);
41extern "C" mirror::Object* art_quick_read_barrier_mark_reg05(mirror::Object*);
42extern "C" mirror::Object* art_quick_read_barrier_mark_reg06(mirror::Object*);
43extern "C" mirror::Object* art_quick_read_barrier_mark_reg07(mirror::Object*);
44extern "C" mirror::Object* art_quick_read_barrier_mark_reg08(mirror::Object*);
45extern "C" mirror::Object* art_quick_read_barrier_mark_reg09(mirror::Object*);
46extern "C" mirror::Object* art_quick_read_barrier_mark_reg10(mirror::Object*);
47extern "C" mirror::Object* art_quick_read_barrier_mark_reg11(mirror::Object*);
48extern "C" mirror::Object* art_quick_read_barrier_mark_reg12(mirror::Object*);
Ian Rogers7655f292013-07-29 11:07:13 -070049
Zheng Xu5667fdb2014-10-23 18:29:55 +080050// Used by soft float.
Ian Rogers7655f292013-07-29 11:07:13 -070051// Single-precision FP arithmetics.
Zheng Xu5667fdb2014-10-23 18:29:55 +080052extern "C" float fmodf(float a, float b); // REM_FLOAT[_2ADDR]
Ian Rogers7655f292013-07-29 11:07:13 -070053// Double-precision FP arithmetics.
Zheng Xu5667fdb2014-10-23 18:29:55 +080054extern "C" double fmod(double a, double b); // REM_DOUBLE[_2ADDR]
55
56// Used by hard float.
Zheng Xu5667fdb2014-10-23 18:29:55 +080057extern "C" float art_quick_fmodf(float a, float b); // REM_FLOAT[_2ADDR]
58extern "C" double art_quick_fmod(double a, double b); // REM_DOUBLE[_2ADDR]
Ian Rogers7655f292013-07-29 11:07:13 -070059
60// Integer arithmetics.
61extern "C" int __aeabi_idivmod(int32_t, int32_t); // [DIV|REM]_INT[_2ADDR|_LIT8|_LIT16]
62
63// Long long arithmetics - REM_LONG[_2ADDR] and DIV_LONG[_2ADDR]
64extern "C" int64_t __aeabi_ldivmod(int64_t, int64_t);
Andreas Gampe277ccbd2014-11-03 21:36:10 -080065
Andreas Gampe3cfa4d02015-10-06 17:04:01 -070066void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) {
Andreas Gampec7ed09b2016-04-25 20:08:55 -070067 DefaultInitEntryPoints(jpoints, qpoints);
Ian Rogers7655f292013-07-29 11:07:13 -070068
69 // Cast
Ian Rogers848871b2013-08-05 10:56:33 -070070 qpoints->pInstanceofNonTrivial = artIsAssignableFromCode;
Ian Rogers848871b2013-08-05 10:56:33 -070071 qpoints->pCheckCast = art_quick_check_cast;
Ian Rogers7655f292013-07-29 11:07:13 -070072
Ian Rogers7655f292013-07-29 11:07:13 -070073 // Math
Ian Rogers7655f292013-07-29 11:07:13 -070074 qpoints->pIdivmod = __aeabi_idivmod;
Ian Rogers7655f292013-07-29 11:07:13 -070075 qpoints->pLdiv = __aeabi_ldivmod;
Ian Rogersa9a82542013-10-04 11:17:26 -070076 qpoints->pLmod = __aeabi_ldivmod; // result returned in r2:r3
Ian Rogers7655f292013-07-29 11:07:13 -070077 qpoints->pLmul = art_quick_mul_long;
78 qpoints->pShlLong = art_quick_shl_long;
79 qpoints->pShrLong = art_quick_shr_long;
80 qpoints->pUshrLong = art_quick_ushr_long;
Zheng Xu5667fdb2014-10-23 18:29:55 +080081 if (kArm32QuickCodeUseSoftFloat) {
82 qpoints->pFmod = fmod;
83 qpoints->pFmodf = fmodf;
84 qpoints->pD2l = art_d2l;
85 qpoints->pF2l = art_f2l;
Roland Levillain5b3ee562015-04-14 16:02:41 +010086 qpoints->pL2f = art_l2f;
Zheng Xu5667fdb2014-10-23 18:29:55 +080087 } else {
88 qpoints->pFmod = art_quick_fmod;
89 qpoints->pFmodf = art_quick_fmodf;
90 qpoints->pD2l = art_quick_d2l;
91 qpoints->pF2l = art_quick_f2l;
Roland Levillain5b3ee562015-04-14 16:02:41 +010092 qpoints->pL2f = art_quick_l2f;
Zheng Xu5667fdb2014-10-23 18:29:55 +080093 }
Ian Rogers7655f292013-07-29 11:07:13 -070094
Anton Kirilovd70dc9d2016-02-04 14:59:04 +000095 // More math.
96 qpoints->pCos = cos;
97 qpoints->pSin = sin;
98 qpoints->pAcos = acos;
99 qpoints->pAsin = asin;
100 qpoints->pAtan = atan;
101 qpoints->pAtan2 = atan2;
102 qpoints->pCbrt = cbrt;
103 qpoints->pCosh = cosh;
104 qpoints->pExp = exp;
105 qpoints->pExpm1 = expm1;
106 qpoints->pHypot = hypot;
107 qpoints->pLog = log;
108 qpoints->pLog10 = log10;
109 qpoints->pNextAfter = nextafter;
110 qpoints->pSinh = sinh;
111 qpoints->pTan = tan;
112 qpoints->pTanh = tanh;
113
Ian Rogers7655f292013-07-29 11:07:13 -0700114 // Intrinsics
115 qpoints->pIndexOf = art_quick_indexof;
Scott Wakelingc25cbf12016-04-18 09:00:11 +0100116 // The ARM StringCompareTo intrinsic does not call the runtime.
117 qpoints->pStringCompareTo = nullptr;
Ian Rogers7655f292013-07-29 11:07:13 -0700118 qpoints->pMemcpy = memcpy;
119
Roland Levillain0d5a2812015-11-13 10:07:31 +0000120 // Read barrier.
Hiroshi Yamauchi1cc71eb2015-05-07 10:47:27 -0700121 qpoints->pReadBarrierJni = ReadBarrierJni;
Roland Levillain02b75802016-07-13 11:54:35 +0100122 qpoints->pReadBarrierMarkReg00 = artReadBarrierMark;
123 qpoints->pReadBarrierMarkReg01 = art_quick_read_barrier_mark_reg01;
124 qpoints->pReadBarrierMarkReg02 = art_quick_read_barrier_mark_reg02;
125 qpoints->pReadBarrierMarkReg03 = art_quick_read_barrier_mark_reg03;
126 qpoints->pReadBarrierMarkReg04 = art_quick_read_barrier_mark_reg04;
127 qpoints->pReadBarrierMarkReg05 = art_quick_read_barrier_mark_reg05;
128 qpoints->pReadBarrierMarkReg06 = art_quick_read_barrier_mark_reg06;
129 qpoints->pReadBarrierMarkReg07 = art_quick_read_barrier_mark_reg07;
130 qpoints->pReadBarrierMarkReg08 = art_quick_read_barrier_mark_reg08;
131 qpoints->pReadBarrierMarkReg09 = art_quick_read_barrier_mark_reg09;
132 qpoints->pReadBarrierMarkReg10 = art_quick_read_barrier_mark_reg10;
133 qpoints->pReadBarrierMarkReg11 = art_quick_read_barrier_mark_reg11;
134 qpoints->pReadBarrierMarkReg12 = art_quick_read_barrier_mark_reg12;
135 qpoints->pReadBarrierMarkReg13 = nullptr; // Cannot use register 13 (SP) to pass arguments.
136 qpoints->pReadBarrierMarkReg14 = nullptr; // Cannot use register 14 (LR) to pass arguments.
137 qpoints->pReadBarrierMarkReg15 = nullptr; // Cannot use register 15 (PC) to pass arguments.
138 // ARM has only 16 core registers.
139 qpoints->pReadBarrierMarkReg16 = nullptr;
140 qpoints->pReadBarrierMarkReg17 = nullptr;
141 qpoints->pReadBarrierMarkReg18 = nullptr;
142 qpoints->pReadBarrierMarkReg19 = nullptr;
143 qpoints->pReadBarrierMarkReg20 = nullptr;
144 qpoints->pReadBarrierMarkReg21 = nullptr;
145 qpoints->pReadBarrierMarkReg22 = nullptr;
146 qpoints->pReadBarrierMarkReg23 = nullptr;
147 qpoints->pReadBarrierMarkReg24 = nullptr;
148 qpoints->pReadBarrierMarkReg25 = nullptr;
149 qpoints->pReadBarrierMarkReg26 = nullptr;
150 qpoints->pReadBarrierMarkReg27 = nullptr;
151 qpoints->pReadBarrierMarkReg28 = nullptr;
152 qpoints->pReadBarrierMarkReg29 = nullptr;
153 qpoints->pReadBarrierMarkReg30 = nullptr;
154 qpoints->pReadBarrierMarkReg31 = nullptr;
Man Cao1aee9002015-07-14 22:31:42 -0700155 qpoints->pReadBarrierSlow = artReadBarrierSlow;
Roland Levillain0d5a2812015-11-13 10:07:31 +0000156 qpoints->pReadBarrierForRootSlow = artReadBarrierForRootSlow;
Andreas Gampec8ccf682014-09-29 20:07:43 -0700157}
Ian Rogers7655f292013-07-29 11:07:13 -0700158
159} // namespace art