blob: 933f6867d9215b5d26c7789433cfd4b512376a5c [file] [log] [blame]
buzbee67bf8852011-08-17 17:51:35 -07001/*
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 */
25extern "C" float __aeabi_i2f(int op1); // OP_INT_TO_FLOAT
26extern "C" int __aeabi_f2iz(float op1); // OP_FLOAT_TO_INT
27extern "C" float __aeabi_d2f(double op1); // OP_DOUBLE_TO_FLOAT
28extern "C" double __aeabi_f2d(float op1); // OP_FLOAT_TO_DOUBLE
29extern "C" double __aeabi_i2d(int op1); // OP_INT_TO_DOUBLE
30extern "C" int __aeabi_d2iz(double op1); // OP_DOUBLE_TO_INT
31extern "C" float __aeabi_l2f(long op1); // OP_LONG_TO_FLOAT
32extern "C" double __aeabi_l2d(long op1); // OP_LONG_TO_DOUBLE
33s8 artF2L(float op1); // OP_FLOAT_TO_LONG
34s8 artD2L(double op1); // OP_DOUBLE_TO_LONG
35
36/* Single-precision FP arithmetics */
37extern "C" float __aeabi_fadd(float a, float b); // OP_ADD_FLOAT[_2ADDR]
38extern "C" float __aeabi_fsub(float a, float b); // OP_SUB_FLOAT[_2ADDR]
39extern "C" float __aeabi_fdiv(float a, float b); // OP_DIV_FLOAT[_2ADDR]
40extern "C" float __aeabi_fmul(float a, float b); // OP_MUL_FLOAT[_2ADDR]
41extern "C" float fmodf(float a, float b); // OP_REM_FLOAT[_2ADDR]
42
43/* Double-precision FP arithmetics */
44extern "C" double __aeabi_dadd(double a, double b); // OP_ADD_DOUBLE[_2ADDR]
45extern "C" double __aeabi_dsub(double a, double b); // OP_SUB_DOUBLE[_2ADDR]
46extern "C" double __aeabi_ddiv(double a, double b); // OP_DIV_DOUBLE[_2ADDR]
47extern "C" double __aeabi_dmul(double a, double b); // OP_MUL_DOUBLE[_2ADDR]
48extern "C" double fmod(double a, double b); // OP_REM_DOUBLE[_2ADDR]
49
50/* Integer arithmetics */
51extern "C" int __aeabi_idivmod(int op1, int op2); // OP_REM_INT[_2ADDR|_LIT8|_LIT16]
52extern "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] */
55extern "C" long long __aeabi_ldivmod(long long op1, long long op2);
56
57/* Originally declared in Sync.h */
58bool dvmUnlockObject(struct Thread* self, struct Object* obj); //OP_MONITOR_EXIT
59void dvmLockObject(struct Thread* self, struct Object* obj); //OP_MONITOR_ENTER
60
61/* Originally declared in oo/TypeCheck.h */
62bool dvmCanPutArrayElement(const ClassObject* elemClass, // OP_APUT_OBJECT
63 const ClassObject* arrayClass);
64int dvmInstanceofNonTrivial(const ClassObject* instance, // OP_CHECK_CAST &&
65 const ClassObject* clazz); // OP_INSTANCE_OF
66
67/* Originally declared in oo/Array.h */
68ArrayObject* dvmAllocArrayByClass(ClassObject* arrayClass, // OP_NEW_ARRAY
69 size_t length, int allocFlags);
70/* Originally declared in alloc/Alloc.h */
71Object* 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 */
83Method* dvmFindInterfaceMethodInCache(ClassObject* thisClass,
84 u4 methodIdx, const Method* method, DvmDex* methodClassDex);
85
86/* from interp/Interp.cpp */
87bool dvmInterpHandleFillArrayData(ArrayObject* arrayObj, const u2* arrayData);
88
89#endif // ART_SRC_COMPILER_CODEGEN_ARM_CALLOUT_HELPER_H_