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 | |
| 17 | #include "atomic.h" |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 18 | #include "entrypoints/jni/jni_entrypoints.h" |
| 19 | #include "entrypoints/quick/quick_alloc_entrypoints.h" |
| 20 | #include "entrypoints/quick/quick_default_externs.h" |
Andreas Gampe | c7ed09b | 2016-04-25 20:08:55 -0700 | [diff] [blame^] | 21 | #include "entrypoints/quick/quick_default_init_entrypoints.h" |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 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 | |
Andreas Gampe | 3cfa4d0 | 2015-10-06 17:04:01 -0700 | [diff] [blame] | 60 | void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) { |
Andreas Gampe | c7ed09b | 2016-04-25 20:08:55 -0700 | [diff] [blame^] | 61 | DefaultInitEntryPoints(jpoints, qpoints); |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 62 | |
| 63 | // Cast |
| 64 | qpoints->pInstanceofNonTrivial = artIsAssignableFromCode; |
| 65 | qpoints->pCheckCast = art_quick_check_cast; |
| 66 | |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 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; |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 78 | qpoints->pIdivmod = nullptr; |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 79 | qpoints->pD2l = art_d2l; |
| 80 | qpoints->pF2l = art_f2l; |
| 81 | qpoints->pLdiv = artLdiv; |
| 82 | qpoints->pLmod = artLmod; |
| 83 | qpoints->pLmul = artLmul; |
Mathieu Chartier | 2cebb24 | 2015-04-21 16:50:40 -0700 | [diff] [blame] | 84 | qpoints->pShlLong = nullptr; |
| 85 | qpoints->pShrLong = nullptr; |
| 86 | qpoints->pUshrLong = nullptr; |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 87 | |
| 88 | // Intrinsics |
| 89 | qpoints->pIndexOf = art_quick_indexof; |
| 90 | qpoints->pStringCompareTo = art_quick_string_compareto; |
| 91 | qpoints->pMemcpy = memcpy; |
| 92 | |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 93 | // TODO - use lld/scd instructions for Mips64 |
| 94 | // Atomic 64-bit load/store |
| 95 | qpoints->pA64Load = QuasiAtomic::Read64; |
| 96 | qpoints->pA64Store = QuasiAtomic::Write64; |
Hiroshi Yamauchi | 1cc71eb | 2015-05-07 10:47:27 -0700 | [diff] [blame] | 97 | |
Roland Levillain | 0d5a281 | 2015-11-13 10:07:31 +0000 | [diff] [blame] | 98 | // Read barrier. |
Hiroshi Yamauchi | 1cc71eb | 2015-05-07 10:47:27 -0700 | [diff] [blame] | 99 | qpoints->pReadBarrierJni = ReadBarrierJni; |
Roland Levillain | 7c1559a | 2015-12-15 10:55:36 +0000 | [diff] [blame] | 100 | qpoints->pReadBarrierMark = artReadBarrierMark; |
Man Cao | 1aee900 | 2015-07-14 22:31:42 -0700 | [diff] [blame] | 101 | qpoints->pReadBarrierSlow = artReadBarrierSlow; |
Roland Levillain | 0d5a281 | 2015-11-13 10:07:31 +0000 | [diff] [blame] | 102 | qpoints->pReadBarrierForRootSlow = artReadBarrierForRootSlow; |
Andreas Gampe | 1a5c406 | 2015-01-15 12:10:47 -0800 | [diff] [blame] | 103 | }; |
| 104 | |
| 105 | } // namespace art |