Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 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 | |
Vladimir Marko | 3a21e38 | 2016-09-02 12:38:38 +0100 | [diff] [blame] | 17 | #include <string.h> |
| 18 | |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 19 | #include "atomic.h" |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 20 | #include "entrypoints/jni/jni_entrypoints.h" |
| 21 | #include "entrypoints/quick/quick_alloc_entrypoints.h" |
| 22 | #include "entrypoints/quick/quick_default_externs.h" |
Andreas Gampe | c7ed09b | 2016-04-25 20:08:55 -0700 | [diff] [blame] | 23 | #include "entrypoints/quick/quick_default_init_entrypoints.h" |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 24 | #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 | |
| 30 | namespace art { |
| 31 | |
| 32 | // Cast entrypoints. |
Goran Jakovljevic | d207b42 | 2016-07-21 14:21:46 +0200 | [diff] [blame] | 33 | extern "C" size_t artIsAssignableFromCode(const mirror::Class* klass, |
| 34 | const mirror::Class* ref_class); |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 35 | // Math entrypoints. |
| 36 | extern int32_t CmpgDouble(double a, double b); |
| 37 | extern int32_t CmplDouble(double a, double b); |
| 38 | extern int32_t CmpgFloat(float a, float b); |
| 39 | extern int32_t CmplFloat(float a, float b); |
| 40 | extern "C" int64_t artLmul(int64_t a, int64_t b); |
| 41 | extern "C" int64_t artLdiv(int64_t a, int64_t b); |
| 42 | extern "C" int64_t artLmod(int64_t a, int64_t b); |
| 43 | |
| 44 | // Math conversions. |
| 45 | extern "C" int32_t __fixsfsi(float op1); // FLOAT_TO_INT |
| 46 | extern "C" int32_t __fixdfsi(double op1); // DOUBLE_TO_INT |
| 47 | extern "C" float __floatdisf(int64_t op1); // LONG_TO_FLOAT |
| 48 | extern "C" double __floatdidf(int64_t op1); // LONG_TO_DOUBLE |
| 49 | extern "C" int64_t __fixsfdi(float op1); // FLOAT_TO_LONG |
| 50 | extern "C" int64_t __fixdfdi(double op1); // DOUBLE_TO_LONG |
| 51 | |
| 52 | // Single-precision FP arithmetics. |
| 53 | extern "C" float fmodf(float a, float b); // REM_FLOAT[_2ADDR] |
| 54 | |
| 55 | // Double-precision FP arithmetics. |
| 56 | extern "C" double fmod(double a, double b); // REM_DOUBLE[_2ADDR] |
| 57 | |
| 58 | // Long long arithmetics - REM_LONG[_2ADDR] and DIV_LONG[_2ADDR] |
| 59 | extern "C" int64_t __divdi3(int64_t, int64_t); |
| 60 | extern "C" int64_t __moddi3(int64_t, int64_t); |
| 61 | |
Andreas Gampe | 3cfa4d0 | 2015-10-06 17:04:01 -0700 | [diff] [blame] | 62 | void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) { |
Andreas Gampe | c7ed09b | 2016-04-25 20:08:55 -0700 | [diff] [blame] | 63 | DefaultInitEntryPoints(jpoints, qpoints); |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 64 | |
| 65 | // Cast |
| 66 | qpoints->pInstanceofNonTrivial = artIsAssignableFromCode; |
| 67 | qpoints->pCheckCast = art_quick_check_cast; |
| 68 | |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 69 | // 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 Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 80 | qpoints->pIdivmod = nullptr; |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 81 | qpoints->pD2l = art_d2l; |
| 82 | qpoints->pF2l = art_f2l; |
| 83 | qpoints->pLdiv = artLdiv; |
| 84 | qpoints->pLmod = artLmod; |
| 85 | qpoints->pLmul = artLmul; |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 86 | qpoints->pShlLong = nullptr; |
| 87 | qpoints->pShrLong = nullptr; |
| 88 | qpoints->pUshrLong = nullptr; |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 89 | |
| 90 | // Intrinsics |
| 91 | qpoints->pIndexOf = art_quick_indexof; |
| 92 | qpoints->pStringCompareTo = art_quick_string_compareto; |
| 93 | qpoints->pMemcpy = memcpy; |
| 94 | |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 95 | // TODO - use lld/scd instructions for Mips64 |
| 96 | // Atomic 64-bit load/store |
| 97 | qpoints->pA64Load = QuasiAtomic::Read64; |
| 98 | qpoints->pA64Store = QuasiAtomic::Write64; |
Hiroshi Yamauchi | 1cc71eb | 2015-05-07 10:47:27 -0700 | [diff] [blame] | 99 | |
Roland Levillain | 0d5a281 | 2015-11-13 10:07:31 +0000 | [diff] [blame] | 100 | // Read barrier. |
Hiroshi Yamauchi | 1cc71eb | 2015-05-07 10:47:27 -0700 | [diff] [blame] | 101 | qpoints->pReadBarrierJni = ReadBarrierJni; |
Roland Levillain | 02b7580 | 2016-07-13 11:54:35 +0100 | [diff] [blame] | 102 | // 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 Cao | 1aee900 | 2015-07-14 22:31:42 -0700 | [diff] [blame] | 134 | qpoints->pReadBarrierSlow = artReadBarrierSlow; |
Roland Levillain | 0d5a281 | 2015-11-13 10:07:31 +0000 | [diff] [blame] | 135 | qpoints->pReadBarrierForRootSlow = artReadBarrierForRootSlow; |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 136 | }; |
| 137 | |
| 138 | } // namespace art |