Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 1 | /* |
| 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 Yang | 98d1cc8 | 2014-05-15 17:02:16 -0700 | [diff] [blame] | 17 | #include "entrypoints/jni/jni_entrypoints.h" |
Mathieu Chartier | d889178 | 2014-03-02 13:28:37 -0800 | [diff] [blame] | 18 | #include "entrypoints/quick/quick_alloc_entrypoints.h" |
Andreas Gampe | e179456 | 2014-11-04 22:26:32 -0800 | [diff] [blame] | 19 | #include "entrypoints/quick/quick_default_externs.h" |
Andreas Gampe | c7ed09b | 2016-04-25 20:08:55 -0700 | [diff] [blame] | 20 | #include "entrypoints/quick/quick_default_init_entrypoints.h" |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 21 | #include "entrypoints/quick/quick_entrypoints.h" |
| 22 | #include "entrypoints/entrypoint_utils.h" |
| 23 | #include "entrypoints/math_entrypoints.h" |
Andreas Gampe | e179456 | 2014-11-04 22:26:32 -0800 | [diff] [blame] | 24 | #include "entrypoints/runtime_asm_entrypoints.h" |
Ian Rogers | 6f3dbba | 2014-10-14 17:41:57 -0700 | [diff] [blame] | 25 | #include "interpreter/interpreter.h" |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 26 | |
| 27 | namespace art { |
| 28 | |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 29 | // Cast entrypoints. |
| 30 | extern "C" uint32_t artIsAssignableFromCode(const mirror::Class* klass, |
| 31 | const mirror::Class* ref_class); |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 32 | |
Roland Levillain | 02b7580 | 2016-07-13 11:54:35 +0100 | [diff] [blame^] | 33 | // Read barrier entrypoints. |
| 34 | // art_quick_read_barrier_mark_regX uses an non-standard calling |
| 35 | // convention: it expects its input in register X and returns its |
| 36 | // result in that same register. |
| 37 | extern "C" mirror::Object* art_quick_read_barrier_mark_reg01(mirror::Object*); |
| 38 | extern "C" mirror::Object* art_quick_read_barrier_mark_reg02(mirror::Object*); |
| 39 | extern "C" mirror::Object* art_quick_read_barrier_mark_reg03(mirror::Object*); |
| 40 | extern "C" mirror::Object* art_quick_read_barrier_mark_reg04(mirror::Object*); |
| 41 | extern "C" mirror::Object* art_quick_read_barrier_mark_reg05(mirror::Object*); |
| 42 | extern "C" mirror::Object* art_quick_read_barrier_mark_reg06(mirror::Object*); |
| 43 | extern "C" mirror::Object* art_quick_read_barrier_mark_reg07(mirror::Object*); |
| 44 | extern "C" mirror::Object* art_quick_read_barrier_mark_reg08(mirror::Object*); |
| 45 | extern "C" mirror::Object* art_quick_read_barrier_mark_reg09(mirror::Object*); |
| 46 | extern "C" mirror::Object* art_quick_read_barrier_mark_reg10(mirror::Object*); |
| 47 | extern "C" mirror::Object* art_quick_read_barrier_mark_reg11(mirror::Object*); |
| 48 | extern "C" mirror::Object* art_quick_read_barrier_mark_reg12(mirror::Object*); |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 49 | |
Zheng Xu | 5667fdb | 2014-10-23 18:29:55 +0800 | [diff] [blame] | 50 | // Used by soft float. |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 51 | // Single-precision FP arithmetics. |
Zheng Xu | 5667fdb | 2014-10-23 18:29:55 +0800 | [diff] [blame] | 52 | extern "C" float fmodf(float a, float b); // REM_FLOAT[_2ADDR] |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 53 | // Double-precision FP arithmetics. |
Zheng Xu | 5667fdb | 2014-10-23 18:29:55 +0800 | [diff] [blame] | 54 | extern "C" double fmod(double a, double b); // REM_DOUBLE[_2ADDR] |
| 55 | |
| 56 | // Used by hard float. |
Zheng Xu | 5667fdb | 2014-10-23 18:29:55 +0800 | [diff] [blame] | 57 | extern "C" float art_quick_fmodf(float a, float b); // REM_FLOAT[_2ADDR] |
| 58 | extern "C" double art_quick_fmod(double a, double b); // REM_DOUBLE[_2ADDR] |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 59 | |
| 60 | // Integer arithmetics. |
| 61 | extern "C" int __aeabi_idivmod(int32_t, int32_t); // [DIV|REM]_INT[_2ADDR|_LIT8|_LIT16] |
| 62 | |
| 63 | // Long long arithmetics - REM_LONG[_2ADDR] and DIV_LONG[_2ADDR] |
| 64 | extern "C" int64_t __aeabi_ldivmod(int64_t, int64_t); |
Andreas Gampe | 277ccbd | 2014-11-03 21:36:10 -0800 | [diff] [blame] | 65 | |
Andreas Gampe | 3cfa4d0 | 2015-10-06 17:04:01 -0700 | [diff] [blame] | 66 | void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) { |
Andreas Gampe | c7ed09b | 2016-04-25 20:08:55 -0700 | [diff] [blame] | 67 | DefaultInitEntryPoints(jpoints, qpoints); |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 68 | |
| 69 | // Cast |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 70 | qpoints->pInstanceofNonTrivial = artIsAssignableFromCode; |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 71 | qpoints->pCheckCast = art_quick_check_cast; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 72 | |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 73 | // Math |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 74 | qpoints->pIdivmod = __aeabi_idivmod; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 75 | qpoints->pLdiv = __aeabi_ldivmod; |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 76 | qpoints->pLmod = __aeabi_ldivmod; // result returned in r2:r3 |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 77 | qpoints->pLmul = art_quick_mul_long; |
| 78 | qpoints->pShlLong = art_quick_shl_long; |
| 79 | qpoints->pShrLong = art_quick_shr_long; |
| 80 | qpoints->pUshrLong = art_quick_ushr_long; |
Zheng Xu | 5667fdb | 2014-10-23 18:29:55 +0800 | [diff] [blame] | 81 | if (kArm32QuickCodeUseSoftFloat) { |
| 82 | qpoints->pFmod = fmod; |
| 83 | qpoints->pFmodf = fmodf; |
| 84 | qpoints->pD2l = art_d2l; |
| 85 | qpoints->pF2l = art_f2l; |
Roland Levillain | 5b3ee56 | 2015-04-14 16:02:41 +0100 | [diff] [blame] | 86 | qpoints->pL2f = art_l2f; |
Zheng Xu | 5667fdb | 2014-10-23 18:29:55 +0800 | [diff] [blame] | 87 | } else { |
| 88 | qpoints->pFmod = art_quick_fmod; |
| 89 | qpoints->pFmodf = art_quick_fmodf; |
| 90 | qpoints->pD2l = art_quick_d2l; |
| 91 | qpoints->pF2l = art_quick_f2l; |
Roland Levillain | 5b3ee56 | 2015-04-14 16:02:41 +0100 | [diff] [blame] | 92 | qpoints->pL2f = art_quick_l2f; |
Zheng Xu | 5667fdb | 2014-10-23 18:29:55 +0800 | [diff] [blame] | 93 | } |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 94 | |
Anton Kirilov | d70dc9d | 2016-02-04 14:59:04 +0000 | [diff] [blame] | 95 | // More math. |
| 96 | qpoints->pCos = cos; |
| 97 | qpoints->pSin = sin; |
| 98 | qpoints->pAcos = acos; |
| 99 | qpoints->pAsin = asin; |
| 100 | qpoints->pAtan = atan; |
| 101 | qpoints->pAtan2 = atan2; |
| 102 | qpoints->pCbrt = cbrt; |
| 103 | qpoints->pCosh = cosh; |
| 104 | qpoints->pExp = exp; |
| 105 | qpoints->pExpm1 = expm1; |
| 106 | qpoints->pHypot = hypot; |
| 107 | qpoints->pLog = log; |
| 108 | qpoints->pLog10 = log10; |
| 109 | qpoints->pNextAfter = nextafter; |
| 110 | qpoints->pSinh = sinh; |
| 111 | qpoints->pTan = tan; |
| 112 | qpoints->pTanh = tanh; |
| 113 | |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 114 | // Intrinsics |
| 115 | qpoints->pIndexOf = art_quick_indexof; |
Scott Wakeling | c25cbf1 | 2016-04-18 09:00:11 +0100 | [diff] [blame] | 116 | // The ARM StringCompareTo intrinsic does not call the runtime. |
| 117 | qpoints->pStringCompareTo = nullptr; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 118 | qpoints->pMemcpy = memcpy; |
| 119 | |
Roland Levillain | 0d5a281 | 2015-11-13 10:07:31 +0000 | [diff] [blame] | 120 | // Read barrier. |
Hiroshi Yamauchi | 1cc71eb | 2015-05-07 10:47:27 -0700 | [diff] [blame] | 121 | qpoints->pReadBarrierJni = ReadBarrierJni; |
Roland Levillain | 02b7580 | 2016-07-13 11:54:35 +0100 | [diff] [blame^] | 122 | qpoints->pReadBarrierMarkReg00 = artReadBarrierMark; |
| 123 | qpoints->pReadBarrierMarkReg01 = art_quick_read_barrier_mark_reg01; |
| 124 | qpoints->pReadBarrierMarkReg02 = art_quick_read_barrier_mark_reg02; |
| 125 | qpoints->pReadBarrierMarkReg03 = art_quick_read_barrier_mark_reg03; |
| 126 | qpoints->pReadBarrierMarkReg04 = art_quick_read_barrier_mark_reg04; |
| 127 | qpoints->pReadBarrierMarkReg05 = art_quick_read_barrier_mark_reg05; |
| 128 | qpoints->pReadBarrierMarkReg06 = art_quick_read_barrier_mark_reg06; |
| 129 | qpoints->pReadBarrierMarkReg07 = art_quick_read_barrier_mark_reg07; |
| 130 | qpoints->pReadBarrierMarkReg08 = art_quick_read_barrier_mark_reg08; |
| 131 | qpoints->pReadBarrierMarkReg09 = art_quick_read_barrier_mark_reg09; |
| 132 | qpoints->pReadBarrierMarkReg10 = art_quick_read_barrier_mark_reg10; |
| 133 | qpoints->pReadBarrierMarkReg11 = art_quick_read_barrier_mark_reg11; |
| 134 | qpoints->pReadBarrierMarkReg12 = art_quick_read_barrier_mark_reg12; |
| 135 | qpoints->pReadBarrierMarkReg13 = nullptr; // Cannot use register 13 (SP) to pass arguments. |
| 136 | qpoints->pReadBarrierMarkReg14 = nullptr; // Cannot use register 14 (LR) to pass arguments. |
| 137 | qpoints->pReadBarrierMarkReg15 = nullptr; // Cannot use register 15 (PC) to pass arguments. |
| 138 | // ARM has only 16 core registers. |
| 139 | qpoints->pReadBarrierMarkReg16 = nullptr; |
| 140 | qpoints->pReadBarrierMarkReg17 = nullptr; |
| 141 | qpoints->pReadBarrierMarkReg18 = nullptr; |
| 142 | qpoints->pReadBarrierMarkReg19 = nullptr; |
| 143 | qpoints->pReadBarrierMarkReg20 = nullptr; |
| 144 | qpoints->pReadBarrierMarkReg21 = nullptr; |
| 145 | qpoints->pReadBarrierMarkReg22 = nullptr; |
| 146 | qpoints->pReadBarrierMarkReg23 = nullptr; |
| 147 | qpoints->pReadBarrierMarkReg24 = nullptr; |
| 148 | qpoints->pReadBarrierMarkReg25 = nullptr; |
| 149 | qpoints->pReadBarrierMarkReg26 = nullptr; |
| 150 | qpoints->pReadBarrierMarkReg27 = nullptr; |
| 151 | qpoints->pReadBarrierMarkReg28 = nullptr; |
| 152 | qpoints->pReadBarrierMarkReg29 = nullptr; |
| 153 | qpoints->pReadBarrierMarkReg30 = nullptr; |
| 154 | qpoints->pReadBarrierMarkReg31 = nullptr; |
Man Cao | 1aee900 | 2015-07-14 22:31:42 -0700 | [diff] [blame] | 155 | qpoints->pReadBarrierSlow = artReadBarrierSlow; |
Roland Levillain | 0d5a281 | 2015-11-13 10:07:31 +0000 | [diff] [blame] | 156 | qpoints->pReadBarrierForRootSlow = artReadBarrierForRootSlow; |
Andreas Gampe | c8ccf68 | 2014-09-29 20:07:43 -0700 | [diff] [blame] | 157 | } |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 158 | |
| 159 | } // namespace art |