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 17 #include "entrypoints/jni/jni_entrypoints.h" 18 #include "entrypoints/quick/quick_alloc_entrypoints.h" 19 #include "entrypoints/quick/quick_default_externs.h" 20 #include "entrypoints/quick/quick_default_init_entrypoints.h" 21 #include "entrypoints/quick/quick_entrypoints.h" 22 #include "entrypoints/entrypoint_utils.h" 23 #include "entrypoints/math_entrypoints.h" 24 #include "entrypoints/runtime_asm_entrypoints.h" 25 #include "interpreter/interpreter.h" 26 27 namespace art { 28 29 // Cast entrypoints. 30 extern "C" uint32_t artIsAssignableFromCode(const mirror::Class* klass, 31 const mirror::Class* ref_class); 32 33 34 // Used by soft float. 35 // Single-precision FP arithmetics. 36 extern "C" float fmodf(float a, float b); // REM_FLOAT[_2ADDR] 37 // Double-precision FP arithmetics. 38 extern "C" double fmod(double a, double b); // REM_DOUBLE[_2ADDR] 39 40 // Used by hard float. 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] 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); 49 50 void InitEntryPoints(JniEntryPoints* jpoints, QuickEntryPoints* qpoints) { 51 DefaultInitEntryPoints(jpoints, qpoints); 52 53 // Cast 54 qpoints->pInstanceofNonTrivial = artIsAssignableFromCode; 55 qpoints->pCheckCast = art_quick_check_cast; 56 57 // Math 58 qpoints->pIdivmod = __aeabi_idivmod; 59 qpoints->pLdiv = __aeabi_ldivmod; 60 qpoints->pLmod = __aeabi_ldivmod; // result returned in r2:r3 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; 65 if (kArm32QuickCodeUseSoftFloat) { 66 qpoints->pFmod = fmod; 67 qpoints->pFmodf = fmodf; 68 qpoints->pD2l = art_d2l; 69 qpoints->pF2l = art_f2l; 70 qpoints->pL2f = art_l2f; 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; 76 qpoints->pL2f = art_quick_l2f; 77 } 78 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 98 // Intrinsics 99 qpoints->pIndexOf = art_quick_indexof; 100 qpoints->pStringCompareTo = art_quick_string_compareto; 101 qpoints->pMemcpy = memcpy; 102 103 // Read barrier. 104 qpoints->pReadBarrierJni = ReadBarrierJni; 105 qpoints->pReadBarrierMark = artReadBarrierMark; 106 qpoints->pReadBarrierSlow = artReadBarrierSlow; 107 qpoints->pReadBarrierForRootSlow = artReadBarrierForRootSlow; 108 } 109 110 } // namespace art 111