blob: b19aa017121befd70c4b0829e28cd10c3fb7e6dd [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
17#include "atomic.h"
Andreas Gampe1a5c4062015-01-15 12:10:47 -080018#include "entrypoints/jni/jni_entrypoints.h"
19#include "entrypoints/quick/quick_alloc_entrypoints.h"
20#include "entrypoints/quick/quick_default_externs.h"
Andreas Gampec7ed09b2016-04-25 20:08:55 -070021#include "entrypoints/quick/quick_default_init_entrypoints.h"
Andreas Gampe1a5c4062015-01-15 12:10:47 -080022#include "entrypoints/quick/quick_entrypoints.h"
23#include "entrypoints/entrypoint_utils.h"
24#include "entrypoints/math_entrypoints.h"
25#include "entrypoints/runtime_asm_entrypoints.h"
26#include "interpreter/interpreter.h"
27
28namespace art {
29
30// Cast entrypoints.
31extern "C" uint32_t artIsAssignableFromCode(const mirror::Class* klass,
32 const mirror::Class* ref_class);
33// Math entrypoints.
34extern int32_t CmpgDouble(double a, double b);
35extern int32_t CmplDouble(double a, double b);
36extern int32_t CmpgFloat(float a, float b);
37extern int32_t CmplFloat(float a, float b);
38extern "C" int64_t artLmul(int64_t a, int64_t b);
39extern "C" int64_t artLdiv(int64_t a, int64_t b);
40extern "C" int64_t artLmod(int64_t a, int64_t b);
41
42// Math conversions.
43extern "C" int32_t __fixsfsi(float op1); // FLOAT_TO_INT
44extern "C" int32_t __fixdfsi(double op1); // DOUBLE_TO_INT
45extern "C" float __floatdisf(int64_t op1); // LONG_TO_FLOAT
46extern "C" double __floatdidf(int64_t op1); // LONG_TO_DOUBLE
47extern "C" int64_t __fixsfdi(float op1); // FLOAT_TO_LONG
48extern "C" int64_t __fixdfdi(double op1); // DOUBLE_TO_LONG
49
50// Single-precision FP arithmetics.
51extern "C" float fmodf(float a, float b); // REM_FLOAT[_2ADDR]
52
53// Double-precision FP arithmetics.
54extern "C" double fmod(double a, double b); // REM_DOUBLE[_2ADDR]
55
56// Long long arithmetics - REM_LONG[_2ADDR] and DIV_LONG[_2ADDR]
57extern "C" int64_t __divdi3(int64_t, int64_t);
58extern "C" int64_t __moddi3(int64_t, int64_t);
59
Andreas Gampe3cfa4d02015-10-06 17:04:01 -070060void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) {
Andreas Gampec7ed09b2016-04-25 20:08:55 -070061 DefaultInitEntryPoints(jpoints, qpoints);
Andreas Gampe1a5c4062015-01-15 12:10:47 -080062
63 // Cast
64 qpoints->pInstanceofNonTrivial = artIsAssignableFromCode;
65 qpoints->pCheckCast = art_quick_check_cast;
66
Andreas Gampe1a5c4062015-01-15 12:10:47 -080067 // Math
68 qpoints->pCmpgDouble = CmpgDouble;
69 qpoints->pCmpgFloat = CmpgFloat;
70 qpoints->pCmplDouble = CmplDouble;
71 qpoints->pCmplFloat = CmplFloat;
72 qpoints->pFmod = fmod;
73 qpoints->pL2d = art_l2d;
74 qpoints->pFmodf = fmodf;
75 qpoints->pL2f = art_l2f;
76 qpoints->pD2iz = art_d2i;
77 qpoints->pF2iz = art_f2i;
Mathieu Chartier2cebb242015-04-21 16:50:40 -070078 qpoints->pIdivmod = nullptr;
Andreas Gampe1a5c4062015-01-15 12:10:47 -080079 qpoints->pD2l = art_d2l;
80 qpoints->pF2l = art_f2l;
81 qpoints->pLdiv = artLdiv;
82 qpoints->pLmod = artLmod;
83 qpoints->pLmul = artLmul;
Mathieu Chartier2cebb242015-04-21 16:50:40 -070084 qpoints->pShlLong = nullptr;
85 qpoints->pShrLong = nullptr;
86 qpoints->pUshrLong = nullptr;
Andreas Gampe1a5c4062015-01-15 12:10:47 -080087
88 // Intrinsics
89 qpoints->pIndexOf = art_quick_indexof;
90 qpoints->pStringCompareTo = art_quick_string_compareto;
91 qpoints->pMemcpy = memcpy;
92
Andreas Gampe1a5c4062015-01-15 12:10:47 -080093 // TODO - use lld/scd instructions for Mips64
94 // Atomic 64-bit load/store
95 qpoints->pA64Load = QuasiAtomic::Read64;
96 qpoints->pA64Store = QuasiAtomic::Write64;
Hiroshi Yamauchi1cc71eb2015-05-07 10:47:27 -070097
Roland Levillain0d5a2812015-11-13 10:07:31 +000098 // Read barrier.
Hiroshi Yamauchi1cc71eb2015-05-07 10:47:27 -070099 qpoints->pReadBarrierJni = ReadBarrierJni;
Roland Levillain02b75802016-07-13 11:54:35 +0100100 // Read barriers (and these entry points in particular) are not
101 // supported in the compiler on MIPS64.
102 qpoints->pReadBarrierMarkReg00 = nullptr;
103 qpoints->pReadBarrierMarkReg01 = nullptr;
104 qpoints->pReadBarrierMarkReg02 = nullptr;
105 qpoints->pReadBarrierMarkReg03 = nullptr;
106 qpoints->pReadBarrierMarkReg04 = nullptr;
107 qpoints->pReadBarrierMarkReg05 = nullptr;
108 qpoints->pReadBarrierMarkReg06 = nullptr;
109 qpoints->pReadBarrierMarkReg07 = nullptr;
110 qpoints->pReadBarrierMarkReg08 = nullptr;
111 qpoints->pReadBarrierMarkReg09 = nullptr;
112 qpoints->pReadBarrierMarkReg10 = nullptr;
113 qpoints->pReadBarrierMarkReg11 = nullptr;
114 qpoints->pReadBarrierMarkReg12 = nullptr;
115 qpoints->pReadBarrierMarkReg13 = nullptr;
116 qpoints->pReadBarrierMarkReg14 = nullptr;
117 qpoints->pReadBarrierMarkReg15 = nullptr;
118 qpoints->pReadBarrierMarkReg16 = nullptr;
119 qpoints->pReadBarrierMarkReg17 = nullptr;
120 qpoints->pReadBarrierMarkReg18 = nullptr;
121 qpoints->pReadBarrierMarkReg19 = nullptr;
122 qpoints->pReadBarrierMarkReg20 = nullptr;
123 qpoints->pReadBarrierMarkReg21 = nullptr;
124 qpoints->pReadBarrierMarkReg22 = nullptr;
125 qpoints->pReadBarrierMarkReg23 = nullptr;
126 qpoints->pReadBarrierMarkReg24 = nullptr;
127 qpoints->pReadBarrierMarkReg25 = nullptr;
128 qpoints->pReadBarrierMarkReg26 = nullptr;
129 qpoints->pReadBarrierMarkReg27 = nullptr;
130 qpoints->pReadBarrierMarkReg28 = nullptr;
131 qpoints->pReadBarrierMarkReg29 = nullptr;
132 qpoints->pReadBarrierMarkReg30 = nullptr;
133 qpoints->pReadBarrierMarkReg31 = 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