• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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"
18 #include "entrypoints/jni/jni_entrypoints.h"
19 #include "entrypoints/quick/quick_alloc_entrypoints.h"
20 #include "entrypoints/quick/quick_default_externs.h"
21 #include "entrypoints/quick/quick_default_init_entrypoints.h"
22 #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 
28 namespace art {
29 
30 // Cast entrypoints.
31 extern "C" uint32_t artIsAssignableFromCode(const mirror::Class* klass,
32                                             const mirror::Class* ref_class);
33 // Math entrypoints.
34 extern int32_t CmpgDouble(double a, double b);
35 extern int32_t CmplDouble(double a, double b);
36 extern int32_t CmpgFloat(float a, float b);
37 extern int32_t CmplFloat(float a, float b);
38 extern "C" int64_t artLmul(int64_t a, int64_t b);
39 extern "C" int64_t artLdiv(int64_t a, int64_t b);
40 extern "C" int64_t artLmod(int64_t a, int64_t b);
41 
42 // Math conversions.
43 extern "C" int32_t __fixsfsi(float op1);      // FLOAT_TO_INT
44 extern "C" int32_t __fixdfsi(double op1);     // DOUBLE_TO_INT
45 extern "C" float __floatdisf(int64_t op1);    // LONG_TO_FLOAT
46 extern "C" double __floatdidf(int64_t op1);   // LONG_TO_DOUBLE
47 extern "C" int64_t __fixsfdi(float op1);      // FLOAT_TO_LONG
48 extern "C" int64_t __fixdfdi(double op1);     // DOUBLE_TO_LONG
49 
50 // Single-precision FP arithmetics.
51 extern "C" float fmodf(float a, float b);      // REM_FLOAT[_2ADDR]
52 
53 // Double-precision FP arithmetics.
54 extern "C" double fmod(double a, double b);     // REM_DOUBLE[_2ADDR]
55 
56 // Long long arithmetics - REM_LONG[_2ADDR] and DIV_LONG[_2ADDR]
57 extern "C" int64_t __divdi3(int64_t, int64_t);
58 extern "C" int64_t __moddi3(int64_t, int64_t);
59 
InitEntryPoints(JniEntryPoints * jpoints,QuickEntryPoints * qpoints)60 void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) {
61   DefaultInitEntryPoints(jpoints, qpoints);
62 
63   // Cast
64   qpoints->pInstanceofNonTrivial = artIsAssignableFromCode;
65   qpoints->pCheckCast = art_quick_check_cast;
66 
67   // 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;
78   qpoints->pIdivmod = nullptr;
79   qpoints->pD2l = art_d2l;
80   qpoints->pF2l = art_f2l;
81   qpoints->pLdiv = artLdiv;
82   qpoints->pLmod = artLmod;
83   qpoints->pLmul = artLmul;
84   qpoints->pShlLong = nullptr;
85   qpoints->pShrLong = nullptr;
86   qpoints->pUshrLong = nullptr;
87 
88   // Intrinsics
89   qpoints->pIndexOf = art_quick_indexof;
90   qpoints->pStringCompareTo = art_quick_string_compareto;
91   qpoints->pMemcpy = memcpy;
92 
93   // TODO - use lld/scd instructions for Mips64
94   // Atomic 64-bit load/store
95   qpoints->pA64Load = QuasiAtomic::Read64;
96   qpoints->pA64Store = QuasiAtomic::Write64;
97 
98   // Read barrier.
99   qpoints->pReadBarrierJni = ReadBarrierJni;
100   qpoints->pReadBarrierMark = artReadBarrierMark;
101   qpoints->pReadBarrierSlow = artReadBarrierSlow;
102   qpoints->pReadBarrierForRootSlow = artReadBarrierForRootSlow;
103 };
104 
105 }  // namespace art
106