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 | |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 33 | |
Zheng Xu | 5667fdb | 2014-10-23 18:29:55 +0800 | [diff] [blame] | 34 | // Used by soft float. |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 35 | // Single-precision FP arithmetics. |
Zheng Xu | 5667fdb | 2014-10-23 18:29:55 +0800 | [diff] [blame] | 36 | extern "C" float fmodf(float a, float b); // REM_FLOAT[_2ADDR] |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 37 | // Double-precision FP arithmetics. |
Zheng Xu | 5667fdb | 2014-10-23 18:29:55 +0800 | [diff] [blame] | 38 | extern "C" double fmod(double a, double b); // REM_DOUBLE[_2ADDR] |
| 39 | |
| 40 | // Used by hard float. |
Zheng Xu | 5667fdb | 2014-10-23 18:29:55 +0800 | [diff] [blame] | 41 | extern "C" float art_quick_fmodf(float a, float b); // REM_FLOAT[_2ADDR] |
| 42 | 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] | 43 | |
| 44 | // Integer arithmetics. |
| 45 | extern "C" int __aeabi_idivmod(int32_t, int32_t); // [DIV|REM]_INT[_2ADDR|_LIT8|_LIT16] |
| 46 | |
| 47 | // Long long arithmetics - REM_LONG[_2ADDR] and DIV_LONG[_2ADDR] |
| 48 | extern "C" int64_t __aeabi_ldivmod(int64_t, int64_t); |
Andreas Gampe | 277ccbd | 2014-11-03 21:36:10 -0800 | [diff] [blame] | 49 | |
Andreas Gampe | 3cfa4d0 | 2015-10-06 17:04:01 -0700 | [diff] [blame] | 50 | void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) { |
Andreas Gampe | c7ed09b | 2016-04-25 20:08:55 -0700 | [diff] [blame] | 51 | DefaultInitEntryPoints(jpoints, qpoints); |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 52 | |
| 53 | // Cast |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 54 | qpoints->pInstanceofNonTrivial = artIsAssignableFromCode; |
Ian Rogers | 848871b | 2013-08-05 10:56:33 -0700 | [diff] [blame] | 55 | qpoints->pCheckCast = art_quick_check_cast; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 56 | |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 57 | // Math |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 58 | qpoints->pIdivmod = __aeabi_idivmod; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 59 | qpoints->pLdiv = __aeabi_ldivmod; |
Ian Rogers | a9a8254 | 2013-10-04 11:17:26 -0700 | [diff] [blame] | 60 | qpoints->pLmod = __aeabi_ldivmod; // result returned in r2:r3 |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 61 | qpoints->pLmul = art_quick_mul_long; |
| 62 | qpoints->pShlLong = art_quick_shl_long; |
| 63 | qpoints->pShrLong = art_quick_shr_long; |
| 64 | qpoints->pUshrLong = art_quick_ushr_long; |
Zheng Xu | 5667fdb | 2014-10-23 18:29:55 +0800 | [diff] [blame] | 65 | if (kArm32QuickCodeUseSoftFloat) { |
| 66 | qpoints->pFmod = fmod; |
| 67 | qpoints->pFmodf = fmodf; |
| 68 | qpoints->pD2l = art_d2l; |
| 69 | qpoints->pF2l = art_f2l; |
Roland Levillain | 5b3ee56 | 2015-04-14 16:02:41 +0100 | [diff] [blame] | 70 | qpoints->pL2f = art_l2f; |
Zheng Xu | 5667fdb | 2014-10-23 18:29:55 +0800 | [diff] [blame] | 71 | } else { |
| 72 | qpoints->pFmod = art_quick_fmod; |
| 73 | qpoints->pFmodf = art_quick_fmodf; |
| 74 | qpoints->pD2l = art_quick_d2l; |
| 75 | qpoints->pF2l = art_quick_f2l; |
Roland Levillain | 5b3ee56 | 2015-04-14 16:02:41 +0100 | [diff] [blame] | 76 | qpoints->pL2f = art_quick_l2f; |
Zheng Xu | 5667fdb | 2014-10-23 18:29:55 +0800 | [diff] [blame] | 77 | } |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 78 | |
Anton Kirilov | d70dc9d | 2016-02-04 14:59:04 +0000 | [diff] [blame] | 79 | // More math. |
| 80 | qpoints->pCos = cos; |
| 81 | qpoints->pSin = sin; |
| 82 | qpoints->pAcos = acos; |
| 83 | qpoints->pAsin = asin; |
| 84 | qpoints->pAtan = atan; |
| 85 | qpoints->pAtan2 = atan2; |
| 86 | qpoints->pCbrt = cbrt; |
| 87 | qpoints->pCosh = cosh; |
| 88 | qpoints->pExp = exp; |
| 89 | qpoints->pExpm1 = expm1; |
| 90 | qpoints->pHypot = hypot; |
| 91 | qpoints->pLog = log; |
| 92 | qpoints->pLog10 = log10; |
| 93 | qpoints->pNextAfter = nextafter; |
| 94 | qpoints->pSinh = sinh; |
| 95 | qpoints->pTan = tan; |
| 96 | qpoints->pTanh = tanh; |
| 97 | |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 98 | // Intrinsics |
| 99 | qpoints->pIndexOf = art_quick_indexof; |
Scott Wakeling | c25cbf1 | 2016-04-18 09:00:11 +0100 | [diff] [blame^] | 100 | // The ARM StringCompareTo intrinsic does not call the runtime. |
| 101 | qpoints->pStringCompareTo = nullptr; |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 102 | qpoints->pMemcpy = memcpy; |
| 103 | |
Roland Levillain | 0d5a281 | 2015-11-13 10:07:31 +0000 | [diff] [blame] | 104 | // Read barrier. |
Hiroshi Yamauchi | 1cc71eb | 2015-05-07 10:47:27 -0700 | [diff] [blame] | 105 | qpoints->pReadBarrierJni = ReadBarrierJni; |
Roland Levillain | 7c1559a | 2015-12-15 10:55:36 +0000 | [diff] [blame] | 106 | qpoints->pReadBarrierMark = artReadBarrierMark; |
Man Cao | 1aee900 | 2015-07-14 22:31:42 -0700 | [diff] [blame] | 107 | qpoints->pReadBarrierSlow = artReadBarrierSlow; |
Roland Levillain | 0d5a281 | 2015-11-13 10:07:31 +0000 | [diff] [blame] | 108 | qpoints->pReadBarrierForRootSlow = artReadBarrierForRootSlow; |
Andreas Gampe | c8ccf68 | 2014-09-29 20:07:43 -0700 | [diff] [blame] | 109 | } |
Ian Rogers | 7655f29 | 2013-07-29 11:07:13 -0700 | [diff] [blame] | 110 | |
| 111 | } // namespace art |