buzbee | 5433072 | 2011-08-23 16:46:55 -0700 | [diff] [blame] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
| 2 | |
| 3 | #ifndef ART_SRC_RUNTIME_SUPPORT_H_ |
| 4 | #define ART_SRC_RUNTIME_SUPPORT_H_ |
| 5 | |
Ian Rogers | ad42e13 | 2011-09-17 20:23:33 -0700 | [diff] [blame] | 6 | /* Helper for both JNI and regular compiled code */ |
Ian Rogers | ff1ed47 | 2011-09-20 13:46:24 -0700 | [diff] [blame] | 7 | extern "C" void art_deliver_exception_from_code(void*); |
Ian Rogers | ad42e13 | 2011-09-17 20:23:33 -0700 | [diff] [blame] | 8 | |
buzbee | 5433072 | 2011-08-23 16:46:55 -0700 | [diff] [blame] | 9 | #if defined(__arm__) |
buzbee | 7b1b86d | 2011-08-26 18:59:10 -0700 | [diff] [blame] | 10 | /* Compiler helpers */ |
Ian Rogers | 21d9e83 | 2011-09-23 17:05:09 -0700 | [diff] [blame] | 11 | extern "C" void* art_alloc_object_from_code(uint32_t type_idx, void* method); |
Ian Rogers | b886da8 | 2011-09-23 16:27:54 -0700 | [diff] [blame] | 12 | extern "C" void* art_array_alloc_from_code(uint32_t, void*, int32_t); |
| 13 | extern "C" void* art_check_and_array_alloc_from_code(uint32_t, void*, int32_t); |
Ian Rogers | e51a511 | 2011-09-23 14:16:35 -0700 | [diff] [blame] | 14 | extern "C" void art_can_put_array_element_from_code(void*, void*); |
Ian Rogers | ff1ed47 | 2011-09-20 13:46:24 -0700 | [diff] [blame] | 15 | extern "C" void art_check_cast_from_code(void*, void*); |
| 16 | extern "C" void art_handle_fill_data_from_code(void*, void*); |
Ian Rogers | cbba6ac | 2011-09-22 16:28:37 -0700 | [diff] [blame] | 17 | extern "C" void* art_initialize_static_storage_from_code(uint32_t, void*); |
Ian Rogers | ff1ed47 | 2011-09-20 13:46:24 -0700 | [diff] [blame] | 18 | extern "C" void art_invoke_interface_trampoline(void*, void*, void*, void*); |
Ian Rogers | cbba6ac | 2011-09-22 16:28:37 -0700 | [diff] [blame] | 19 | extern "C" void art_test_suspend(); |
Ian Rogers | ff1ed47 | 2011-09-20 13:46:24 -0700 | [diff] [blame] | 20 | extern "C" void art_throw_array_bounds_from_code(int32_t index, int32_t limit); |
| 21 | extern "C" void art_throw_div_zero_from_code(); |
Ian Rogers | c0c8dc8 | 2011-09-24 18:15:59 -0700 | [diff] [blame^] | 22 | extern "C" void art_throw_internal_error_from_code(int32_t errnum); |
| 23 | extern "C" void art_throw_neg_array_size_from_code(int32_t size); |
| 24 | extern "C" void art_throw_no_such_method_from_code(int32_t method_idx); |
Ian Rogers | ff1ed47 | 2011-09-20 13:46:24 -0700 | [diff] [blame] | 25 | extern "C" void art_throw_null_pointer_exception_from_code(); |
Ian Rogers | c0c8dc8 | 2011-09-24 18:15:59 -0700 | [diff] [blame^] | 26 | extern "C" void art_throw_runtime_exception_from_code(int32_t errnum); |
Ian Rogers | 932746a | 2011-09-22 18:57:50 -0700 | [diff] [blame] | 27 | extern "C" void art_throw_stack_overflow_from_code(void*); |
Ian Rogers | c0c8dc8 | 2011-09-24 18:15:59 -0700 | [diff] [blame^] | 28 | extern "C" void art_throw_verification_error_from_code(int32_t src1, int32_t ref); |
Ian Rogers | ff1ed47 | 2011-09-20 13:46:24 -0700 | [diff] [blame] | 29 | extern "C" void art_unlock_object_from_code(void*, void*); |
buzbee | 7b1b86d | 2011-08-26 18:59:10 -0700 | [diff] [blame] | 30 | |
| 31 | /* Conversions */ |
| 32 | extern "C" float __aeabi_i2f(int op1); // OP_INT_TO_FLOAT |
| 33 | extern "C" int __aeabi_f2iz(float op1); // OP_FLOAT_TO_INT |
| 34 | extern "C" float __aeabi_d2f(double op1); // OP_DOUBLE_TO_FLOAT |
| 35 | extern "C" double __aeabi_f2d(float op1); // OP_FLOAT_TO_DOUBLE |
| 36 | extern "C" double __aeabi_i2d(int op1); // OP_INT_TO_DOUBLE |
| 37 | extern "C" int __aeabi_d2iz(double op1); // OP_DOUBLE_TO_INT |
| 38 | extern "C" float __aeabi_l2f(long op1); // OP_LONG_TO_FLOAT |
| 39 | extern "C" double __aeabi_l2d(long op1); // OP_LONG_TO_DOUBLE |
| 40 | |
| 41 | /* Single-precision FP arithmetics */ |
| 42 | extern "C" float __aeabi_fadd(float a, float b); // OP_ADD_FLOAT[_2ADDR] |
| 43 | extern "C" float __aeabi_fsub(float a, float b); // OP_SUB_FLOAT[_2ADDR] |
| 44 | extern "C" float __aeabi_fdiv(float a, float b); // OP_DIV_FLOAT[_2ADDR] |
| 45 | extern "C" float __aeabi_fmul(float a, float b); // OP_MUL_FLOAT[_2ADDR] |
| 46 | extern "C" float fmodf(float a, float b); // OP_REM_FLOAT[_2ADDR] |
| 47 | |
| 48 | /* Double-precision FP arithmetics */ |
| 49 | extern "C" double __aeabi_dadd(double a, double b); // OP_ADD_DOUBLE[_2ADDR] |
| 50 | extern "C" double __aeabi_dsub(double a, double b); // OP_SUB_DOUBLE[_2ADDR] |
| 51 | extern "C" double __aeabi_ddiv(double a, double b); // OP_DIV_DOUBLE[_2ADDR] |
| 52 | extern "C" double __aeabi_dmul(double a, double b); // OP_MUL_DOUBLE[_2ADDR] |
| 53 | extern "C" double fmod(double a, double b); // OP_REM_DOUBLE[_2ADDR] |
| 54 | |
| 55 | /* Integer arithmetics */ |
| 56 | extern "C" int __aeabi_idivmod(int op1, int op2); // OP_REM_INT[_2ADDR|_LIT8|_LIT16] |
| 57 | extern "C" int __aeabi_idiv(int op1, int op2); // OP_DIV_INT[_2ADDR|_LIT8|_LIT16] |
| 58 | |
Ian Rogers | ff1ed47 | 2011-09-20 13:46:24 -0700 | [diff] [blame] | 59 | /* Long long arithmetics - OP_REM_LONG[_2ADDR] & OP_DIV_LONG[_2ADDR] */ |
| 60 | extern "C" long long __aeabi_ldivmod(long long op1, long long op2); |
| 61 | extern "C" long long __aeabi_lmul(long long op1, long long op2); |
Ian Rogers | cbba6ac | 2011-09-22 16:28:37 -0700 | [diff] [blame] | 62 | extern "C" uint64_t art_shl_long(uint64_t, uint32_t); |
| 63 | extern "C" uint64_t art_shr_long(uint64_t, uint32_t); |
| 64 | extern "C" uint64_t art_ushr_long(uint64_t, uint32_t); |
buzbee | 7b1b86d | 2011-08-26 18:59:10 -0700 | [diff] [blame] | 65 | |
buzbee | 5433072 | 2011-08-23 16:46:55 -0700 | [diff] [blame] | 66 | #endif |
| 67 | |
buzbee | 5433072 | 2011-08-23 16:46:55 -0700 | [diff] [blame] | 68 | #endif // ART_SRC_RUNTIME_SUPPORT_H_ |