blob: a0379053bc31a61aedbc254444183018aca5092a [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
Vladimir Marko3a21e382016-09-02 12:38:38 +010017#include <string.h>
18
Andreas Gampe1a5c4062015-01-15 12:10:47 -080019#include "atomic.h"
Andreas Gampe1a5c4062015-01-15 12:10:47 -080020#include "entrypoints/jni/jni_entrypoints.h"
21#include "entrypoints/quick/quick_alloc_entrypoints.h"
22#include "entrypoints/quick/quick_default_externs.h"
Andreas Gampec7ed09b2016-04-25 20:08:55 -070023#include "entrypoints/quick/quick_default_init_entrypoints.h"
Andreas Gampe1a5c4062015-01-15 12:10:47 -080024#include "entrypoints/quick/quick_entrypoints.h"
25#include "entrypoints/entrypoint_utils.h"
26#include "entrypoints/math_entrypoints.h"
27#include "entrypoints/runtime_asm_entrypoints.h"
28#include "interpreter/interpreter.h"
29
30namespace art {
31
32// Cast entrypoints.
Goran Jakovljevicd207b422016-07-21 14:21:46 +020033extern "C" size_t artIsAssignableFromCode(const mirror::Class* klass,
34 const mirror::Class* ref_class);
Andreas Gampe1a5c4062015-01-15 12:10:47 -080035// Math entrypoints.
36extern int32_t CmpgDouble(double a, double b);
37extern int32_t CmplDouble(double a, double b);
38extern int32_t CmpgFloat(float a, float b);
39extern int32_t CmplFloat(float a, float b);
40extern "C" int64_t artLmul(int64_t a, int64_t b);
41extern "C" int64_t artLdiv(int64_t a, int64_t b);
42extern "C" int64_t artLmod(int64_t a, int64_t b);
43
44// Math conversions.
45extern "C" int32_t __fixsfsi(float op1); // FLOAT_TO_INT
46extern "C" int32_t __fixdfsi(double op1); // DOUBLE_TO_INT
47extern "C" float __floatdisf(int64_t op1); // LONG_TO_FLOAT
48extern "C" double __floatdidf(int64_t op1); // LONG_TO_DOUBLE
49extern "C" int64_t __fixsfdi(float op1); // FLOAT_TO_LONG
50extern "C" int64_t __fixdfdi(double op1); // DOUBLE_TO_LONG
51
52// Single-precision FP arithmetics.
53extern "C" float fmodf(float a, float b); // REM_FLOAT[_2ADDR]
54
55// Double-precision FP arithmetics.
56extern "C" double fmod(double a, double b); // REM_DOUBLE[_2ADDR]
57
58// Long long arithmetics - REM_LONG[_2ADDR] and DIV_LONG[_2ADDR]
59extern "C" int64_t __divdi3(int64_t, int64_t);
60extern "C" int64_t __moddi3(int64_t, int64_t);
61
Andreas Gampe3cfa4d02015-10-06 17:04:01 -070062void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) {
Andreas Gampec7ed09b2016-04-25 20:08:55 -070063 DefaultInitEntryPoints(jpoints, qpoints);
Andreas Gampe1a5c4062015-01-15 12:10:47 -080064
65 // Cast
66 qpoints->pInstanceofNonTrivial = artIsAssignableFromCode;
67 qpoints->pCheckCast = art_quick_check_cast;
68
Andreas Gampe1a5c4062015-01-15 12:10:47 -080069 // Math
70 qpoints->pCmpgDouble = CmpgDouble;
71 qpoints->pCmpgFloat = CmpgFloat;
72 qpoints->pCmplDouble = CmplDouble;
73 qpoints->pCmplFloat = CmplFloat;
74 qpoints->pFmod = fmod;
75 qpoints->pL2d = art_l2d;
76 qpoints->pFmodf = fmodf;
77 qpoints->pL2f = art_l2f;
78 qpoints->pD2iz = art_d2i;
79 qpoints->pF2iz = art_f2i;
Mathieu Chartier2cebb242015-04-21 16:50:40 -070080 qpoints->pIdivmod = nullptr;
Andreas Gampe1a5c4062015-01-15 12:10:47 -080081 qpoints->pD2l = art_d2l;
82 qpoints->pF2l = art_f2l;
83 qpoints->pLdiv = artLdiv;
84 qpoints->pLmod = artLmod;
85 qpoints->pLmul = artLmul;
Mathieu Chartier2cebb242015-04-21 16:50:40 -070086 qpoints->pShlLong = nullptr;
87 qpoints->pShrLong = nullptr;
88 qpoints->pUshrLong = nullptr;
Andreas Gampe1a5c4062015-01-15 12:10:47 -080089
90 // Intrinsics
91 qpoints->pIndexOf = art_quick_indexof;
92 qpoints->pStringCompareTo = art_quick_string_compareto;
93 qpoints->pMemcpy = memcpy;
94
Andreas Gampe1a5c4062015-01-15 12:10:47 -080095 // TODO - use lld/scd instructions for Mips64
96 // Atomic 64-bit load/store
97 qpoints->pA64Load = QuasiAtomic::Read64;
98 qpoints->pA64Store = QuasiAtomic::Write64;
Hiroshi Yamauchi1cc71eb2015-05-07 10:47:27 -070099
Roland Levillain0d5a2812015-11-13 10:07:31 +0000100 // Read barrier.
Hiroshi Yamauchi1cc71eb2015-05-07 10:47:27 -0700101 qpoints->pReadBarrierJni = ReadBarrierJni;
Roland Levillain02b75802016-07-13 11:54:35 +0100102 // Read barriers (and these entry points in particular) are not
103 // supported in the compiler on MIPS64.
104 qpoints->pReadBarrierMarkReg00 = nullptr;
105 qpoints->pReadBarrierMarkReg01 = nullptr;
106 qpoints->pReadBarrierMarkReg02 = nullptr;
107 qpoints->pReadBarrierMarkReg03 = nullptr;
108 qpoints->pReadBarrierMarkReg04 = nullptr;
109 qpoints->pReadBarrierMarkReg05 = nullptr;
110 qpoints->pReadBarrierMarkReg06 = nullptr;
111 qpoints->pReadBarrierMarkReg07 = nullptr;
112 qpoints->pReadBarrierMarkReg08 = nullptr;
113 qpoints->pReadBarrierMarkReg09 = nullptr;
114 qpoints->pReadBarrierMarkReg10 = nullptr;
115 qpoints->pReadBarrierMarkReg11 = nullptr;
116 qpoints->pReadBarrierMarkReg12 = nullptr;
117 qpoints->pReadBarrierMarkReg13 = nullptr;
118 qpoints->pReadBarrierMarkReg14 = nullptr;
119 qpoints->pReadBarrierMarkReg15 = nullptr;
120 qpoints->pReadBarrierMarkReg16 = nullptr;
121 qpoints->pReadBarrierMarkReg17 = nullptr;
122 qpoints->pReadBarrierMarkReg18 = nullptr;
123 qpoints->pReadBarrierMarkReg19 = nullptr;
124 qpoints->pReadBarrierMarkReg20 = nullptr;
125 qpoints->pReadBarrierMarkReg21 = nullptr;
126 qpoints->pReadBarrierMarkReg22 = nullptr;
127 qpoints->pReadBarrierMarkReg23 = nullptr;
128 qpoints->pReadBarrierMarkReg24 = nullptr;
129 qpoints->pReadBarrierMarkReg25 = nullptr;
130 qpoints->pReadBarrierMarkReg26 = nullptr;
131 qpoints->pReadBarrierMarkReg27 = nullptr;
132 qpoints->pReadBarrierMarkReg28 = nullptr;
133 qpoints->pReadBarrierMarkReg29 = nullptr;
Man Cao1aee9002015-07-14 22:31:42 -0700134 qpoints->pReadBarrierSlow = artReadBarrierSlow;
Roland Levillain0d5a2812015-11-13 10:07:31 +0000135 qpoints->pReadBarrierForRootSlow = artReadBarrierForRootSlow;
Andreas Gampe1a5c4062015-01-15 12:10:47 -0800136};
137
138} // namespace art