71 using namespace cacao;
97 assert(align_off == 4);
119 #if defined(ENABLE_SSA)
122 varindex = ls->var_0[varindex];
140 log_text(
"integer register argument");
156 #if defined(ENABLE_SSA)
174 #if defined(ENABLE_SSA)
200 log_text(
"There are no float argument registers!");
228 #if defined(ENABLE_SSA)
334 if (iptr->
sx.
val.
f == 0.0) {
338 if ((uint32_t)iptr->
sx.
val.
i == 0x80000000) {
342 }
else if (iptr->
sx.
val.
f == 1.0) {
345 }
else if (iptr->
sx.
val.
f == 2.0) {
362 if (iptr->
sx.
val.
d == 0.0) {
366 if ((uint64_t)iptr->
sx.
val.
l == 0x8000000000000000LL) {
370 }
else if (iptr->
sx.
val.
d == 1.0) {
373 }
else if (iptr->
sx.
val.
d == 2.0) {
441 s1 = emit_load_s1_low(jd, iptr,
REG_ITMP2);
506 s1 = emit_load_s1_low(jd, iptr,
REG_ITMP1);
507 s2 = emit_load_s2_low(jd, iptr,
REG_ITMP2);
512 s1 = emit_load_s1_high(jd, iptr,
REG_ITMP2);
513 s2 = emit_load_s2_high(jd, iptr,
REG_ITMP3);
559 s1 = emit_load_s1_low(jd, iptr,
REG_ITMP1);
560 s2 = emit_load_s2_low(jd, iptr,
REG_ITMP2);
572 s1 = emit_load_s1_high(jd, iptr,
REG_ITMP2);
573 s2 = emit_load_s2_high(jd, iptr,
REG_ITMP3);
622 s1 = emit_load_s1_high(jd, iptr,
REG_ITMP2);
623 s2 = emit_load_s2_low(jd, iptr,
EDX);
629 s1 = emit_load_s1_low(jd, iptr,
EAX);
630 s2 = emit_load_s2_high(jd, iptr,
EDX);
635 s1 = emit_load_s1_low(jd, iptr,
EAX);
636 s2 = emit_load_s2_low(jd, iptr,
EDX);
648 s1 = emit_load_s1_low(jd, iptr,
REG_ITMP2);
654 s1 = emit_load_s1_high(jd, iptr,
REG_ITMP2);
732 M_BGE(2 + 2 + 6 + 2);
751 bte = iptr->
sx.
s23.s3.bte;
928 if (iptr->
sx.
val.
i & 0x20) {
964 if (iptr->
sx.
val.
i & 0x20) {
1000 if (iptr->
sx.
val.
i & 0x20) {
1040 s1 = emit_load_s1_low(jd, iptr,
REG_ITMP1);
1041 s2 = emit_load_s2_low(jd, iptr,
REG_ITMP2);
1050 s1 = emit_load_s1_high(jd, iptr,
REG_ITMP2);
1051 s2 = emit_load_s2_high(jd, iptr,
REG_ITMP3);
1098 s1 = emit_load_s1_low(jd, iptr,
REG_ITMP1);
1099 s2 = emit_load_s2_low(jd, iptr,
REG_ITMP2);
1108 s1 = emit_load_s1_high(jd, iptr,
REG_ITMP2);
1109 s2 = emit_load_s2_high(jd, iptr,
REG_ITMP3);
1156 s1 = emit_load_s1_low(jd, iptr,
REG_ITMP1);
1157 s2 = emit_load_s2_low(jd, iptr,
REG_ITMP2);
1166 s1 = emit_load_s1_high(jd, iptr,
REG_ITMP2);
1167 s2 = emit_load_s2_high(jd, iptr,
REG_ITMP3);
1342 log_text(
"L2F: longs have to be in memory");
1527 log_text(
"F2L: longs have to be in memory");
1587 log_text(
"D2L: longs have to be in memory");
1915 (
u4) (iptr->
sx.
s23.s3.constval & 0x00000000ffffffff),
1918 ((
s4)iptr->
sx.
s23.s3.constval) >> 31,
1936 uf = iptr->
sx.
s23.s3.uf;
1944 fi = iptr->
sx.
s23.s3.fmiref->p.field;
1945 fieldtype = fi->
type;
1946 disp = (intptr_t) fi->
value;
1953 switch (fieldtype) {
1981 uf = iptr->
sx.
s23.s3.uf;
1988 fi = iptr->
sx.
s23.s3.fmiref->p.field;
1989 fieldtype = fi->
type;
1990 disp = (intptr_t) fi->
value;
1997 switch (fieldtype) {
2026 uf = iptr->
sx.
s23.s3.uf;
2033 fi = iptr->
sx.
s23.s3.fmiref->p.field;
2034 fieldtype = fi->
type;
2035 disp = (intptr_t) fi->
value;
2042 switch (fieldtype) {
2062 #if defined(ENABLE_ESCAPE_CHECK)
2067 uf = iptr->
sx.
s23.s3.uf;
2072 iptr->
sx.
s23.s3.uf, 0);
2075 fi = iptr->
sx.
s23.s3.fmiref->p.field;
2076 fieldtype = fi->
type;
2080 switch (fieldtype) {
2113 uf = iptr->
sx.
s23.s3.uf;
2117 fi = iptr->
sx.
s23.s3.fmiref->p.field;
2118 fieldtype = fi->
type;
2132 uf = iptr->
sx.
s23.s3.uf;
2139 fi = iptr->
sx.
s23.s3.fmiref->p.field;
2143 switch (fieldtype) {
2171 uf = iptr->
sx.
s23.s3.uf;
2179 fi = iptr->
sx.
s23.s3.fmiref->p.field;
2180 fieldtype = fi->
type;
2184 switch (fieldtype) {
2210 if (iptr->
sx.
val.
l == 0) {
2225 if (iptr->
sx.
val.
l == 0) {
2228 s1 = emit_load_s1_high(jd, iptr,
REG_ITMP2);
2255 if (iptr->
sx.
val.
l == 0) {
2280 if (iptr->
sx.
val.
l == 0) {
2283 s1 = emit_load_s1_high(jd, iptr,
REG_ITMP2);
2299 s1 = emit_load_s1_low(jd, iptr,
REG_ITMP1);
2300 s2 = emit_load_s2_low(jd, iptr,
REG_ITMP2);
2303 s1 = emit_load_s1_high(jd, iptr,
REG_ITMP2);
2304 s2 = emit_load_s2_high(jd, iptr,
REG_ITMP3);
2313 s1 = emit_load_s1_low(jd, iptr,
REG_ITMP1);
2314 s2 = emit_load_s2_low(jd, iptr,
REG_ITMP2);
2317 s1 = emit_load_s1_high(jd, iptr,
REG_ITMP2);
2318 s2 = emit_load_s2_high(jd, iptr,
REG_ITMP3);
2327 s1 = emit_load_s1_high(jd, iptr,
REG_ITMP1);
2328 s2 = emit_load_s2_high(jd, iptr,
REG_ITMP2);
2331 s1 = emit_load_s1_low(jd, iptr,
REG_ITMP1);
2332 s2 = emit_load_s2_low(jd, iptr,
REG_ITMP2);
2340 s1 = emit_load_s1_high(jd, iptr,
REG_ITMP1);
2341 s2 = emit_load_s2_high(jd, iptr,
REG_ITMP2);
2344 s1 = emit_load_s1_low(jd, iptr,
REG_ITMP1);
2345 s2 = emit_load_s2_low(jd, iptr,
REG_ITMP2);
2353 s1 = emit_load_s1_high(jd, iptr,
REG_ITMP1);
2354 s2 = emit_load_s2_high(jd, iptr,
REG_ITMP2);
2357 s1 = emit_load_s1_low(jd, iptr,
REG_ITMP1);
2358 s2 = emit_load_s2_low(jd, iptr,
REG_ITMP2);
2366 s1 = emit_load_s1_high(jd, iptr,
REG_ITMP1);
2367 s2 = emit_load_s2_high(jd, iptr,
REG_ITMP2);
2370 s1 = emit_load_s1_low(jd, iptr,
REG_ITMP1);
2371 s2 = emit_load_s2_low(jd, iptr,
REG_ITMP2);
2384 l = iptr->
sx.
s23.s2.tablelow;
2385 i = iptr->
sx.
s23.s3.tablehigh;
2398 emit_bugt(cd, table[0].
block);
2420 bte = iptr->
sx.
s23.s3.bte;
2421 if (bte->
stub == NULL) {
2429 #if defined(ENABLE_ESCAPE_CHECK)
2443 um = iptr->
sx.
s23.s3.um;
2451 lm = iptr->
sx.
s23.s3.fmiref->p.method;
2465 um = iptr->
sx.
s23.s3.um;
2472 lm = iptr->
sx.
s23.s3.fmiref->p.method;
2488 um = iptr->
sx.
s23.s3.um;
2496 lm = iptr->
sx.
s23.s3.fmiref->p.method;
2525 super = iptr->
sx.
s23.s3.c.cls;
2526 superindex = super->
index;
2527 supervftbl = super->
vftbl;
2534 if (super == NULL) {
2539 iptr->
sx.
s23.s3.c.ref, 0);
2549 if (super != NULL) {
2556 if (super == NULL) {
2558 iptr->
sx.
s23.s3.c.ref,
2584 if (super == NULL) {
2593 if (super == NULL) {
2595 iptr->
sx.
s23.s3.c.ref,
2600 if (super == NULL || super->
vftbl->subtype_depth >= DISPLAY_SIZE) {
2605 if (super == NULL) {
2641 if (super == NULL) {
2656 iptr->
sx.
s23.s3.c.ref, 0);
2687 super = iptr->
sx.
s23.s3.c.cls;
2688 superindex = super->
index;
2689 supervftbl = super->
vftbl;
2704 if (super == NULL) {
2709 iptr->
sx.
s23.s3.c.ref, 0);
2719 if (super != NULL) {
2726 if (super == NULL) {
2728 iptr->
sx.
s23.s3.c.ref, 0);
2758 if (super == NULL) {
2767 if (super == NULL) {
2769 iptr->
sx.
s23.s3.c.ref, 0);
2773 if (super == NULL || super->
vftbl->subtype_depth >= DISPLAY_SIZE) {
2785 if (super == NULL) {
2837 if (super == NULL) {
2854 var =
VAR(iptr->
sx.
s23.s2.args[s1]);
2871 iptr->
sx.
s23.s3.c.ref, 0);
2906 vm_abort(
"Unknown ICMD %d during code generation", iptr->
opc);
2957 #if defined(ENABLE_PROFILING)
2984 #if defined(ENABLE_GC_CACAO)
3012 for (i = md->
paramcount - 1, j = i + skipparams; i >= 0; i--, j--) {
3133 #if defined(ENABLE_GC_CACAO)
void codegen_emit_instruction(jitdata *jd, instruction *iptr)
Generates machine code for one ICMD.
s4 dseg_add_double(codegendata *cd, double value)
#define BUILTIN_FAST_canstore
#define M_LLD32(a, b, disp)
s4 emit_load_s3(jitdata *jd, instruction *iptr, s4 tempreg)
void emit_fprem(codegendata *cd)
#define M_LST32(a, b, disp)
void emit_neg_reg(codegendata *cd, s4 reg)
s4 emit_load_s1(jitdata *jd, instruction *iptr, s4 tempreg)
void emit_mov_reg_memindex(codegendata *cd, s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale)
#define M_ALD(a, b, disp)
s4 asm_builtin_f2i(float a)
#define M_SRLD_IMM(a, b, c)
void emit_movb_imm_reg(codegendata *cd, s4 imm, s4 reg)
#define PATCHER_invokeinterface
#define M_ILD32(a, b, disp)
void emit_mov_membase_reg(codegendata *cd, s4 basereg, s4 disp, s4 reg)
#define M_LST(a, b, disp)
#define M_ALD32(a, b, disp)
void emit_movw_reg_memindex(codegendata *cd, s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale)
s8 asm_builtin_d2l(double a)
void emit_fchs(codegendata *cd)
#define M_ILD(a, b, disp)
void emit_sahf(codegendata *cd)
s4 dseg_add_unique_address(codegendata *cd, void *value)
void emit_flds_membase(codegendata *cd, s4 basereg, s4 disp)
#define M_ISUB_IMM32(a, b)
#define BUILTIN_multianewarray
#define IS_INT_LNG_TYPE(a)
#define M_IST(a, b, disp)
#define M_IADDC_IMM(a, b)
#define M_AADD_IMM(a, b, c)
void emit_fildll_membase(codegendata *cd, s4 basereg, s4 disp)
#define M_OR_IMM(a, b, c)
#define REG_ITMP12_PACKED
#define CALCOFFSETBYTES(var, reg, val)
void emit_mov_imm_memindex(codegendata *cd, s4 imm, s4 disp, s4 basereg, s4 indexreg, s4 scale)
void emit_movb_imm_memindex(codegendata *cd, s4 imm, s4 disp, s4 basereg, s4 indexreg, s4 scale)
#define dseg_add_functionptr(cd, value)
#define JITDATA_HAS_FLAG_INSTRUMENT(jd)
void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f, int skipparams)
s4 asm_builtin_d2i(double a)
typedef void(JNICALL *jvmtiEventSingleStep)(jvmtiEnv *jvmti_env
void emit_arraystore_check(codegendata *cd, instruction *iptr)
#define M_IST32_IMM(a, b, disp)
#define M_CMP_IMM32(a, b)
patchref_t * patcher_add_patch_ref(jitdata *jd, functionptr patcher, void *ref, s4 disp)
#define M_FLD(a, b, disp)
void dseg_add_target(codegendata *cd, basicblock *target)
void emit_fucompp(codegendata *cd)
java_object_t * codegen_finish_native_call(u1 *sp, u1 *pv)
void emit_alu_imm_membase(codegendata *cd, s4 opc, s4 imm, s4 basereg, s4 disp)
void emit_fdivp(codegendata *cd)
const s4 abi_registers_integer_saved[]
void emit_movzwl_memindex_reg(codegendata *cd, s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg)
void emit_fistpll_membase(codegendata *cd, s4 basereg, s4 disp)
#define REG_ITMP13_PACKED
void emit_fstpl_membase32(codegendata *cd, s4 basereg, s4 disp)
#define PATCHER_get_putstatic
#define BUILTIN_arraycheckcast
void emit_fld1(codegendata *cd)
s4 dseg_add_s4(codegendata *cd, s4 value)
void vm_abort(const char *text,...)
void(* functionptr)(void)
java_handle_t * codegen_start_native_call(u1 *sp, u1 *pv)
#define PATCHER_instanceof_interface
#define IS_2_WORD_TYPE(a)
void emit_exception_check(codegendata *cd, instruction *iptr)
s4 codegen_reg_of_dst(jitdata *jd, instruction *iptr, s4 tempregnum)
void emit_fstps_membase(codegendata *cd, s4 basereg, s4 disp)
void emit_test_imm_reg(codegendata *cd, s4 imm, s4 reg)
void emit_fldl_membase(codegendata *cd, s4 basereg, s4 disp)
void emit_fstpl_membase(codegendata *cd, s4 basereg, s4 disp)
void emit_fsubp(codegendata *cd)
#define M_CMP_MEMINDEX(a, b, c, d, e)
void emit_call_reg(codegendata *cd, s4 reg)
void emit_movb_reg_memindex(codegendata *cd, s4 reg, s4 disp, s4 basereg, s4 indexreg, s4 scale)
#define M_ISUB_IMM(a, b, c)
void emit_movsbl_memindex_reg(codegendata *cd, s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg)
#define M_XOR_IMM(a, b, c)
s8 asm_builtin_f2l(float a)
constant_FMIref * fieldref
void emit_label_br(codegendata *cd, s4 label)
void emit_fldcw_membase(codegendata *cd, s4 basereg, s4 disp)
void emit_movswl_memindex_reg(codegendata *cd, s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg)
void emit_fmulp(codegendata *cd)
s4 emit_load_s2(jitdata *jd, instruction *iptr, s4 tempreg)
#define REG_ITMP23_PACKED
#define IS_FLT_DBL_TYPE(a)
void emit_flds_memindex(codegendata *cd, s4 disp, s4 basereg, s4 indexreg, s4 scale)
#define M_ASUB_IMM(a, b, c)
void emit_fstl_membase(codegendata *cd, s4 basereg, s4 disp)
#define M_SRL_IMM(a, b, c)
void emit_ffree_reg(codegendata *cd, s4 reg)
#define M_IST_IMM(a, b, disp)
#define M_IADD_IMM32(a, b)
s4 dseg_add_unique_s4(codegendata *cd, s4 value)
#define M_AST(a, b, disp)
void emit_wait(codegendata *cd)
union instruction::@12 sx
void emit_mov_imm_reg(codegendata *cd, s4 imm, s4 reg)
void emit_arithmetic_check(codegendata *cd, instruction *iptr, s4 reg)
void emit_mov_memindex_reg(codegendata *cd, s4 disp, s4 basereg, s4 indexreg, s4 scale, s4 reg)
#define M_FLD32(a, b, disp)
#define PATCHER_checkcast_interface
void emit_store_dst(jitdata *jd, instruction *iptr, s4 d)
void emit_alu_imm_reg(codegendata *cd, s4 opc, s4 imm, s4 dreg)
#define M_IST32(a, b, disp)
#define PATCHER_invokestatic_special
void emit_fldz(codegendata *cd)
void emit_fstps_memindex(codegendata *cd, s4 disp, s4 basereg, s4 indexreg, s4 scale)
#define M_SRA_IMM(a, b, c)
#define M_ISUBB_IMM(a, b)
#define M_AND_IMM(a, b, c)
#define PATCHER_invokevirtual
#define M_SLL_IMM(a, b, c)
#define M_IMUL_IMM(a, b, c)
void emit_jcc(codegendata *cd, s4 opc, s4 imm)
#define M_AND_IMM32(a, b)
void codegen_emit_epilog(jitdata *jd)
Generates machine code for the method epilog.
void emit_movw_imm_memindex(codegendata *cd, s4 imm, s4 disp, s4 basereg, s4 indexreg, s4 scale)
void emit_fsts_membase(codegendata *cd, s4 basereg, s4 disp)
#define M_CMP_MEMBASE(a, b, c)
void emit_classcast_check(codegendata *cd, instruction *iptr, s4 condition, s4 reg, s4 s1)
#define CALCIMMEDIATEBYTES(var, val)
void emit_mov_reg_membase(codegendata *cd, s4 reg, s4 basereg, s4 disp)
void emit_jmp_imm(codegendata *cd, s4 imm)
#define M_SLLD_IMM(a, b, c)
static bool class_is_or_almost_initialized(classinfo *c)
#define PATCHER_initialize_class
#define INSTRUCTION_IS_UNRESOLVED(iptr)
struct instruction::@12::@13 s23
void codegen_emit_prolog(jitdata *jd)
Generates machine code for the method prolog.
void emit_fildl_membase(codegendata *cd, s4 basereg, s4 disp)
void emit_fincstp(codegendata *cd)
#define M_LLD(a, b, disp)
void emit_faddp(codegendata *cd)
const parseddesc_t parseddesc
void emit_fstpl_memindex(codegendata *cd, s4 disp, s4 basereg, s4 indexreg, s4 scale)
void emit_label(codegendata *cd, s4 label)
void emit_fistpl_membase(codegendata *cd, s4 basereg, s4 disp)
#define M_DLD32(a, b, disp)
#define M_IADD_IMM(a, b, c)
#define M_ALD_MEM(a, disp)
void emit_fldl_memindex(codegendata *cd, s4 disp, s4 basereg, s4 indexreg, s4 scale)
PrimitiveType primitivetype
void emit_arrayindexoutofbounds_check(codegendata *cd, instruction *iptr, s4 s1, s4 s2)
#define M_DLD(a, b, disp)
void emit_fnstsw(codegendata *cd)
void emit_fstps_membase32(codegendata *cd, s4 basereg, s4 disp)
s4 dseg_add_float(codegendata *cd, float value)
void emit_fld_reg(codegendata *cd, s4 reg)
#define M_AST_IMM(a, b, disp)
void emit_nullpointer_check(codegendata *cd, instruction *iptr, s4 reg)
static VM * get_current()
#define REG_RESULT_PACKED
#define M_IADD_IMM_MEMBASE(a, b, c)