blob: 3bfb299e2c58bb464a639fd97770e306bfe4102f [file] [log] [blame]
Ben Chengbd1326d2010-04-02 15:04:53 -07001/*
2 * Copyright (C) 2010 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 "Dalvik.h"
18
19#ifndef _DALVIK_VM_COMPILER_CODEGEN_ARM_CALLOUT_HELPER_H
20#define _DALVIK_VM_COMPILER_CODEGEN_ARM_CALLOUT_HELPER_H
21
Carl Shapiro5d5b94c2011-04-19 17:34:24 -070022#ifdef __cplusplus
23extern "C" {
24#endif
25
Ben Chengbd1326d2010-04-02 15:04:53 -070026/*
27 * Declare/comment prototypes of all native callout functions invoked by the
28 * JIT'ed code here and use the LOAD_FUNC_ADDR macro to load the address into
29 * a register. In this way we have a centralized place to find out all native
30 * helper functions and we can grep for LOAD_FUNC_ADDR to find out all the
31 * callsites.
32 */
33
34/* Load a statically compiled function address as a constant */
35#define LOAD_FUNC_ADDR(cUnit, reg, addr) loadConstant(cUnit, reg, addr)
36
37/* Conversions */
38float __aeabi_i2f(int op1); // OP_INT_TO_FLOAT
39int __aeabi_f2iz(float op1); // OP_FLOAT_TO_INT
40float __aeabi_d2f(double op1); // OP_DOUBLE_TO_FLOAT
41double __aeabi_f2d(float op1); // OP_FLOAT_TO_DOUBLE
42double __aeabi_i2d(int op1); // OP_INT_TO_DOUBLE
43int __aeabi_d2iz(double op1); // OP_DOUBLE_TO_INT
44float __aeabi_l2f(long op1); // OP_LONG_TO_FLOAT
45double __aeabi_l2d(long op1); // OP_LONG_TO_DOUBLE
46s8 dvmJitf2l(float op1); // OP_FLOAT_TO_LONG
47s8 dvmJitd2l(double op1); // OP_DOUBLE_TO_LONG
48
49/* Single-precision FP arithmetics */
50float __aeabi_fadd(float a, float b); // OP_ADD_FLOAT[_2ADDR]
51float __aeabi_fsub(float a, float b); // OP_SUB_FLOAT[_2ADDR]
52float __aeabi_fdiv(float a, float b); // OP_DIV_FLOAT[_2ADDR]
53float __aeabi_fmul(float a, float b); // OP_MUL_FLOAT[_2ADDR]
54float fmodf(float a, float b); // OP_REM_FLOAT[_2ADDR]
55
56/* Double-precision FP arithmetics */
57double __aeabi_dadd(double a, double b); // OP_ADD_DOUBLE[_2ADDR]
58double __aeabi_dsub(double a, double b); // OP_SUB_DOUBLE[_2ADDR]
59double __aeabi_ddiv(double a, double b); // OP_DIV_DOUBLE[_2ADDR]
60double __aeabi_dmul(double a, double b); // OP_MUL_DOUBLE[_2ADDR]
61double fmod(double a, double b); // OP_REM_DOUBLE[_2ADDR]
62
63/* Integer arithmetics */
64int __aeabi_idivmod(int op1, int op2); // OP_REM_INT[_2ADDR|_LIT8|_LIT16]
65int __aeabi_idiv(int op1, int op2); // OP_DIV_INT[_2ADDR|_LIT8|_LIT16]
66
67/* Long long arithmetics - OP_REM_LONG[_2ADDR] & OP_DIV_LONG[_2ADDR] */
68long long __aeabi_ldivmod(long long op1, long long op2);
69
70/* Originally declared in Sync.h */
71bool dvmUnlockObject(struct Thread* self, struct Object* obj); //OP_MONITOR_EXIT
72
73/* Originally declared in oo/TypeCheck.h */
74bool dvmCanPutArrayElement(const ClassObject* elemClass, // OP_APUT_OBJECT
75 const ClassObject* arrayClass);
76int dvmInstanceofNonTrivial(const ClassObject* instance, // OP_CHECK_CAST &&
77 const ClassObject* clazz); // OP_INSTANCE_OF
78
79/* Originally declared in oo/Array.h */
80ArrayObject* dvmAllocArrayByClass(ClassObject* arrayClass, // OP_NEW_ARRAY
81 size_t length, int allocFlags);
82
83/* Originally declared in interp/InterpDefs.h */
84bool dvmInterpHandleFillArrayData(ArrayObject* arrayObject,// OP_FILL_ARRAY_DATA
85 const u2* arrayData);
86
Ben Chengaf5aa1f2011-01-04 15:37:04 -080087/* Originally declared in compiler/codegen/arm/Assemble.c */
88const Method *dvmJitToPatchPredictedChain(const Method *method,
buzbee9f601a92011-02-11 17:48:20 -080089 Thread *self,
Ben Chengaf5aa1f2011-01-04 15:37:04 -080090 PredictedChainingCell *cell,
91 const ClassObject *clazz);
92
Ben Chengfc075c22010-05-28 15:20:08 -070093/*
94 * Switch dispatch offset calculation for OP_PACKED_SWITCH & OP_SPARSE_SWITCH
95 * Used in CodegenDriver.c
96 * static s8 findPackedSwitchIndex(const u2* switchData, int testVal, int pc);
97 * static s8 findSparseSwitchIndex(const u2* switchData, int testVal, int pc);
98 */
Ben Chengbd1326d2010-04-02 15:04:53 -070099
100/*
101 * Resolve interface callsites - OP_INVOKE_INTERFACE & OP_INVOKE_INTERFACE_RANGE
102 *
103 * Originally declared in mterp/common/FindInterface.h and only comment it here
104 * due to the INLINE attribute.
105 *
106 * INLINE Method* dvmFindInterfaceMethodInCache(ClassObject* thisClass,
107 * u4 methodIdx, const Method* method, DvmDex* methodClassDex)
108 */
109
110/* Originally declared in alloc/Alloc.h */
111Object* dvmAllocObject(ClassObject* clazz, int flags); // OP_NEW_INSTANCE
112
113/*
114 * Functions declared in gDvmInlineOpsTable[] are used for
115 * OP_EXECUTE_INLINE & OP_EXECUTE_INLINE_RANGE.
Ben Chengbd1326d2010-04-02 15:04:53 -0700116 */
117double sqrt(double x); // INLINE_MATH_SQRT
118
119/*
120 * The following functions are invoked through the compiler templates (declared
121 * in compiler/template/armv5te/footer.S:
122 *
123 * __aeabi_cdcmple // CMPG_DOUBLE
124 * __aeabi_cfcmple // CMPG_FLOAT
125 * dvmLockObject // MONITOR_ENTER
126 */
127
Carl Shapiro5d5b94c2011-04-19 17:34:24 -0700128#ifdef __cplusplus
129}
130#endif
131
Ben Chengbd1326d2010-04-02 15:04:53 -0700132#endif /* _DALVIK_VM_COMPILER_CODEGEN_ARM_CALLOUT_HELPER_H */