blob: 4c68862c7f7b7ef1b1367b15e378fc5a0cfe006c [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
Ian Rogers7655f292013-07-29 11:07:13 -070033
Zheng Xu5667fdb2014-10-23 18:29:55 +080034// Used by soft float.
Ian Rogers7655f292013-07-29 11:07:13 -070035// Single-precision FP arithmetics.
Zheng Xu5667fdb2014-10-23 18:29:55 +080036extern "C" float fmodf(float a, float b); // REM_FLOAT[_2ADDR]
Ian Rogers7655f292013-07-29 11:07:13 -070037// Double-precision FP arithmetics.
Zheng Xu5667fdb2014-10-23 18:29:55 +080038extern "C" double fmod(double a, double b); // REM_DOUBLE[_2ADDR]
39
40// Used by hard float.
Zheng Xu5667fdb2014-10-23 18:29:55 +080041extern "C" float art_quick_fmodf(float a, float b); // REM_FLOAT[_2ADDR]
42extern "C" double art_quick_fmod(double a, double b); // REM_DOUBLE[_2ADDR]
Ian Rogers7655f292013-07-29 11:07:13 -070043
44// Integer arithmetics.
45extern "C" int __aeabi_idivmod(int32_t, int32_t); // [DIV|REM]_INT[_2ADDR|_LIT8|_LIT16]
46
47// Long long arithmetics - REM_LONG[_2ADDR] and DIV_LONG[_2ADDR]
48extern "C" int64_t __aeabi_ldivmod(int64_t, int64_t);
Andreas Gampe277ccbd2014-11-03 21:36:10 -080049
Andreas Gampe3cfa4d02015-10-06 17:04:01 -070050void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) {
Andreas Gampec7ed09b2016-04-25 20:08:55 -070051 DefaultInitEntryPoints(jpoints, qpoints);
Ian Rogers7655f292013-07-29 11:07:13 -070052
53 // Cast
Ian Rogers848871b2013-08-05 10:56:33 -070054 qpoints->pInstanceofNonTrivial = artIsAssignableFromCode;
Ian Rogers848871b2013-08-05 10:56:33 -070055 qpoints->pCheckCast = art_quick_check_cast;
Ian Rogers7655f292013-07-29 11:07:13 -070056
Ian Rogers7655f292013-07-29 11:07:13 -070057 // Math
Ian Rogers7655f292013-07-29 11:07:13 -070058 qpoints->pIdivmod = __aeabi_idivmod;
Ian Rogers7655f292013-07-29 11:07:13 -070059 qpoints->pLdiv = __aeabi_ldivmod;
Ian Rogersa9a82542013-10-04 11:17:26 -070060 qpoints->pLmod = __aeabi_ldivmod; // result returned in r2:r3
Ian Rogers7655f292013-07-29 11:07:13 -070061 qpoints->pLmul = art_quick_mul_long;
62 qpoints->pShlLong = art_quick_shl_long;
63 qpoints->pShrLong = art_quick_shr_long;
64 qpoints->pUshrLong = art_quick_ushr_long;
Zheng Xu5667fdb2014-10-23 18:29:55 +080065 if (kArm32QuickCodeUseSoftFloat) {
66 qpoints->pFmod = fmod;
67 qpoints->pFmodf = fmodf;
68 qpoints->pD2l = art_d2l;
69 qpoints->pF2l = art_f2l;
Roland Levillain5b3ee562015-04-14 16:02:41 +010070 qpoints->pL2f = art_l2f;
Zheng Xu5667fdb2014-10-23 18:29:55 +080071 } else {
72 qpoints->pFmod = art_quick_fmod;
73 qpoints->pFmodf = art_quick_fmodf;
74 qpoints->pD2l = art_quick_d2l;
75 qpoints->pF2l = art_quick_f2l;
Roland Levillain5b3ee562015-04-14 16:02:41 +010076 qpoints->pL2f = art_quick_l2f;
Zheng Xu5667fdb2014-10-23 18:29:55 +080077 }
Ian Rogers7655f292013-07-29 11:07:13 -070078
Anton Kirilovd70dc9d2016-02-04 14:59:04 +000079 // More math.
80 qpoints->pCos = cos;
81 qpoints->pSin = sin;
82 qpoints->pAcos = acos;
83 qpoints->pAsin = asin;
84 qpoints->pAtan = atan;
85 qpoints->pAtan2 = atan2;
86 qpoints->pCbrt = cbrt;
87 qpoints->pCosh = cosh;
88 qpoints->pExp = exp;
89 qpoints->pExpm1 = expm1;
90 qpoints->pHypot = hypot;
91 qpoints->pLog = log;
92 qpoints->pLog10 = log10;
93 qpoints->pNextAfter = nextafter;
94 qpoints->pSinh = sinh;
95 qpoints->pTan = tan;
96 qpoints->pTanh = tanh;
97
Ian Rogers7655f292013-07-29 11:07:13 -070098 // Intrinsics
99 qpoints->pIndexOf = art_quick_indexof;
Scott Wakelingc25cbf12016-04-18 09:00:11 +0100100 // The ARM StringCompareTo intrinsic does not call the runtime.
101 qpoints->pStringCompareTo = nullptr;
Ian Rogers7655f292013-07-29 11:07:13 -0700102 qpoints->pMemcpy = memcpy;
103
Roland Levillain0d5a2812015-11-13 10:07:31 +0000104 // Read barrier.
Hiroshi Yamauchi1cc71eb2015-05-07 10:47:27 -0700105 qpoints->pReadBarrierJni = ReadBarrierJni;
Roland Levillain7c1559a2015-12-15 10:55:36 +0000106 qpoints->pReadBarrierMark = artReadBarrierMark;
Man Cao1aee9002015-07-14 22:31:42 -0700107 qpoints->pReadBarrierSlow = artReadBarrierSlow;
Roland Levillain0d5a2812015-11-13 10:07:31 +0000108 qpoints->pReadBarrierForRootSlow = artReadBarrierForRootSlow;
Andreas Gampec8ccf682014-09-29 20:07:43 -0700109}
Ian Rogers7655f292013-07-29 11:07:13 -0700110
111} // namespace art