Changes: Christian Thalinger
Edwin Steiner
- $Id: asmpart.S 5776 2006-10-13 17:06:39Z tbfg $
+ $Id: asmpart.S 5824 2006-10-25 14:26:08Z tbfg $
*/
L_asm_call_jit_compiler_exception:
mflr r0
- stw r0,LA_LR_OFFSET(sp)
- stwu sp,-LA_SIZE_ALIGNED(sp) /* preserve linkage area */
+ std r0,LA_LR_OFFSET(sp)
+ stdu sp,-LA_SIZE_ALIGNED(sp) /* preserve linkage area */
bl exceptions_get_and_clear_exception
- lwz xpc,LA_SIZE_ALIGNED+LA_LR_OFFSET(sp)
+ ld xpc,LA_SIZE_ALIGNED+LA_LR_OFFSET(sp)
mtlr xpc
addi sp,sp,LA_SIZE_ALIGNED
#else
addi t3,t3,(ex_int2-ex_int1)@l
#endif
- slwi t2,t2,3 /* t2 = register count * 8 */
+ slwi t2,t2,2 /* t2 = register count * 4 */
subf t3,t2,t3 /* t3 = IntSave - t2 */
mtctr t3
bctr
ld s8,-1*8(t1)
ex_int2:
- subf t1,t2,t1 /* t1 = t1 - register count * 8 */
+ subf t1,t2,t1 /* t1 = t1 - register count * 4 */
lwz t2,FltSave(pv)
bl ex_flt1
ex_flt1:
#else
addi t3,t3,(ex_flt2-ex_flt1)@l
#endif
- slwi t2,t2,3 /* t2 = register count * 8 */
+ slwi t2,t2,2 /* t2 = register count * 4 */
subf t3,t2,t3 /* t3 = FltSave - t2 */
mtctr t3
bctr
mtctr itmp3
bctr
-/*********************************************************************/
-/*
-asm_cacheflush:
- .quad .asm_cacheflush,.TOC.@tocbase,0
- .previous
- .size asm_cacheflush,24
- .type .asm_cacheflush,@function
- .globl .asm_cacheflush
-*/
+/* asm_cacheflush **************************************************************
+ copied from linux/arch/ppc64/kernel/vdso64/cacheflush.S
+ assumes 128 byte cache line size.
+*******************************************************************************/
.asm_cacheflush:
+ /* construct the AND mask */
+ li r6, 0xffffffffffff8000
+ ori r6,r6,0x000000000000ff80
+
add r4,r3,r4
- rldimi r3,r3,0,26
- addi r4,r4,31
- rldimi r4,r4,0,26
+ and. r3,r3,r6
+ addi r4,r4,127
+ and. r4,r4,r6
mr r5,r3
1:
cmpld r3,r4
bge 0f
dcbst 0,r3
- addi r3,r3,32
+ addi r3,r3,128
b 1b
0:
sync
cmpld r5,r4
bge 0f
icbi 0,r5
- addi r5,r5,32
+ addi r5,r5,128
b 1b
0:
sync
isync
blr
-
.asm_getclassvalues_atomic:
_crit_restart:
_crit_begin:
Edwin Steiner
Roland Lezuo
- $Id: codegen.c 5785 2006-10-15 22:25:54Z edwin $
+ $Id: codegen.c 5824 2006-10-25 14:26:08Z tbfg $
*/
registerdata *rd;
s4 len, s1, s2, s3, d, disp;
ptrint a;
- s4 stackframesize;
varinfo *var;
basicblock *bptr;
instruction *iptr;
savedregs_num += (INT_SAV_CNT - rd->savintreguse);
savedregs_num += (FLT_SAV_CNT - rd->savfltreguse);
- stackframesize = rd->memuse + savedregs_num;
+ cd->stackframesize = rd->memuse + savedregs_num;
#if defined(ENABLE_THREADS)
/* space to save argument of monitor_enter and Return Values to survive */
/* reside in R3 */
if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
/* reserve 2 slots for long/double return values for monitorexit */
- stackframesize += 2;
+ cd->stackframesize += 2;
}
#endif
/* align stack to 16-bytes */
+/* FIXME */
/* if (!m->isleafmethod || opt_verbosecall) */
- stackframesize = (stackframesize + 3) & ~3;
-
+/* stackframesize = (stackframesize + 3) & ~3;
+*/
/* else if (m->isleafmethod && (stackframesize == LA_WORD_SIZE)) */
/* stackframesize = 0; */
(void) dseg_addaddress(cd, code); /* CodeinfoPointer */
- (void) dseg_adds4(cd, stackframesize * 8); /* FrameSize */
+ (void) dseg_adds4(cd, cd->stackframesize * 8); /* FrameSize */
#if defined(ENABLE_THREADS)
/* IsSync contains the offset relative to the stack pointer for the
M_AST(REG_ZERO, REG_SP, LA_LR_OFFSET);
}
- if (stackframesize)
- M_STDU(REG_SP, REG_SP, -stackframesize * 8);
+ if (cd->stackframesize)
+ M_STDU(REG_SP, REG_SP, -cd->stackframesize * 8);
/* save return address and used callee saved registers */
- p = stackframesize;
+ p = cd->stackframesize;
for (i = INT_SAV_CNT - 1; i >= rd->savintreguse; i--) {
p--; M_LST(rd->savintregs[i], REG_SP, p * 8);
}
} else { /* stack arguments */
if (!(var->flags & INMEMORY)) { /* stack arg -> register */
if (IS_2_WORD_TYPE(t))
- M_LLD(var->vv.regoff, REG_SP, (stackframesize + s1) * 4);
+ M_LLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
else
- M_ILD(var->vv.regoff, REG_SP, (stackframesize + s1) * 4);
+ M_ILD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
} else { /* stack arg -> spilled */
#if 1
- M_ILD(REG_ITMP1, REG_SP, (stackframesize + s1) * 4);
+ M_ILD(REG_ITMP1, REG_SP, (cd->stackframesize + s1) * 4);
M_IST(REG_ITMP1, REG_SP, var->vv.regoff * 4);
if (IS_2_WORD_TYPE(t)) {
- M_ILD(REG_ITMP1, REG_SP, (stackframesize + s1) * 4 +4);
+ M_ILD(REG_ITMP1, REG_SP, (cd->stackframesize + s1) * 4 +4);
M_IST(REG_ITMP1, REG_SP, var->vv.regoff * 4 + 4);
}
#else
/* Reuse Memory Position on Caller Stack */
- var->vv.regoff = stackframesize + s1;
+ var->vv.regoff = cd->stackframesize + s1;
#endif
}
}
} else { /* stack arguments */
if (!(var->flags & INMEMORY)) { /* stack-arg -> register */
if (IS_2_WORD_TYPE(t))
- M_DLD(var->vv.regoff, REG_SP, (stackframesize + s1) * 4);
+ M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
else
- M_FLD(var->vv.regoff, REG_SP, (stackframesize + s1) * 4);
+ M_FLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 4);
} else { /* stack-arg -> spilled */
#if 1
if (IS_2_WORD_TYPE(t)) {
- M_DLD(REG_FTMP1, REG_SP, (stackframesize + s1) * 4);
+ M_DLD(REG_FTMP1, REG_SP, (cd->stackframesize + s1) * 4);
M_DST(REG_FTMP1, REG_SP, var->vv.regoff * 4);
- var->vv.regoff = stackframesize + s1;
+ var->vv.regoff = cd->stackframesize + s1;
} else {
- M_FLD(REG_FTMP1, REG_SP, (stackframesize + s1) * 4);
+ M_FLD(REG_FTMP1, REG_SP, (cd->stackframesize + s1) * 4);
M_FST(REG_FTMP1, REG_SP, var->vv.regoff * 4);
}
#else
/* Reuse Memory Position on Caller Stack */
- var->vv.regoff = stackframesize + s1;
+ var->vv.regoff = cd->stackframesize + s1;
#endif
}
}
codegen_addreference(cd, iptr->dst.block);
break;
- case ICMD_IF_LLE: /* ..., value ==> ... */
s1 = emit_load_s1_low(jd, iptr, REG_ITMP1);
s2 = emit_load_s2_high(jd, iptr, REG_ITMP2);
codegen_addreference(cd, iptr->dst.block);
break;
- case ICMD_IF_LGE: /* ..., value ==> ... */
-
- /* TODO, remove me */
- s1 = emit_load_s1_low(jd, iptr, REG_ITMP1);
- s2 = emit_load_s2_high(jd, iptr, REG_ITMP2);
- if (iptr->sx.val.l == 0) {
- /* if high word is greater equal zero, the whole long is too */
- M_CMPI(s2, 0);
- } else if ((iptr->sx.val.l >= 0) && (iptr->sx.val.l <= 0xffff)) {
- M_CMPI(s2, 0);
- M_BGT(0);
- codegen_addreference(cd, iptr->dst.block);
- M_BLT(2);
- M_CMPUI(s1, iptr->sx.val.l & 0xffff);
- } else {
- ICONST(REG_ITMP3, iptr->sx.val.l >> 32);
- M_CMP(s2, REG_ITMP3);
- M_BGT(0);
- codegen_addreference(cd, iptr->dst.block);
- M_BLT(3);
- ICONST(REG_ITMP3, iptr->sx.val.l & 0xffffffff);
- M_CMPU(s1, REG_ITMP3);
- }
+ #endif
+ case ICMD_IF_LLT: /* ..., value ==> ... */
+ s1 = emit_load_s1(jd, iptr, REG_ITMP1);
+ LCONST(REG_ITMP2, iptr->sx.val.l);
+ M_CMP(s1, REG_ITMP2);
+ M_BLT(0);
+ codegen_addreference(cd, iptr->dst.block);
+ break;
+ case ICMD_IF_LLE: /* ..., value ==> ... */
+ s1 = emit_load_s1(jd, iptr, REG_ITMP1);
+ LCONST(REG_ITMP2, iptr->sx.val.l);
+ M_CMP(s1, REG_ITMP2);
+ M_BLE(0);
+ codegen_addreference(cd, iptr->dst.block);
+ break;
+ case ICMD_IF_LGE: /* ..., value ==> ... */
+ s1 = emit_load_s1(jd, iptr, REG_ITMP1);
+ LCONST(REG_ITMP2, iptr->sx.val.l);
+ M_CMP(s1, REG_ITMP2);
M_BGE(0);
codegen_addreference(cd, iptr->dst.block);
break;
- #endif
-
+ case ICMD_IF_LGT: /* ..., value ==> ... */
+ s1 = emit_load_s1(jd, iptr, REG_ITMP1);
+ LCONST(REG_ITMP2, iptr->sx.val.l);
+ M_CMP(s1, REG_ITMP2);
+ M_BGT(0);
+ codegen_addreference(cd, iptr->dst.block);
+ break;
case ICMD_IF_ICMPEQ: /* ..., value, value ==> ... */
case ICMD_IF_ACMPEQ: /* op1 = target JavaVM pc */
case ICMD_IF_LCMPEQ:
{
s4 i, p;
- p = stackframesize;
+ p = cd->stackframesize;
/* call trace function */
/* deallocate stack */
- if (stackframesize)
- M_LDA(REG_SP, REG_SP, stackframesize * 8);
+ if (cd->stackframesize)
+ M_LDA(REG_SP, REG_SP, cd->stackframesize * 8);
M_RET;
ALIGNCODENOP;
if (jd->isleafmethod) {
M_MFLR(REG_ZERO);
- M_AST(REG_ZERO, REG_SP, stackframesize * 8 + LA_LR_OFFSET);
+ M_AST(REG_ZERO, REG_SP, cd->stackframesize * 8 + LA_LR_OFFSET);
}
M_MOV(REG_PV, rd->argintregs[0]);
M_MOV(REG_ZERO, rd->argintregs[2]);
else
M_ALD(rd->argintregs[2],
- REG_SP, stackframesize * 8 + LA_LR_OFFSET);
+ REG_SP, cd->stackframesize * 8 + LA_LR_OFFSET);
M_MOV(REG_ITMP2_XPC, rd->argintregs[3]);
M_MOV(REG_ITMP1, rd->argintregs[4]);
if (jd->isleafmethod) {
/* XXX FIXME: REG_ZERO can cause problems here! */
- assert(stackframesize * 8 <= 32767);
+ assert(cd->stackframesize * 8 <= 32767);
- M_ALD(REG_ZERO, REG_SP, stackframesize * 8 + LA_LR_OFFSET);
+ M_ALD(REG_ZERO, REG_SP, cd->stackframesize * 8 + LA_LR_OFFSET);
M_MTLR(REG_ZERO);
}
codeinfo *code;
codegendata *cd;
registerdata *rd;
- s4 stackframesize; /* size of stackframe if needed */
methoddesc *md;
s4 nativeparams;
s4 i, j; /* count variables */
/* calculate stackframe size */
- stackframesize =
+ cd->stackframesize =
sizeof(stackframeinfo) / SIZEOF_VOID_P +
sizeof(localref_table) / SIZEOF_VOID_P +
4 + /* 4 stackframeinfo arguments (darwin)*/
nmd->paramcount +
nmd->memuse;
- stackframesize = (stackframesize + 3) & ~3; /* keep stack 16-byte aligned */
+ cd->stackframesize = (cd->stackframesize + 3) & ~3; /* keep stack 16-byte aligned */
/* create method header */
(void) dseg_addaddress(cd, code); /* CodeinfoPointer */
- (void) dseg_adds4(cd, stackframesize * 8); /* FrameSize */
+ (void) dseg_adds4(cd, cd->stackframesize * 8); /* FrameSize */
(void) dseg_adds4(cd, 0); /* IsSync */
(void) dseg_adds4(cd, 0); /* IsLeaf */
(void) dseg_adds4(cd, 0); /* IntSave */
M_MFLR(REG_ZERO);
M_AST_INTERN(REG_ZERO, REG_SP, LA_LR_OFFSET);
- M_STDU(REG_SP, REG_SP, -(stackframesize * 8));
+ M_STDU(REG_SP, REG_SP, -(cd->stackframesize * 8));
#if !defined(NDEBUG)
if (JITDATA_HAS_FLAG_VERBOSECALL(jd)) {
/* create native stack info */
- M_AADD_IMM(REG_SP, stackframesize * 8, rd->argintregs[0]);
+ M_AADD_IMM(REG_SP, cd->stackframesize * 8, rd->argintregs[0]);
M_MOV(REG_PV, rd->argintregs[1]);
- M_AADD_IMM(REG_SP, stackframesize * 8, rd->argintregs[2]);
- M_ALD(rd->argintregs[3], REG_SP, stackframesize * 8 + LA_LR_OFFSET);
+ M_AADD_IMM(REG_SP, cd->stackframesize * 8, rd->argintregs[2]);
+ M_ALD(rd->argintregs[3], REG_SP, cd->stackframesize * 8 + LA_LR_OFFSET);
disp = dseg_addaddress(cd, codegen_start_native_call);
M_ALD(REG_ITMP1, REG_PV, disp);
}
} else {
- s1 = md->params[i].regoff + stackframesize;
+ s1 = md->params[i].regoff + cd->stackframesize;
s2 = nmd->params[j].regoff;
M_LLD(REG_ITMP1, REG_SP, s1 * 8);
argument registers keep unchanged. */
if (md->params[i].inmemory) {
- s1 = md->params[i].regoff + stackframesize;
+ s1 = md->params[i].regoff + cd->stackframesize;
s2 = nmd->params[j].regoff;
if (IS_2_WORD_TYPE(t)) {
M_JSR;
M_ALD(REG_TOC, REG_SP, 40); /* restore TOC */
- M_NOP;
- M_NOP;
- M_NOP;
-
/* save return value */
if (md->returntype.type != TYPE_VOID) {
#endif
/* remove native stackframe info */
- M_NOP;
- M_NOP;
- M_NOP;
-
- M_AADD_IMM(REG_SP, stackframesize * 8, rd->argintregs[0]);
+ M_AADD_IMM(REG_SP, cd->stackframesize * 8, rd->argintregs[0]);
disp = dseg_addaddress(cd, codegen_finish_native_call);
M_ALD(REG_ITMP1, REG_PV, disp);
M_ALD(REG_ITMP1, REG_ITMP1, 0); /* XXX what about TOC? */
}
}
- M_ALD(REG_ITMP2_XPC, REG_SP, stackframesize * 8 + LA_LR_OFFSET);
+ M_ALD(REG_ITMP2_XPC, REG_SP, cd->stackframesize * 8 + LA_LR_OFFSET);
M_MTLR(REG_ITMP2_XPC);
- M_LDA(REG_SP, REG_SP, stackframesize * 8); /* remove stackframe */
+ M_LDA(REG_SP, REG_SP, cd->stackframesize * 8); /* remove stackframe */
/* check for exception */