buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2011 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 | #ifndef ART_SRC_COMPILER_CODEGEN_ARM_CALLOUT_HELPER_H_ |
| 18 | #define ART_SRC_COMPILER_CODEGEN_ARM_CALLOUT_HELPER_H_ |
| 19 | |
| 20 | #include "../../Dalvik.h" |
| 21 | |
| 22 | /* Helper functions used at runtime by compiled code */ |
| 23 | |
| 24 | /* Conversions */ |
| 25 | extern "C" float __aeabi_i2f(int op1); // OP_INT_TO_FLOAT |
| 26 | extern "C" int __aeabi_f2iz(float op1); // OP_FLOAT_TO_INT |
| 27 | extern "C" float __aeabi_d2f(double op1); // OP_DOUBLE_TO_FLOAT |
| 28 | extern "C" double __aeabi_f2d(float op1); // OP_FLOAT_TO_DOUBLE |
| 29 | extern "C" double __aeabi_i2d(int op1); // OP_INT_TO_DOUBLE |
| 30 | extern "C" int __aeabi_d2iz(double op1); // OP_DOUBLE_TO_INT |
| 31 | extern "C" float __aeabi_l2f(long op1); // OP_LONG_TO_FLOAT |
| 32 | extern "C" double __aeabi_l2d(long op1); // OP_LONG_TO_DOUBLE |
| 33 | s8 artF2L(float op1); // OP_FLOAT_TO_LONG |
| 34 | s8 artD2L(double op1); // OP_DOUBLE_TO_LONG |
| 35 | |
| 36 | /* Single-precision FP arithmetics */ |
| 37 | extern "C" float __aeabi_fadd(float a, float b); // OP_ADD_FLOAT[_2ADDR] |
| 38 | extern "C" float __aeabi_fsub(float a, float b); // OP_SUB_FLOAT[_2ADDR] |
| 39 | extern "C" float __aeabi_fdiv(float a, float b); // OP_DIV_FLOAT[_2ADDR] |
| 40 | extern "C" float __aeabi_fmul(float a, float b); // OP_MUL_FLOAT[_2ADDR] |
| 41 | extern "C" float fmodf(float a, float b); // OP_REM_FLOAT[_2ADDR] |
| 42 | |
| 43 | /* Double-precision FP arithmetics */ |
| 44 | extern "C" double __aeabi_dadd(double a, double b); // OP_ADD_DOUBLE[_2ADDR] |
| 45 | extern "C" double __aeabi_dsub(double a, double b); // OP_SUB_DOUBLE[_2ADDR] |
| 46 | extern "C" double __aeabi_ddiv(double a, double b); // OP_DIV_DOUBLE[_2ADDR] |
| 47 | extern "C" double __aeabi_dmul(double a, double b); // OP_MUL_DOUBLE[_2ADDR] |
| 48 | extern "C" double fmod(double a, double b); // OP_REM_DOUBLE[_2ADDR] |
| 49 | |
| 50 | /* Integer arithmetics */ |
| 51 | extern "C" int __aeabi_idivmod(int op1, int op2); // OP_REM_INT[_2ADDR|_LIT8|_LIT16] |
| 52 | extern "C" int __aeabi_idiv(int op1, int op2); // OP_DIV_INT[_2ADDR|_LIT8|_LIT16] |
| 53 | |
| 54 | /* Long long arithmetics - OP_REM_LONG[_2ADDR] & OP_DIV_LONG[_2ADDR] */ |
| 55 | extern "C" long long __aeabi_ldivmod(long long op1, long long op2); |
| 56 | |
| 57 | /* Originally declared in Sync.h */ |
| 58 | bool dvmUnlockObject(struct Thread* self, struct Object* obj); //OP_MONITOR_EXIT |
| 59 | void dvmLockObject(struct Thread* self, struct Object* obj); //OP_MONITOR_ENTER |
| 60 | |
| 61 | /* Originally declared in oo/TypeCheck.h */ |
| 62 | bool dvmCanPutArrayElement(const ClassObject* elemClass, // OP_APUT_OBJECT |
| 63 | const ClassObject* arrayClass); |
| 64 | int dvmInstanceofNonTrivial(const ClassObject* instance, // OP_CHECK_CAST && |
| 65 | const ClassObject* clazz); // OP_INSTANCE_OF |
| 66 | |
| 67 | /* Originally declared in oo/Array.h */ |
| 68 | ArrayObject* dvmAllocArrayByClass(ClassObject* arrayClass, // OP_NEW_ARRAY |
| 69 | size_t length, int allocFlags); |
| 70 | /* Originally declared in alloc/Alloc.h */ |
| 71 | Object* dvmAllocObject(ClassObject* clazz, int flags); // OP_NEW_INSTANCE |
| 72 | |
| 73 | /* |
| 74 | * The following functions are invoked through the compiler templates (declared |
| 75 | * in compiler/template/armv5te/footer.S: |
| 76 | * |
| 77 | * __aeabi_cdcmple // CMPG_DOUBLE |
| 78 | * __aeabi_cfcmple // CMPG_FLOAT |
| 79 | * dvmLockObject // MONITOR_ENTER |
| 80 | */ |
| 81 | |
| 82 | /* from mterp/common/FindInterface.h */ |
| 83 | Method* dvmFindInterfaceMethodInCache(ClassObject* thisClass, |
| 84 | u4 methodIdx, const Method* method, DvmDex* methodClassDex); |
| 85 | |
| 86 | /* from interp/Interp.cpp */ |
| 87 | bool dvmInterpHandleFillArrayData(ArrayObject* arrayObj, const u2* arrayData); |
| 88 | |
| 89 | #endif // ART_SRC_COMPILER_CODEGEN_ARM_CALLOUT_HELPER_H_ |