diff options
| author | Raghu Gandham <raghu@mips.com> | 2012-05-02 14:27:16 -0700 |
|---|---|---|
| committer | Raghu Gandham <raghu@mips.com> | 2012-05-02 14:27:16 -0700 |
| commit | a8b91c52fd8a90b784835dfe1f8898035266c4dd (patch) | |
| tree | 8a9bb58ee3b78c10cf88a3bac21b7f96d75cd1f7 /vm/compiler/codegen/mips/CalloutHelper.h | |
| parent | a14639df65cc0aefafcddda5aae8b591204e45f9 (diff) | |
[MIPS] Dalvik fast interpreter support and JIT implementation
Change-Id: I9bb4f6875b7061d3ffaee73f204026cb8ba3ed39
Signed-off-by: Raghu Gandham <raghu@mips.com>
Signed-off-by: Chris Dearman <chris@mips.com>
Signed-off-by: Douglas Leung <douglas@mips.com>
Signed-off-by: Don Padgett <don@mips.com>
Diffstat (limited to 'vm/compiler/codegen/mips/CalloutHelper.h')
| -rw-r--r-- | vm/compiler/codegen/mips/CalloutHelper.h | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/vm/compiler/codegen/mips/CalloutHelper.h b/vm/compiler/codegen/mips/CalloutHelper.h new file mode 100644 index 000000000..6e2343d98 --- /dev/null +++ b/vm/compiler/codegen/mips/CalloutHelper.h @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef DALVIK_VM_COMPILER_CODEGEN_MIPS_CALLOUT_HELPER_H_ +#define DALVIK_VM_COMPILER_CODEGEN_MIPS_CALLOUT_HELPER_H_ + +#include "Dalvik.h" + +/* + * Declare/comment prototypes of all native callout functions invoked by the + * JIT'ed code here and use the LOAD_FUNC_ADDR macro to load the address into + * a register. In this way we have a centralized place to find out all native + * helper functions and we can grep for LOAD_FUNC_ADDR to find out all the + * callsites. + */ + +/* Load a statically compiled function address as a constant */ +#define LOAD_FUNC_ADDR(cUnit, reg, addr) loadConstant(cUnit, reg, addr) + +/* Conversions */ +extern "C" float __floatsisf(int op1); // OP_INT_TO_FLOAT +extern "C" int __fixsfsi(float op1); // OP_FLOAT_TO_INT +extern "C" float __truncdfsf2(double op1); // OP_DOUBLE_TO_FLOAT +extern "C" double __extendsfdf2(float op1); // OP_FLOAT_TO_DOUBLE +extern "C" double __floatsidf(int op1); // OP_INT_TO_DOUBLE +extern "C" int __fixdfsi(double op1); // OP_DOUBLE_TO_INT +extern "C" float __floatdisf(long long op1); // OP_LONG_TO_FLOAT +extern "C" double __floatdidf(long long op1); // OP_LONG_TO_DOUBLE +extern "C" long long __fixsfdi(float op1); // OP_FLOAT_TO_LONG +extern "C" long long __fixdfdi(double op1); // OP_DOUBLE_TO_LONG + +/* Single-precision FP arithmetics */ +extern "C" float __addsf3(float a, float b); // OP_ADD_FLOAT[_2ADDR] +extern "C" float __subsf3(float a, float b); // OP_SUB_FLOAT[_2ADDR] +extern "C" float __divsf3(float a, float b); // OP_DIV_FLOAT[_2ADDR] +extern "C" float __mulsf3(float a, float b); // OP_MUL_FLOAT[_2ADDR] +extern "C" float fmodf(float a, float b); // OP_REM_FLOAT[_2ADDR] + +/* Double-precision FP arithmetics */ +extern "C" double __adddf3(double a, double b); // OP_ADD_DOUBLE[_2ADDR] +extern "C" double __subdf3(double a, double b); // OP_SUB_DOUBLE[_2ADDR] +extern "C" double __divdf3(double a, double b); // OP_DIV_DOUBLE[_2ADDR] +extern "C" double __muldf3(double a, double b); // OP_MUL_DOUBLE[_2ADDR] +extern "C" double fmod(double a, double b); // OP_REM_DOUBLE[_2ADDR] + +/* Long long arithmetics - OP_REM_LONG[_2ADDR] & OP_DIV_LONG[_2ADDR] */ +extern "C" long long __divdi3(long long op1, long long op2); +extern "C" long long __moddi3(long long op1, long long op2); + +/* Originally declared in Sync.h */ +bool dvmUnlockObject(struct Thread* self, struct Object* obj); //OP_MONITOR_EXIT + +/* Originally declared in oo/TypeCheck.h */ +bool dvmCanPutArrayElement(const ClassObject* elemClass, // OP_APUT_OBJECT + const ClassObject* arrayClass); +int dvmInstanceofNonTrivial(const ClassObject* instance, // OP_CHECK_CAST && + const ClassObject* clazz); // OP_INSTANCE_OF + +/* Originally declared in oo/Array.h */ +ArrayObject* dvmAllocArrayByClass(ClassObject* arrayClass, // OP_NEW_ARRAY + size_t length, int allocFlags); + +/* Originally declared in interp/InterpDefs.h */ +bool dvmInterpHandleFillArrayData(ArrayObject* arrayObject,// OP_FILL_ARRAY_DATA + const u2* arrayData); + +/* Originally declared in compiler/codegen/mips/Assemble.c */ +const Method *dvmJitToPatchPredictedChain(const Method *method, + Thread *self, + PredictedChainingCell *cell, + const ClassObject *clazz); + +/* + * Switch dispatch offset calculation for OP_PACKED_SWITCH & OP_SPARSE_SWITCH + * Used in CodegenDriver.c + * static s8 findPackedSwitchIndex(const u2* switchData, int testVal, int pc); + * static s8 findSparseSwitchIndex(const u2* switchData, int testVal, int pc); + */ + +/* + * Resolve interface callsites - OP_INVOKE_INTERFACE & OP_INVOKE_INTERFACE_RANGE + * + * Originally declared in mterp/common/FindInterface.h and only comment it here + * due to the INLINE attribute. + * + * INLINE Method* dvmFindInterfaceMethodInCache(ClassObject* thisClass, + * u4 methodIdx, const Method* method, DvmDex* methodClassDex) + */ + +/* Originally declared in alloc/Alloc.h */ +Object* dvmAllocObject(ClassObject* clazz, int flags); // OP_NEW_INSTANCE + +/* + * Functions declared in gDvmInlineOpsTable[] are used for + * OP_EXECUTE_INLINE & OP_EXECUTE_INLINE_RANGE. + */ +extern "C" double sqrt(double x); // INLINE_MATH_SQRT + +/* + * The following functions are invoked through the compiler templates (declared + * in compiler/template/armv5te/footer.S: + * + * __aeabi_cdcmple // CMPG_DOUBLE + * __aeabi_cfcmple // CMPG_FLOAT + * dvmLockObject // MONITOR_ENTER + */ + +#endif // DALVIK_VM_COMPILER_CODEGEN_MIPS_CALLOUT_HELPER_H_ |
