blob: cc5bf29609feb7c6dd9842aadb735b32361305b3 [file] [log] [blame]
Stuart Monteithb95a5342014-03-12 13:32:32 +00001/*
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
Mingyao Yang98d1cc82014-05-15 17:02:16 -070017#include "entrypoints/jni/jni_entrypoints.h"
Andreas Gampee1794562014-11-04 22:26:32 -080018#include "entrypoints/quick/quick_alloc_entrypoints.h"
19#include "entrypoints/quick/quick_default_externs.h"
Andreas Gampec7ed09b2016-04-25 20:08:55 -070020#include "entrypoints/quick/quick_default_init_entrypoints.h"
Stuart Monteithb95a5342014-03-12 13:32:32 +000021#include "entrypoints/quick/quick_entrypoints.h"
22#include "entrypoints/entrypoint_utils.h"
23#include "entrypoints/math_entrypoints.h"
Ian Rogers6f3dbba2014-10-14 17:41:57 -070024#include "entrypoints/runtime_asm_entrypoints.h"
25#include "interpreter/interpreter.h"
Stuart Monteithb95a5342014-03-12 13:32:32 +000026
27namespace art {
28
Stuart Monteithb95a5342014-03-12 13:32:32 +000029// Cast entrypoints.
Andreas Gampe67409972016-07-19 22:34:53 -070030extern "C" size_t artIsAssignableFromCode(const mirror::Class* klass,
31 const mirror::Class* ref_class);
Stuart Monteithb95a5342014-03-12 13:32:32 +000032
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
Roland Levillain4359e612016-07-20 11:32:19 +010036// result in that same register, and saves and restores all
37// caller-save registers.
38extern "C" mirror::Object* art_quick_read_barrier_mark_reg00(mirror::Object*);
Roland Levillain02b75802016-07-13 11:54:35 +010039extern "C" mirror::Object* art_quick_read_barrier_mark_reg01(mirror::Object*);
40extern "C" mirror::Object* art_quick_read_barrier_mark_reg02(mirror::Object*);
41extern "C" mirror::Object* art_quick_read_barrier_mark_reg03(mirror::Object*);
42extern "C" mirror::Object* art_quick_read_barrier_mark_reg04(mirror::Object*);
43extern "C" mirror::Object* art_quick_read_barrier_mark_reg05(mirror::Object*);
44extern "C" mirror::Object* art_quick_read_barrier_mark_reg06(mirror::Object*);
45extern "C" mirror::Object* art_quick_read_barrier_mark_reg07(mirror::Object*);
46extern "C" mirror::Object* art_quick_read_barrier_mark_reg08(mirror::Object*);
47extern "C" mirror::Object* art_quick_read_barrier_mark_reg09(mirror::Object*);
48extern "C" mirror::Object* art_quick_read_barrier_mark_reg10(mirror::Object*);
49extern "C" mirror::Object* art_quick_read_barrier_mark_reg11(mirror::Object*);
50extern "C" mirror::Object* art_quick_read_barrier_mark_reg12(mirror::Object*);
51extern "C" mirror::Object* art_quick_read_barrier_mark_reg12(mirror::Object*);
52extern "C" mirror::Object* art_quick_read_barrier_mark_reg13(mirror::Object*);
53extern "C" mirror::Object* art_quick_read_barrier_mark_reg14(mirror::Object*);
54extern "C" mirror::Object* art_quick_read_barrier_mark_reg15(mirror::Object*);
55extern "C" mirror::Object* art_quick_read_barrier_mark_reg16(mirror::Object*);
56extern "C" mirror::Object* art_quick_read_barrier_mark_reg17(mirror::Object*);
57extern "C" mirror::Object* art_quick_read_barrier_mark_reg18(mirror::Object*);
58extern "C" mirror::Object* art_quick_read_barrier_mark_reg19(mirror::Object*);
59extern "C" mirror::Object* art_quick_read_barrier_mark_reg20(mirror::Object*);
60extern "C" mirror::Object* art_quick_read_barrier_mark_reg21(mirror::Object*);
61extern "C" mirror::Object* art_quick_read_barrier_mark_reg22(mirror::Object*);
62extern "C" mirror::Object* art_quick_read_barrier_mark_reg22(mirror::Object*);
63extern "C" mirror::Object* art_quick_read_barrier_mark_reg23(mirror::Object*);
64extern "C" mirror::Object* art_quick_read_barrier_mark_reg24(mirror::Object*);
65extern "C" mirror::Object* art_quick_read_barrier_mark_reg25(mirror::Object*);
66extern "C" mirror::Object* art_quick_read_barrier_mark_reg26(mirror::Object*);
67extern "C" mirror::Object* art_quick_read_barrier_mark_reg27(mirror::Object*);
68extern "C" mirror::Object* art_quick_read_barrier_mark_reg28(mirror::Object*);
69extern "C" mirror::Object* art_quick_read_barrier_mark_reg29(mirror::Object*);
70
Andreas Gampe3cfa4d02015-10-06 17:04:01 -070071void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) {
Andreas Gampec7ed09b2016-04-25 20:08:55 -070072 DefaultInitEntryPoints(jpoints, qpoints);
Stuart Monteithb95a5342014-03-12 13:32:32 +000073
74 // Cast
Serban Constantinescu9bd88b02015-04-22 16:24:46 +010075 qpoints->pInstanceofNonTrivial = artIsAssignableFromCode;
Stuart Monteithb95a5342014-03-12 13:32:32 +000076 qpoints->pCheckCast = art_quick_check_cast;
77
Stuart Monteithb95a5342014-03-12 13:32:32 +000078 // Math
Mathieu Chartier2cebb242015-04-21 16:50:40 -070079 // TODO null entrypoints not needed for ARM64 - generate inline.
Zheng Xu0210d112014-06-17 12:25:48 +080080 qpoints->pCmpgDouble = nullptr;
81 qpoints->pCmpgFloat = nullptr;
82 qpoints->pCmplDouble = nullptr;
83 qpoints->pCmplFloat = nullptr;
Serban Constantinescu9bd88b02015-04-22 16:24:46 +010084 qpoints->pFmod = fmod;
Zheng Xu0210d112014-06-17 12:25:48 +080085 qpoints->pL2d = nullptr;
Serban Constantinescu9bd88b02015-04-22 16:24:46 +010086 qpoints->pFmodf = fmodf;
Zheng Xu0210d112014-06-17 12:25:48 +080087 qpoints->pL2f = nullptr;
88 qpoints->pD2iz = nullptr;
89 qpoints->pF2iz = nullptr;
90 qpoints->pIdivmod = nullptr;
91 qpoints->pD2l = nullptr;
92 qpoints->pF2l = nullptr;
93 qpoints->pLdiv = nullptr;
94 qpoints->pLmod = nullptr;
95 qpoints->pLmul = nullptr;
96 qpoints->pShlLong = nullptr;
97 qpoints->pShrLong = nullptr;
98 qpoints->pUshrLong = nullptr;
Stuart Monteithb95a5342014-03-12 13:32:32 +000099
Anton Kirilov02fc24e2016-01-20 16:48:19 +0000100 // More math.
101 qpoints->pCos = cos;
102 qpoints->pSin = sin;
103 qpoints->pAcos = acos;
104 qpoints->pAsin = asin;
105 qpoints->pAtan = atan;
106 qpoints->pAtan2 = atan2;
107 qpoints->pCbrt = cbrt;
108 qpoints->pCosh = cosh;
109 qpoints->pExp = exp;
110 qpoints->pExpm1 = expm1;
111 qpoints->pHypot = hypot;
112 qpoints->pLog = log;
113 qpoints->pLog10 = log10;
114 qpoints->pNextAfter = nextafter;
115 qpoints->pSinh = sinh;
116 qpoints->pTan = tan;
117 qpoints->pTanh = tanh;
118
Stuart Monteithb95a5342014-03-12 13:32:32 +0000119 // Intrinsics
120 qpoints->pIndexOf = art_quick_indexof;
Scott Wakeling1f36f412016-04-21 11:13:45 +0100121 // The ARM64 StringCompareTo intrinsic does not call the runtime.
122 qpoints->pStringCompareTo = nullptr;
Serban Constantinescu9bd88b02015-04-22 16:24:46 +0100123 qpoints->pMemcpy = memcpy;
Stuart Monteithb95a5342014-03-12 13:32:32 +0000124
Roland Levillain0d5a2812015-11-13 10:07:31 +0000125 // Read barrier.
Hiroshi Yamauchi1cc71eb2015-05-07 10:47:27 -0700126 qpoints->pReadBarrierJni = ReadBarrierJni;
Roland Levillaind549c282016-07-25 12:49:15 +0100127 // ARM64 is the architecture with the largest number of core
128 // registers (32) that supports the read barrier configuration.
129 // Because registers 30 (LR) and 31 (SP/XZR) cannot be used to pass
130 // arguments, only define ReadBarrierMarkRegX entrypoints for the
131 // first 30 registers. This limitation is not a problem on other
132 // supported architectures (ARM, x86 and x86-64) either, as they
133 // have less core registers (resp. 16, 8 and 16). (We may have to
134 // revise that design choice if read barrier support is added for
135 // MIPS and/or MIPS64.)
Roland Levillain4359e612016-07-20 11:32:19 +0100136 qpoints->pReadBarrierMarkReg00 = art_quick_read_barrier_mark_reg00;
Roland Levillain02b75802016-07-13 11:54:35 +0100137 qpoints->pReadBarrierMarkReg01 = art_quick_read_barrier_mark_reg01;
138 qpoints->pReadBarrierMarkReg02 = art_quick_read_barrier_mark_reg02;
139 qpoints->pReadBarrierMarkReg03 = art_quick_read_barrier_mark_reg03;
140 qpoints->pReadBarrierMarkReg04 = art_quick_read_barrier_mark_reg04;
141 qpoints->pReadBarrierMarkReg05 = art_quick_read_barrier_mark_reg05;
142 qpoints->pReadBarrierMarkReg06 = art_quick_read_barrier_mark_reg06;
143 qpoints->pReadBarrierMarkReg07 = art_quick_read_barrier_mark_reg07;
144 qpoints->pReadBarrierMarkReg08 = art_quick_read_barrier_mark_reg08;
145 qpoints->pReadBarrierMarkReg09 = art_quick_read_barrier_mark_reg09;
146 qpoints->pReadBarrierMarkReg10 = art_quick_read_barrier_mark_reg10;
147 qpoints->pReadBarrierMarkReg11 = art_quick_read_barrier_mark_reg11;
148 qpoints->pReadBarrierMarkReg12 = art_quick_read_barrier_mark_reg12;
149 qpoints->pReadBarrierMarkReg13 = art_quick_read_barrier_mark_reg13;
150 qpoints->pReadBarrierMarkReg14 = art_quick_read_barrier_mark_reg14;
151 qpoints->pReadBarrierMarkReg15 = art_quick_read_barrier_mark_reg15;
152 qpoints->pReadBarrierMarkReg16 = art_quick_read_barrier_mark_reg16;
153 qpoints->pReadBarrierMarkReg17 = art_quick_read_barrier_mark_reg17;
154 qpoints->pReadBarrierMarkReg18 = art_quick_read_barrier_mark_reg18;
155 qpoints->pReadBarrierMarkReg19 = art_quick_read_barrier_mark_reg19;
156 qpoints->pReadBarrierMarkReg20 = art_quick_read_barrier_mark_reg20;
157 qpoints->pReadBarrierMarkReg21 = art_quick_read_barrier_mark_reg21;
158 qpoints->pReadBarrierMarkReg22 = art_quick_read_barrier_mark_reg22;
159 qpoints->pReadBarrierMarkReg23 = art_quick_read_barrier_mark_reg23;
160 qpoints->pReadBarrierMarkReg24 = art_quick_read_barrier_mark_reg24;
161 qpoints->pReadBarrierMarkReg25 = art_quick_read_barrier_mark_reg25;
162 qpoints->pReadBarrierMarkReg26 = art_quick_read_barrier_mark_reg26;
163 qpoints->pReadBarrierMarkReg27 = art_quick_read_barrier_mark_reg27;
164 qpoints->pReadBarrierMarkReg28 = art_quick_read_barrier_mark_reg28;
165 qpoints->pReadBarrierMarkReg29 = art_quick_read_barrier_mark_reg29;
Man Cao1aee9002015-07-14 22:31:42 -0700166 qpoints->pReadBarrierSlow = artReadBarrierSlow;
Roland Levillain0d5a2812015-11-13 10:07:31 +0000167 qpoints->pReadBarrierForRootSlow = artReadBarrierForRootSlow;
Stuart Monteithb95a5342014-03-12 13:32:32 +0000168};
169
170} // namespace art