Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: codegen.c 7723 2007-04-16 18:03:08Z michi $
+ $Id: codegen.c 8245 2007-07-31 09:55:04Z michi $
*/
#include "native/jni.h"
#include "native/native.h"
-#if defined(ENABLE_THREADS)
-# include "threads/native/lock.h"
-#endif
+#include "threads/lock-common.h"
#include "vm/builtin.h"
#include "vm/exceptions.h"
*******************************************************************************/
-#if defined(ENABLE_SSA)
-void cg_move(codegendata *cd, s4 type, s4 src_regoff, s4 src_flags,
- s4 dst_regoff, s4 dst_flags);
-void codegen_insert_phi_moves(jitdata *jd, basicblock *bptr);
-#endif
-
bool codegen_emit(jitdata *jd)
{
methodinfo *m;
/* space to save used callee saved registers */
savedregs_num += (INT_SAV_CNT - rd->savintreguse);
-
- /* float register are saved on 2 4-byte stackslots */
- savedregs_num += (FLT_SAV_CNT - rd->savfltreguse) * 2;
+ savedregs_num += (FLT_SAV_CNT - rd->savfltreguse);
cd->stackframesize = rd->memuse + savedregs_num;
#if defined(ENABLE_THREADS)
/* space to save argument of monitor_enter */
- if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
- /* reserve 2 slots for long/double return values for monitorexit */
-
- if (IS_2_WORD_TYPE(m->parseddesc->returntype.type))
- cd->stackframesize += 2;
- else
- cd->stackframesize++;
- }
+ if (checksync && (m->flags & ACC_SYNCHRONIZED))
+ cd->stackframesize++;
#endif
/* create method header */
/* Keep stack of non-leaf functions 16-byte aligned. */
- if (!jd->isleafmethod)
- cd->stackframesize |= 0x3;
+ if (!jd->isleafmethod) {
+ ALIGN_ODD(cd->stackframesize); /* XXX this is wrong, +4 is missing */
+ }
(void) dseg_add_unique_address(cd, code); /* CodeinfoPointer */
- (void) dseg_add_unique_s4(cd, cd->stackframesize * 4); /* FrameSize */
+ (void) dseg_add_unique_s4(cd, cd->stackframesize * 8); /* FrameSize */
#if defined(ENABLE_THREADS)
/* IsSync contains the offset relative to the stack pointer for the
*/
if (checksync && (m->flags & ACC_SYNCHRONIZED))
- (void) dseg_add_unique_s4(cd, (rd->memuse + 1) * 4); /* IsSync */
+ (void) dseg_add_unique_s4(cd, (rd->memuse + 1) * 8); /* IsSync */
else
#endif
(void) dseg_add_unique_s4(cd, 0); /* IsSync */
/* create stack frame (if necessary) */
if (cd->stackframesize)
- M_ASUB_IMM(cd->stackframesize * 4, REG_SP);
+ M_ASUB_IMM(cd->stackframesize * 8, REG_SP);
/* save return address and used callee saved registers */
p = cd->stackframesize;
for (i = INT_SAV_CNT - 1; i >= rd->savintreguse; i--) {
- p--; M_AST(rd->savintregs[i], REG_SP, p * 4);
+ p--; M_AST(rd->savintregs[i], REG_SP, p * 8);
}
for (i = FLT_SAV_CNT - 1; i >= rd->savfltreguse; i--) {
- p-=2; emit_fld_reg(cd, rd->savfltregs[i]); emit_fstpl_membase(cd, REG_SP, p * 4);
+ p--; emit_fld_reg(cd, rd->savfltregs[i]); emit_fstpl_membase(cd, REG_SP, p * 8);
}
/* take arguments out of register or stack frame */
for (p = 0, l = 0; p < md->paramcount; p++) {
t = md->paramtypes[p].type;
+ varindex = jd->local_map[l * 5 + t];
#if defined(ENABLE_SSA)
if ( ls != NULL ) {
- l = ls->local_0[p];
+ if (varindex != UNUSED)
+ varindex = ls->var_0[varindex];
+ if ((varindex != UNUSED) && (ls->lifetime[varindex].type == UNUSED))
+ varindex = UNUSED;
}
#endif
- varindex = jd->local_map[l * 5 + t];
l++;
if (IS_2_WORD_TYPE(t)) /* increment local counter for 2 word types */
l++;
continue;
var = VAR(varindex);
-
- s1 = md->params[p].regoff;
+ s1 = md->params[p].regoff;
+ d = var->vv.regoff;
if (IS_INT_LNG_TYPE(t)) { /* integer args */
if (!md->params[p].inmemory) { /* register arguments */
/* rd->argintregs[md->params[p].regoff -> var->vv.regoff * 4 */
}
}
- else { /* stack arguments */
- if (!(var->flags & INMEMORY)) { /* stack arg -> register */
- emit_mov_membase_reg( /* + 4 for return address */
- cd, REG_SP, (cd->stackframesize + s1) * 4 + 4, var->vv.regoff);
- /* + 4 for return address */
+ else {
+ if (!(var->flags & INMEMORY)) {
+ M_ILD(d, REG_SP, cd->stackframesize * 8 + 4 + s1);
}
- else { /* stack arg -> spilled */
+ else {
if (!IS_2_WORD_TYPE(t)) {
#if defined(ENABLE_SSA)
/* no copy avoiding by now possible with SSA */
if (ls != NULL) {
emit_mov_membase_reg( /* + 4 for return address */
- cd, REG_SP, (cd->stackframesize + s1) * 4 + 4,
+ cd, REG_SP, cd->stackframesize * 8 + s1 + 4,
REG_ITMP1);
emit_mov_reg_membase(
- cd, REG_ITMP1, REG_SP, var->vv.regoff * 4);
+ cd, REG_ITMP1, REG_SP, var->vv.regoff);
}
else
#endif /*defined(ENABLE_SSA)*/
- /* reuse Stackslotand avoid copying */
- var->vv.regoff = cd->stackframesize + s1 + 1;
+ /* reuse stackslot */
+ var->vv.regoff = cd->stackframesize * 8 + 4 + s1;
}
else {
/* no copy avoiding by now possible with SSA */
if (ls != NULL) {
emit_mov_membase_reg( /* + 4 for return address */
- cd, REG_SP, (cd->stackframesize + s1) * 4 + 4,
+ cd, REG_SP, cd->stackframesize * 8 + s1 + 4,
REG_ITMP1);
emit_mov_reg_membase(
- cd, REG_ITMP1, REG_SP, var->vv.regoff * 4);
+ cd, REG_ITMP1, REG_SP, var->vv.regoff);
emit_mov_membase_reg( /* + 4 for return address */
- cd, REG_SP, (cd->stackframesize + s1) * 4 + 4 + 4,
+ cd, REG_SP, cd->stackframesize * 8 + s1 + 4 + 4,
REG_ITMP1);
emit_mov_reg_membase(
- cd, REG_ITMP1, REG_SP, var->vv.regoff * 4 + 4);
+ cd, REG_ITMP1, REG_SP, var->vv.regoff + 4);
}
else
#endif /*defined(ENABLE_SSA)*/
- /* reuse Stackslotand avoid copying */
- var->vv.regoff = cd->stackframesize + s1 + 1;
+ /* reuse stackslot */
+ var->vv.regoff = cd->stackframesize * 8 + 4 + s1;
}
}
}
if (!(var->flags & INMEMORY)) { /* reg arg -> register */
/* rd->argfltregs[md->params[p].regoff -> var->vv.regoff */
} else { /* reg arg -> spilled */
- /* rd->argfltregs[md->params[p].regoff -> var->vv.regoff * 4 */
+ /* rd->argfltregs[md->params[p].regoff -> var->vv.regoff * 8 */
}
}
if (!(var->flags & INMEMORY)) { /* stack-arg -> register */
if (t == TYPE_FLT) {
emit_flds_membase(
- cd, REG_SP, (cd->stackframesize + s1) * 4 + 4);
+ cd, REG_SP, cd->stackframesize * 8 + s1 + 4);
assert(0);
/* emit_fstp_reg(cd, var->vv.regoff + fpu_st_offset); */
}
else {
emit_fldl_membase(
- cd, REG_SP, (cd->stackframesize + s1) * 4 + 4);
+ cd, REG_SP, cd->stackframesize * 8 + s1 + 4);
assert(0);
/* emit_fstp_reg(cd, var->vv.regoff + fpu_st_offset); */
}
/* no copy avoiding by now possible with SSA */
if (ls != NULL) {
emit_mov_membase_reg(
- cd, REG_SP, (cd->stackframesize + s1) * 4 + 4, REG_ITMP1);
+ cd, REG_SP, cd->stackframesize * 8 + s1 + 4, REG_ITMP1);
emit_mov_reg_membase(
- cd, REG_ITMP1, REG_SP, var->vv.regoff * 4);
+ cd, REG_ITMP1, REG_SP, var->vv.regoff);
if (t == TYPE_FLT) {
emit_flds_membase(
- cd, REG_SP, (cd->stackframesize + s1) * 4 + 4);
- emit_fstps_membase(cd, REG_SP, var->vv.regoff * 4);
+ cd, REG_SP, cd->stackframesize * 8 + s1 + 4);
+ emit_fstps_membase(cd, REG_SP, var->vv.regoff);
}
else {
emit_fldl_membase(
- cd, REG_SP, (cd->stackframesize + s1) * 4 + 4);
- emit_fstpl_membase(cd, REG_SP, var->vv.regoff * 4);
+ cd, REG_SP, cd->stackframesize * 8 + s1 + 4);
+ emit_fstpl_membase(cd, REG_SP, var->vv.regoff);
}
}
else
#endif /*defined(ENABLE_SSA)*/
- /* reuse Stackslotand avoid copying */
- var->vv.regoff = cd->stackframesize + s1 + 1;
+ /* reuse stackslot */
+ var->vv.regoff = cd->stackframesize * 8 + 4 + s1;
}
}
}
- } /* end for */
+ }
/* call monitorenter function */
M_MOV_IMM(&m->class->object.header, REG_ITMP1);
}
else {
- M_ALD(REG_ITMP1, REG_SP, cd->stackframesize * 4 + 4);
+ M_ALD(REG_ITMP1, REG_SP, cd->stackframesize * 8 + 4);
M_TEST(REG_ITMP1);
M_BNE(6);
M_ALD_MEM(REG_ITMP1, EXCEPTION_HARDWARE_NULLPOINTER);
}
- M_AST(REG_ITMP1, REG_SP, s1 * 4);
+ M_AST(REG_ITMP1, REG_SP, s1 * 8);
M_AST(REG_ITMP1, REG_SP, 0 * 4);
M_MOV_IMM(LOCK_monitor_enter, REG_ITMP3);
M_CALL(REG_ITMP3);
}
#if defined(ENABLE_SSA)
- /* with SSA Header is Basic Block 0 - insert phi Moves if necessary */
+ /* with SSA the Header is Basic Block 0 - insert phi Moves if necessary */
if ( ls != NULL)
- codegen_insert_phi_moves(jd, ls->basicblocks[0]);
+ codegen_emit_phi_moves(jd, ls->basicblocks[0]);
#endif
/* end of header generation */
case ICMD_COPY:
case ICMD_MOVE:
- emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+ emit_copy(jd, iptr);
break;
case ICMD_ASTORE:
if (!(iptr->flags.bits & INS_FLAG_RETADDR))
- emit_copy(jd, iptr, VAROP(iptr->s1), VAROP(iptr->dst));
+ emit_copy(jd, iptr);
break;
if (iptr->s1.var->flags & INMEMORY) {
/* Alpha algorithm */
disp = 3;
- CALCOFFSETBYTES(disp, REG_SP, iptr->s1.var->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, iptr->s1.var->vv.regoff * 8);
disp += 3;
- CALCOFFSETBYTES(disp, REG_SP, iptr->s1.var->vv.regoff * 4 + 4);
+ CALCOFFSETBYTES(disp, REG_SP, iptr->s1.var->vv.regoff * 8 + 4);
disp += 2;
disp += 3;
disp += 3;
disp += 2;
- emit_mov_membase_reg(cd, REG_SP, iptr->s1.var->vv.regoff * 4, REG_ITMP1);
- emit_mov_membase_reg(cd, REG_SP, iptr->s1.var->vv.regoff * 4 + 4, REG_ITMP2);
+ emit_mov_membase_reg(cd, REG_SP, iptr->s1.var->vv.regoff * 8, REG_ITMP1);
+ emit_mov_membase_reg(cd, REG_SP, iptr->s1.var->vv.regoff * 8 + 4, REG_ITMP2);
emit_alu_imm_reg(cd, ALU_AND, iptr->sx.val.l, REG_ITMP1);
emit_alu_imm_reg(cd, ALU_AND, iptr->sx.val.l >> 32, REG_ITMP2);
- emit_alu_imm_membase(cd, ALU_CMP, 0, REG_SP, iptr->s1.var->vv.regoff * 4 + 4);
+ emit_alu_imm_membase(cd, ALU_CMP, 0, REG_SP, iptr->s1.var->vv.regoff * 8 + 4);
emit_jcc(cd, CC_GE, disp);
- emit_mov_membase_reg(cd, REG_SP, iptr->s1.var->vv.regoff * 4, REG_ITMP1);
- emit_mov_membase_reg(cd, REG_SP, iptr->s1.var->vv.regoff * 4 + 4, REG_ITMP2);
+ emit_mov_membase_reg(cd, REG_SP, iptr->s1.var->vv.regoff * 8, REG_ITMP1);
+ emit_mov_membase_reg(cd, REG_SP, iptr->s1.var->vv.regoff * 8 + 4, REG_ITMP2);
emit_neg_reg(cd, REG_ITMP1);
emit_alu_imm_reg(cd, ALU_ADC, 0, REG_ITMP2);
emit_alu_imm_reg(cd, ALU_ADC, 0, REG_ITMP2);
emit_neg_reg(cd, REG_ITMP2);
- emit_mov_reg_membase(cd, REG_ITMP1, REG_SP, iptr->dst.var->vv.regoff * 4);
- emit_mov_reg_membase(cd, REG_ITMP2, REG_SP, iptr->dst.var->vv.regoff * 4 + 4);
+ emit_mov_reg_membase(cd, REG_ITMP1, REG_SP, iptr->dst.var->vv.regoff * 8);
+ emit_mov_reg_membase(cd, REG_ITMP2, REG_SP, iptr->dst.var->vv.regoff * 8 + 4);
}
}
d = codegen_reg_of_dst(jd, iptr, REG_FTMP1);
if (var->flags & INMEMORY) {
- emit_fildl_membase(cd, REG_SP, var->vv.regoff * 4);
+ emit_fildl_membase(cd, REG_SP, var->vv.regoff);
} else {
/* XXX not thread safe! */
disp = dseg_add_unique_s4(cd, 0);
var = VAROP(iptr->s1);
d = codegen_reg_of_dst(jd, iptr, REG_FTMP1);
if (var->flags & INMEMORY) {
- emit_fildll_membase(cd, REG_SP, var->vv.regoff * 4);
+ emit_fildll_membase(cd, REG_SP, var->vv.regoff);
} else {
log_text("L2F: longs have to be in memory");
var1 = VAROP(iptr->s1);
if (var->flags & INMEMORY) {
- emit_fistpl_membase(cd, REG_SP, var->vv.regoff * 4);
+ emit_fistpl_membase(cd, REG_SP, var->vv.regoff);
/* Round to nearest, 53-bit mode, exceptions masked */
disp = dseg_add_s4(cd, 0x027f);
emit_fldcw_membase(cd, REG_ITMP1, disp);
emit_alu_imm_membase(cd, ALU_CMP, 0x80000000,
- REG_SP, var->vv.regoff * 4);
+ REG_SP, var->vv.regoff);
disp = 3;
- CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
disp += 5 + 2 + 3;
- CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
} else {
/* XXX not thread safe! */
emit_alu_imm_reg(cd, ALU_CMP, 0x80000000, var->vv.regoff);
disp = 3;
- CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
disp += 5 + 2 + ((REG_RESULT == var->vv.regoff) ? 0 : 2);
}
emit_jcc(cd, CC_NE, disp);
/* XXX: change this when we use registers */
- emit_flds_membase(cd, REG_SP, var1->vv.regoff * 4);
+ emit_flds_membase(cd, REG_SP, var1->vv.regoff);
emit_mov_imm_reg(cd, (ptrint) asm_builtin_f2i, REG_ITMP1);
emit_call_reg(cd, REG_ITMP1);
if (var->flags & INMEMORY) {
- emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff * 4);
+ emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff);
} else {
M_INTMOVE(REG_RESULT, var->vv.regoff);
var1 = VAROP(iptr->s1);
if (var->flags & INMEMORY) {
- emit_fistpl_membase(cd, REG_SP, var->vv.regoff * 4);
+ emit_fistpl_membase(cd, REG_SP, var->vv.regoff);
/* Round to nearest, 53-bit mode, exceptions masked */
disp = dseg_add_s4(cd, 0x027f);
emit_fldcw_membase(cd, REG_ITMP1, disp);
emit_alu_imm_membase(cd, ALU_CMP, 0x80000000,
- REG_SP, var->vv.regoff * 4);
+ REG_SP, var->vv.regoff);
disp = 3;
- CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
disp += 5 + 2 + 3;
- CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
} else {
/* XXX not thread safe! */
emit_alu_imm_reg(cd, ALU_CMP, 0x80000000, var->vv.regoff);
disp = 3;
- CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
disp += 5 + 2 + ((REG_RESULT == var->vv.regoff) ? 0 : 2);
}
emit_jcc(cd, CC_NE, disp);
/* XXX: change this when we use registers */
- emit_fldl_membase(cd, REG_SP, var1->vv.regoff * 4);
+ emit_fldl_membase(cd, REG_SP, var1->vv.regoff);
emit_mov_imm_reg(cd, (ptrint) asm_builtin_d2i, REG_ITMP1);
emit_call_reg(cd, REG_ITMP1);
if (var->flags & INMEMORY) {
- emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff * 4);
+ emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff);
} else {
M_INTMOVE(REG_RESULT, var->vv.regoff);
}
var1 = VAROP(iptr->s1);
if (var->flags & INMEMORY) {
- emit_fistpll_membase(cd, REG_SP, var->vv.regoff * 4);
+ emit_fistpll_membase(cd, REG_SP, var->vv.regoff);
/* Round to nearest, 53-bit mode, exceptions masked */
disp = dseg_add_s4(cd, 0x027f);
emit_fldcw_membase(cd, REG_ITMP1, disp);
emit_alu_imm_membase(cd, ALU_CMP, 0x80000000,
- REG_SP, var->vv.regoff * 4 + 4);
+ REG_SP, var->vv.regoff + 4);
disp = 6 + 4;
- CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
disp += 3;
- CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
disp += 5 + 2;
disp += 3;
- CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
disp += 3;
- CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4 + 4);
+ CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff + 4);
emit_jcc(cd, CC_NE, disp);
emit_alu_imm_membase(cd, ALU_CMP, 0,
- REG_SP, var->vv.regoff * 4);
+ REG_SP, var->vv.regoff);
disp = 3;
- CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
disp += 5 + 2 + 3;
- CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
emit_jcc(cd, CC_NE, disp);
/* XXX: change this when we use registers */
- emit_flds_membase(cd, REG_SP, var1->vv.regoff * 4);
+ emit_flds_membase(cd, REG_SP, var1->vv.regoff);
emit_mov_imm_reg(cd, (ptrint) asm_builtin_f2l, REG_ITMP1);
emit_call_reg(cd, REG_ITMP1);
- emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff * 4);
+ emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff);
emit_mov_reg_membase(cd, REG_RESULT2,
- REG_SP, var->vv.regoff * 4 + 4);
+ REG_SP, var->vv.regoff + 4);
} else {
log_text("F2L: longs have to be in memory");
var1 = VAROP(iptr->s1);
if (var->flags & INMEMORY) {
- emit_fistpll_membase(cd, REG_SP, var->vv.regoff * 4);
+ emit_fistpll_membase(cd, REG_SP, var->vv.regoff);
/* Round to nearest, 53-bit mode, exceptions masked */
disp = dseg_add_s4(cd, 0x027f);
emit_fldcw_membase(cd, REG_ITMP1, disp);
emit_alu_imm_membase(cd, ALU_CMP, 0x80000000,
- REG_SP, var->vv.regoff * 4 + 4);
+ REG_SP, var->vv.regoff + 4);
disp = 6 + 4;
- CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
disp += 3;
- CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
disp += 5 + 2;
disp += 3;
- CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
disp += 3;
- CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4 + 4);
+ CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff + 4);
emit_jcc(cd, CC_NE, disp);
- emit_alu_imm_membase(cd, ALU_CMP, 0, REG_SP, var->vv.regoff * 4);
+ emit_alu_imm_membase(cd, ALU_CMP, 0, REG_SP, var->vv.regoff);
disp = 3;
- CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var1->vv.regoff);
disp += 5 + 2 + 3;
- CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff * 4);
+ CALCOFFSETBYTES(disp, REG_SP, var->vv.regoff);
emit_jcc(cd, CC_NE, disp);
/* XXX: change this when we use registers */
- emit_fldl_membase(cd, REG_SP, var1->vv.regoff * 4);
+ emit_fldl_membase(cd, REG_SP, var1->vv.regoff);
emit_mov_imm_reg(cd, (ptrint) asm_builtin_d2l, REG_ITMP1);
emit_call_reg(cd, REG_ITMP1);
- emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff * 4);
+ emit_mov_reg_membase(cd, REG_RESULT, REG_SP, var->vv.regoff);
emit_mov_reg_membase(cd, REG_RESULT2,
- REG_SP, var->vv.regoff * 4 + 4);
+ REG_SP, var->vv.regoff + 4);
} else {
log_text("D2L: longs have to be in memory");
assert(var->flags & INMEMORY);
emit_mov_memindex_reg(cd, OFFSET(java_longarray, data[0]),
s1, s2, 3, REG_ITMP3);
- emit_mov_reg_membase(cd, REG_ITMP3, REG_SP, var->vv.regoff * 4);
+ emit_mov_reg_membase(cd, REG_ITMP3, REG_SP, var->vv.regoff);
emit_mov_memindex_reg(cd, OFFSET(java_longarray, data[0]) + 4,
s1, s2, 3, REG_ITMP3);
- emit_mov_reg_membase(cd, REG_ITMP3, REG_SP, var->vv.regoff * 4 + 4);
+ emit_mov_reg_membase(cd, REG_ITMP3, REG_SP, var->vv.regoff + 4);
break;
case ICMD_FALOAD: /* ..., arrayref, index ==> ..., value */
var = VAROP(iptr->sx.s23.s3);
assert(var->flags & INMEMORY);
- emit_mov_membase_reg(cd, REG_SP, var->vv.regoff * 4, REG_ITMP3);
+ emit_mov_membase_reg(cd, REG_SP, var->vv.regoff, REG_ITMP3);
emit_mov_reg_memindex(cd, REG_ITMP3, OFFSET(java_longarray, data[0])
, s1, s2, 3);
- emit_mov_membase_reg(cd, REG_SP, var->vv.regoff * 4 + 4, REG_ITMP3);
+ emit_mov_membase_reg(cd, REG_SP, var->vv.regoff + 4, REG_ITMP3);
emit_mov_reg_memindex(cd, REG_ITMP3,
OFFSET(java_longarray, data[0]) + 4, s1, s2, 3);
break;
#if defined(ENABLE_SSA)
if ( ls != NULL ) {
last_cmd_was_goto = true;
+
/* In case of a Goto phimoves have to be inserted before the */
/* jump */
- codegen_insert_phi_moves(jd, bptr);
+
+ codegen_emit_phi_moves(jd, bptr);
}
#endif
emit_br(cd, iptr->dst.block);
#if defined(ENABLE_THREADS)
if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
- M_ALD(REG_ITMP2, REG_SP, rd->memuse * 4);
+ M_ALD(REG_ITMP2, REG_SP, rd->memuse * 8);
/* we need to save the proper return value */
switch (iptr->opc) {
case ICMD_IRETURN:
case ICMD_ARETURN:
- M_IST(REG_RESULT, REG_SP, rd->memuse * 4);
+ M_IST(REG_RESULT, REG_SP, rd->memuse * 8);
break;
case ICMD_LRETURN:
- M_LST(REG_RESULT_PACKED, REG_SP, rd->memuse * 4);
+ M_LST(REG_RESULT_PACKED, REG_SP, rd->memuse * 8);
break;
case ICMD_FRETURN:
- emit_fstps_membase(cd, REG_SP, rd->memuse * 4);
+ emit_fstps_membase(cd, REG_SP, rd->memuse * 8);
break;
case ICMD_DRETURN:
- emit_fstpl_membase(cd, REG_SP, rd->memuse * 4);
+ emit_fstpl_membase(cd, REG_SP, rd->memuse * 8);
break;
}
switch (iptr->opc) {
case ICMD_IRETURN:
case ICMD_ARETURN:
- M_ILD(REG_RESULT, REG_SP, rd->memuse * 4);
+ M_ILD(REG_RESULT, REG_SP, rd->memuse * 8);
break;
case ICMD_LRETURN:
- M_LLD(REG_RESULT_PACKED, REG_SP, rd->memuse * 4);
+ M_LLD(REG_RESULT_PACKED, REG_SP, rd->memuse * 8);
break;
case ICMD_FRETURN:
- emit_flds_membase(cd, REG_SP, rd->memuse * 4);
+ emit_flds_membase(cd, REG_SP, rd->memuse * 8);
break;
case ICMD_DRETURN:
- emit_fldl_membase(cd, REG_SP, rd->memuse * 4);
+ emit_fldl_membase(cd, REG_SP, rd->memuse * 8);
break;
}
}
/* restore saved registers */
for (i = INT_SAV_CNT - 1; i >= rd->savintreguse; i--) {
- p--; M_ALD(rd->savintregs[i], REG_SP, p * 4);
+ p--; M_ALD(rd->savintregs[i], REG_SP, p * 8);
}
for (i = FLT_SAV_CNT - 1; i >= rd->savfltreguse; i--) {
p--;
- emit_fldl_membase(cd, REG_SP, p * 4);
+ emit_fldl_membase(cd, REG_SP, p * 8);
if (iptr->opc == ICMD_FRETURN || iptr->opc == ICMD_DRETURN) {
assert(0);
/* emit_fstp_reg(cd, rd->savfltregs[i] + fpu_st_offset + 1); */
/* deallocate stack */
if (cd->stackframesize)
- M_AADD_IMM(cd->stackframesize * 4, REG_SP);
+ M_AADD_IMM(cd->stackframesize * 8, REG_SP);
emit_ret(cd);
}
case ICMD_BUILTIN: /* ..., [arg1, [arg2 ...]] ==> ... */
+ REPLACEMENT_POINT_FORGC_BUILTIN(cd, iptr);
+
bte = iptr->sx.s23.s3.bte;
md = bte->md;
goto gen_method;
} else {
if (IS_2_WORD_TYPE(var->type)) {
d = emit_load(jd, iptr, var, REG_ITMP12_PACKED);
- M_LST(d, REG_SP, md->params[s3].regoff * 4);
+ M_LST(d, REG_SP, md->params[s3].regoff);
} else {
d = emit_load(jd, iptr, var, REG_ITMP1);
- M_IST(d, REG_SP, md->params[s3].regoff * 4);
+ M_IST(d, REG_SP, md->params[s3].regoff);
}
}
} else {
d = emit_load(jd, iptr, var, REG_FTMP1);
if (IS_2_WORD_TYPE(var->type))
- M_DST(d, REG_SP, md->params[s3].regoff * 4);
+ M_DST(d, REG_SP, md->params[s3].regoff);
else
- M_FST(d, REG_SP, md->params[s3].regoff * 4);
+ M_FST(d, REG_SP, md->params[s3].regoff);
}
}
} /* end of for */
switch (iptr->opc) {
case ICMD_BUILTIN:
- disp = (ptrint) bte->fp;
d = md->returntype.type;
- M_MOV_IMM(disp, REG_ITMP1);
+ if (bte->stub == NULL) {
+ M_MOV_IMM(bte->fp, REG_ITMP1);
+ } else {
+ M_MOV_IMM(bte->stub, REG_ITMP1);
+ }
M_CALL(REG_ITMP1);
emit_exception_check(cd, iptr);
break;
case ICMD_INVOKESPECIAL:
- M_ALD(REG_ITMP1, REG_SP, 0 * 4);
+ M_ALD(REG_ITMP1, REG_SP, 0 * 8);
emit_nullpointer_check(cd, iptr, REG_ITMP1);
/* fall through */
break;
case ICMD_INVOKEVIRTUAL:
- M_ALD(REG_ITMP1, REG_SP, 0 * 4);
+ M_ALD(REG_ITMP1, REG_SP, 0 * 8);
emit_nullpointer_check(cd, iptr, s1);
if (lm == NULL) {
break;
case ICMD_INVOKEINTERFACE:
- M_ALD(REG_ITMP1, REG_SP, 0 * 4);
+ M_ALD(REG_ITMP1, REG_SP, 0 * 8);
emit_nullpointer_check(cd, iptr, s1);
if (lm == NULL) {
/* store size of call code in replacement point */
REPLACEMENT_POINT_INVOKE_RETURN(cd, iptr);
+ REPLACEMENT_POINT_FORGC_BUILTIN_RETURN(cd, iptr);
/* d contains return type */
if (d != TYPE_VOID) {
#if defined(ENABLE_SSA)
- if ((ls == NULL) || (!IS_TEMPVAR_INDEX(iptr->dst.varindex)) ||
- (ls->lifetime[-iptr->dst.varindex-1].type != -1))
+ if ((ls == NULL) /* || (!IS_TEMPVAR_INDEX(iptr->dst.varindex)) */ ||
+ (ls->lifetime[iptr->dst.varindex].type != UNUSED))
/* a "living" stackslot */
#endif
{
case ICMD_CHECKCAST: /* ..., objectref ==> ..., objectref */
- /* val.a: (classinfo*) superclass */
-
- /* superclass is an interface:
- *
- * OK if ((sub == NULL) ||
- * (sub->vftbl->interfacetablelength > super->index) &&
- * (sub->vftbl->interfacetable[-super->index] != NULL));
- *
- * superclass is a class:
- *
- * OK if ((sub == NULL) || (0
- * <= (sub->vftbl->baseval - super->vftbl->baseval) <=
- * super->vftbl->diffval));
- */
if (!(iptr->flags.bits & INS_FLAG_ARRAY)) {
/* object type cast-check */
supervftbl = super->vftbl;
}
-#if defined(ENABLE_THREADS)
- codegen_threadcritrestart(cd, cd->mcodeptr - cd->mcodebase);
-#endif
+ if ((super == NULL) || !(super->flags & ACC_INTERFACE))
+ CODEGEN_CRITICAL_SECTION_NEW;
+
s1 = emit_load_s1(jd, iptr, REG_ITMP1);
/* if class is not resolved, check which code to call */
}
M_MOV_IMM(supervftbl, REG_ITMP3);
-#if defined(ENABLE_THREADS)
- codegen_threadcritstart(cd, cd->mcodeptr - cd->mcodebase);
-#endif
+
+ CODEGEN_CRITICAL_SECTION_START;
+
M_ILD32(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, baseval));
/* if (s1 != REG_ITMP1) { */
M_ISUB(REG_ITMP3, REG_ITMP2);
M_MOV_IMM(supervftbl, REG_ITMP3);
M_ILD(REG_ITMP3, REG_ITMP3, OFFSET(vftbl_t, diffval));
-#if defined(ENABLE_THREADS)
- codegen_threadcritstop(cd, cd->mcodeptr - cd->mcodebase);
-#endif
+
+ CODEGEN_CRITICAL_SECTION_END;
+
/* } */
M_CMP(REG_ITMP3, REG_ITMP2);
break;
case ICMD_INSTANCEOF: /* ..., objectref ==> ..., intresult */
- /* val.a: (classinfo*) superclass */
-
- /* superclass is an interface:
- *
- * return (sub != NULL) &&
- * (sub->vftbl->interfacetablelength > super->index) &&
- * (sub->vftbl->interfacetable[-super->index] != NULL);
- *
- * superclass is a class:
- *
- * return ((sub != NULL) && (0
- * <= (sub->vftbl->baseval - super->vftbl->baseval) <=
- * super->vftbl->diffvall));
- */
{
classinfo *super;
supervftbl = super->vftbl;
}
-#if defined(ENABLE_THREADS)
- codegen_threadcritrestart(cd, cd->mcodeptr - cd->mcodebase);
-#endif
+ if ((super == NULL) || !(super->flags & ACC_INTERFACE))
+ CODEGEN_CRITICAL_SECTION_NEW;
s1 = emit_load_s1(jd, iptr, REG_ITMP1);
d = codegen_reg_of_dst(jd, iptr, REG_ITMP2);
}
M_MOV_IMM(supervftbl, REG_ITMP2);
-#if defined(ENABLE_THREADS)
- codegen_threadcritstart(cd, cd->mcodeptr - cd->mcodebase);
-#endif
+
+ CODEGEN_CRITICAL_SECTION_START;
+
M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl_t, baseval));
M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl_t, diffval));
M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, baseval));
-#if defined(ENABLE_THREADS)
- codegen_threadcritstop(cd, cd->mcodeptr - cd->mcodebase);
-#endif
+
+ CODEGEN_CRITICAL_SECTION_END;
+
M_ISUB(REG_ITMP2, REG_ITMP1);
M_CLR(d); /* may be REG_ITMP2 */
M_CMP(REG_ITMP3, REG_ITMP1);
/* Already Preallocated? */
if (!(var->flags & PREALLOC)) {
if (var->flags & INMEMORY) {
- M_ILD(REG_ITMP1, REG_SP, var->vv.regoff * 4);
+ M_ILD(REG_ITMP1, REG_SP, var->vv.regoff);
M_IST(REG_ITMP1, REG_SP, (s1 + 3) * 4);
}
else
#endif
#if defined(ENABLE_SSA)
if ( ls != NULL ) {
+
/* by edge splitting, in Blocks with phi moves there can only */
/* be a goto as last command, no other Jump/Branch Command */
+
if (!last_cmd_was_goto)
- codegen_insert_phi_moves(jd, bptr);
+ codegen_emit_phi_moves(jd, bptr);
}
#endif
/* generate stubs */
emit_patcher_stubs(jd);
- REPLACEMENT_EMIT_STUBS(jd);
/* everything's ok */
return true;
}
-#if defined(ENABLE_SSA)
-void codegen_insert_phi_moves(jitdata *jd, basicblock *bptr) {
- /* look for phi moves */
- int t_a,s_a,i, type;
- int t_lt, s_lt; /* lifetime indices of phi_moves */
- s4 t_regoff, s_regoff, s_flags, t_flags;
- codegendata *cd;
- lsradata *ls;
-
- MCODECHECK(512);
-
- ls = jd->ls;
- cd = jd->cd;
-
- /* Moves from phi functions with highest indices have to be */
- /* inserted first, since this is the order as is used for */
- /* conflict resolution */
- for(i = ls->num_phi_moves[bptr->nr] - 1; i >= 0 ; i--) {
- t_a = ls->phi_moves[bptr->nr][i][0];
- s_a = ls->phi_moves[bptr->nr][i][1];
-#if defined(SSA_DEBUG_VERBOSE)
- if (compileverbose)
- printf("BB %3i Move %3i <- %3i ", bptr->nr, t_a, s_a);
-#endif
- if (t_a >= 0) {
- /* local var lifetimes */
- t_lt = ls->maxlifetimes + t_a;
- type = ls->lifetime[t_lt].type;
- }
- else {
- t_lt = -t_a-1;
- type = ls->lifetime[t_lt].local_ss->s->type;
- /* stackslot lifetime */
- }
-
- if (type == -1) {
-#if defined(SSA_DEBUG_VERBOSE)
- if (compileverbose)
- printf("...returning - phi lifetimes where joined\n");
-#endif
- return;
- }
-
- if (s_a >= 0) {
- /* local var lifetimes */
- s_lt = ls->maxlifetimes + s_a;
- type = ls->lifetime[s_lt].type;
- }
- else {
- s_lt = -s_a-1;
- type = ls->lifetime[s_lt].type;
- /* stackslot lifetime */
- }
-
- if (type == -1) {
-#if defined(SSA_DEBUG_VERBOSE)
- if (compileverbose)
- printf("...returning - phi lifetimes where joined\n");
-#endif
- return;
- }
-
- if (t_a >= 0) {
- t_flags = VAR(t_a)->flags;
- t_regoff = VAR(t_a)->vv.regoff;
-
- }
- else {
- t_flags = ls->lifetime[t_lt].local_ss->s->flags;
- t_regoff = ls->lifetime[t_lt].local_ss->s->regoff;
- }
-
- if (s_a >= 0) {
- /* local var move */
- s_flags = VAR(s_a)->flags;
- s_regoff = VAR(s_a)->vv.regoff;
- } else {
- /* stackslot lifetime */
- s_flags = ls->lifetime[s_lt].local_ss->s->flags;
- s_regoff = ls->lifetime[s_lt].local_ss->s->regoff;
- }
-
- if (type == -1) {
-#if defined(SSA_DEBUG_VERBOSE)
- if (compileverbose)
- printf("...returning - phi lifetimes where joined\n");
-#endif
- return;
- }
-
- cg_move(cd, type, s_regoff, s_flags, t_regoff, t_flags);
-
-#if defined(SSA_DEBUG_VERBOSE)
- if (compileverbose) {
- if (IS_INMEMORY(t_flags) && IS_INMEMORY(s_flags)) {
- /* mem -> mem */
- printf("M%3i <- M%3i",t_regoff,s_regoff);
- }
- else if (IS_INMEMORY(s_flags)) {
- /* mem -> reg */
- printf("R%3i <- M%3i",t_regoff,s_regoff);
- }
- else if (IS_INMEMORY(t_flags)) {
- /* reg -> mem */
- printf("M%3i <- R%3i",t_regoff,s_regoff);
- }
- else {
- /* reg -> reg */
- printf("R%3i <- R%3i",t_regoff,s_regoff);
- }
- printf("\n");
- }
-#endif /* defined(SSA_DEBUG_VERBOSE) */
- }
-}
-
-void cg_move(codegendata *cd, s4 type, s4 src_regoff, s4 src_flags,
- s4 dst_regoff, s4 dst_flags) {
- if ((IS_INMEMORY(dst_flags)) && (IS_INMEMORY(src_flags))) {
- /* mem -> mem */
- if (dst_regoff != src_regoff) {
- if (!IS_2_WORD_TYPE(type)) {
- if (IS_FLT_DBL_TYPE(type)) {
- emit_flds_membase(cd, REG_SP, src_regoff * 4);
- emit_fstps_membase(cd, REG_SP, dst_regoff * 4);
- } else{
- emit_mov_membase_reg(cd, REG_SP, src_regoff * 4,
- REG_ITMP1);
- emit_mov_reg_membase(cd, REG_ITMP1, REG_SP, dst_regoff * 4);
- }
- } else { /* LONG OR DOUBLE */
- if (IS_FLT_DBL_TYPE(type)) {
- emit_fldl_membase( cd, REG_SP, src_regoff * 4);
- emit_fstpl_membase(cd, REG_SP, dst_regoff * 4);
- } else {
- emit_mov_membase_reg(cd, REG_SP, src_regoff * 4,
- REG_ITMP1);
- emit_mov_reg_membase(cd, REG_ITMP1, REG_SP, dst_regoff * 4);
- emit_mov_membase_reg(cd, REG_SP, src_regoff * 4 + 4,
- REG_ITMP1);
- emit_mov_reg_membase(cd, REG_ITMP1, REG_SP,
- dst_regoff * 4 + 4);
- }
- }
- }
- } else {
- if (IS_FLT_DBL_TYPE(type)) {
- log_text("cg_move: flt/dbl type have to be in memory\n");
-/* assert(0); */
- }
- if (IS_2_WORD_TYPE(type)) {
- log_text("cg_move: longs have to be in memory\n");
-/* assert(0); */
- }
- if (IS_INMEMORY(src_flags)) {
- /* mem -> reg */
- emit_mov_membase_reg(cd, REG_SP, src_regoff * 4, dst_regoff);
- } else if (IS_INMEMORY(dst_flags)) {
- /* reg -> mem */
- emit_mov_reg_membase(cd, src_regoff, REG_SP, dst_regoff * 4);
- } else {
- /* reg -> reg */
- /* only ints can be in regs on i386 */
- M_INTMOVE(src_regoff,dst_regoff);
- }
- }
-}
-#endif /* defined(ENABLE_SSA) */
-
-
/* codegen_emit_stub_compiler **************************************************
Emit a stub routine which calls the compiler.
*******************************************************************************/
-void codegen_emit_stub_builtin(jitdata *jd, methoddesc *md, functionptr f)
+void codegen_emit_stub_builtin(jitdata *jd, builtintable_entry *bte)
{
codeinfo *code;
codegendata *cd;
+ methoddesc *md;
s4 i;
s4 disp;
s4 s1, s2;
code = jd->code;
cd = jd->cd;
+ /* set some variables */
+
+ md = bte->md;
+
/* calculate stack frame size */
cd->stackframesize =
assert(0);
} else { /* float/double in memory can be copied like int/longs */
- s1 = (md->params[i].regoff + cd->stackframesize + 1) * 4;
+ s1 = md->params[i].regoff + cd->stackframesize * 4 + 4;
s2 = md->params[i].regoff;
M_ILD(REG_ITMP1, REG_SP, s1);
/* call the builtin function */
- M_MOV_IMM(f, REG_ITMP3);
+ M_MOV_IMM(bte->fp, REG_ITMP3);
M_CALL(REG_ITMP3);
/* save return value */
/* keep stack 16-byte aligned */
- cd->stackframesize |= 0x3;
+ ALIGN_ODD(cd->stackframesize); /* XXX this is wrong, +4 is missing */
/* create method header */
(void) dseg_add_unique_address(cd, code); /* CodeinfoPointer */
- (void) dseg_add_unique_s4(cd, cd->stackframesize * 4); /* FrameSize */
+ (void) dseg_add_unique_s4(cd, cd->stackframesize * 8); /* FrameSize */
(void) dseg_add_unique_s4(cd, 0); /* IsSync */
(void) dseg_add_unique_s4(cd, 0); /* IsLeaf */
(void) dseg_add_unique_s4(cd, 0); /* IntSave */
/* calculate stackframe size for native function */
- M_ASUB_IMM(cd->stackframesize * 4, REG_SP);
+ M_ASUB_IMM(cd->stackframesize * 8, REG_SP);
#if !defined(NDEBUG)
emit_verbosecall_enter(jd);
/* remember callee saved int registers in stackframeinfo (GC may need to */
/* recover them during a collection). */
- disp = cd->stackframesize * 4 - sizeof(stackframeinfo) +
+ disp = cd->stackframesize * 8 - sizeof(stackframeinfo) +
OFFSET(stackframeinfo, intregs);
for (i = 0; i < INT_SAV_CNT; i++)
/* prepare data structures for native function call */
M_MOV(REG_SP, REG_ITMP1);
- M_AADD_IMM(cd->stackframesize * 4, REG_ITMP1);
+ M_AADD_IMM(cd->stackframesize * 8, REG_ITMP1);
M_AST(REG_ITMP1, REG_SP, 0 * 4);
M_IST_IMM(0, REG_SP, 1 * 4);
dseg_adddata(cd);
M_MOV(REG_SP, REG_ITMP2);
- M_AADD_IMM(cd->stackframesize * 4 + SIZEOF_VOID_P, REG_ITMP2);
+ M_AADD_IMM(cd->stackframesize * 8 + SIZEOF_VOID_P, REG_ITMP2);
M_AST(REG_ITMP2, REG_SP, 2 * 4);
- M_ALD(REG_ITMP3, REG_SP, cd->stackframesize * 4);
+ M_ALD(REG_ITMP3, REG_SP, cd->stackframesize * 8);
M_AST(REG_ITMP3, REG_SP, 3 * 4);
M_MOV_IMM(codegen_start_native_call, REG_ITMP1);
M_CALL(REG_ITMP1);
if (!md->params[i].inmemory) {
/* no integer argument registers */
- } else { /* float/double in memory can be copied like int/longs */
- s1 = (md->params[i].regoff + cd->stackframesize + 1) * 4;
- s2 = nmd->params[j].regoff * 4;
+ }
+ else {
+ /* float/double in memory can be copied like int/longs */
+
+ s1 = md->params[i].regoff + cd->stackframesize * 8 + 4;
+ s2 = nmd->params[j].regoff;
M_ILD(REG_ITMP1, REG_SP, s1);
M_IST(REG_ITMP1, REG_SP, s2);
switch (md->returntype.type) {
case TYPE_INT:
case TYPE_ADR:
- M_IST(REG_RESULT, REG_SP, 1 * 4);
+ M_IST(REG_RESULT, REG_SP, 1 * 8);
break;
case TYPE_LNG:
- M_LST(REG_RESULT_PACKED, REG_SP, 1 * 4);
+ M_LST(REG_RESULT_PACKED, REG_SP, 1 * 8);
break;
case TYPE_FLT:
- emit_fsts_membase(cd, REG_SP, 1 * 4);
+ emit_fsts_membase(cd, REG_SP, 1 * 8);
break;
case TYPE_DBL:
- emit_fstl_membase(cd, REG_SP, 1 * 4);
+ emit_fstl_membase(cd, REG_SP, 1 * 8);
break;
case TYPE_VOID:
break;
/* remove native stackframe info */
M_MOV(REG_SP, REG_ITMP1);
- M_AADD_IMM(cd->stackframesize * 4, REG_ITMP1);
+ M_AADD_IMM(cd->stackframesize * 8, REG_ITMP1);
M_AST(REG_ITMP1, REG_SP, 0 * 4);
M_MOV_IMM(codegen_finish_native_call, REG_ITMP1);
switch (md->returntype.type) {
case TYPE_INT:
case TYPE_ADR:
- M_ILD(REG_RESULT, REG_SP, 1 * 4);
+ M_ILD(REG_RESULT, REG_SP, 1 * 8);
break;
case TYPE_LNG:
- M_LLD(REG_RESULT_PACKED, REG_SP, 1 * 4);
+ M_LLD(REG_RESULT_PACKED, REG_SP, 1 * 8);
break;
case TYPE_FLT:
- emit_flds_membase(cd, REG_SP, 1 * 4);
+ emit_flds_membase(cd, REG_SP, 1 * 8);
break;
case TYPE_DBL:
- emit_fldl_membase(cd, REG_SP, 1 * 4);
+ emit_fldl_membase(cd, REG_SP, 1 * 8);
break;
case TYPE_VOID:
break;
/* restore callee saved int registers from stackframeinfo (GC might have */
/* modified them during a collection). */
- disp = cd->stackframesize * 4 - sizeof(stackframeinfo) +
+ disp = cd->stackframesize * 8 - sizeof(stackframeinfo) +
OFFSET(stackframeinfo, intregs);
for (i = 0; i < INT_SAV_CNT; i++)
M_ALD(abi_registers_integer_saved[i], REG_SP, disp + i * 4);
#endif
- M_AADD_IMM(cd->stackframesize * 4, REG_SP);
+ M_AADD_IMM(cd->stackframesize * 8, REG_SP);
/* check for exception */