fixing ABI issues. It is not correct now, but fptest runs now.
Remaining issues in java<->native mainly stack offsets.
* src/vm/jit/powerpc64/emit.c (emit_load): Removed M_ILD case.
(emit_store): Removed M_FST case. There is no M_FST expect for
accessing c structs, internally everything is done using M_DLD
and M_DST, M_FST would convert the values.
* src/vm/jit/powerpc64/codegen.c (codegen): Removed all M_FST and
M_FLD.
* src/vm/jit/powerpc64/asmpart.S (asm_vm_call_method): Fixed
argument passing on stack.
Changes: Christian Thalinger
Edwin Steiner
- $Id: asmpart.S 5940 2006-11-09 09:59:28Z tbfg $
+ $Id: asmpart.S 5978 2006-11-13 21:43:41Z tbfg $
*/
mr itmp1,t5 /* restore argument block pointer */
slwi t4,itmp3,3 /* XXX use 8-bytes slots for now */
- addi t4,t4,LA_SIZE /* add size of linkage area */
+ addi t4,t4,LA_SIZE+PA_SIZE /* add size of linkage area */
#if defined(__DARWIN__)
slwi t5,t7,2 /* add stack space for arguments */
bne L_stack_handle_double
lfs ftmp3,offvmargdata(itmp1) /* get float argument */
- stfs ftmp3,4(t6) /* and store it on the stack */
+ stfd ftmp3,64(t6) /* and store it on the stack, 56: first 8 slots reserved for r3-r10 */
addi t6,t6,8 /* increase temporary sp by 1 slot */
b L_stack_copy_loop
L_stack_handle_double:
lfd ftmp3,offvmargdata(itmp1) /* get double argument */
- stfd ftmp3,0(t6) /* and store it on the stack */
+ stfd ftmp3,64(t6) /* and store it on the stack, 56: first 8 slots reserved for r3-r10 */
addi t6,t6,8 /* increase temporary sp by 1 slots */
b L_stack_copy_loop
ld pv,11*8(sp) /* save PV register */
ld itmp3,12*8(sp)
- lfd ftmp1,14*8(sp) /* registers f14-f31 are callee saved */
- lfd ftmp2,16*8(sp)
+ lfd ftmp1,13*8(sp) /* registers f14-f31 are callee saved */
+ lfd ftmp2,14*8(sp)
#if defined(__DARWIN__)
lwz t1,18*4(r1)
lfd ft4,34*4(r1)
lfd ft5,36*4(r1)
#else
- RESTORE_TEMPORARY_REGISTERS(18) /* the offset has to be even */
+ RESTORE_TEMPORARY_REGISTERS(15) /* the offset has to be even */
#endif
ld r0,40*8+LA_LR_OFFSET(r1)
Edwin Steiner
Roland Lezuo
- $Id: codegen.c 5957 2006-11-12 12:57:59Z twisti $
+ $Id: codegen.c 5978 2006-11-13 21:43:41Z tbfg $
*/
if (!IS_INMEMORY(var->flags)) { /* reg arg -> register */
M_FLTMOVE(s2, var->vv.regoff);
} else { /* reg arg -> spilled */
- M_DST(s2, REG_SP, var->vv.regoff * 8);
+ if (IS_2_WORD_TYPE(t)) {
+ M_DST(s2, REG_SP, var->vv.regoff * 8);
+ } else {
+ M_DST(s2, REG_SP, var->vv.regoff * 8); /* F XXX */
+ }
}
} else { /* stack arguments */
if (!(var->flags & INMEMORY)) { /* stack-arg -> register */
- M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8);
+ if (IS_2_WORD_TYPE(t)) {
+ M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8);
+ } else {
+ M_DLD(var->vv.regoff, REG_SP, (cd->stackframesize + s1) * 8);
+ }
} else { /* stack-arg -> spilled */
var->vv.regoff = cd->stackframesize + s1;
}
goto gen_method;
case ICMD_INVOKESTATIC: /* ..., [arg1, [arg2 ...]] ==> ... */
-
case ICMD_INVOKESPECIAL:/* ..., objectref, [arg1, [arg2 ...]] ==> ... */
case ICMD_INVOKEVIRTUAL:/* op1 = arg count, val.a = method pointer */
case ICMD_INVOKEINTERFACE:
if (IS_2_WORD_TYPE(var->type))
M_DST(d, REG_SP, md->params[s3].regoff * 8);
else
- M_FST(d, REG_SP, md->params[s3].regoff * 8);
+ M_DST(d, REG_SP, md->params[s3].regoff * 8); /* F XXX */
}
}
} /* end of for */
nmd->paramcount +
nmd->memuse;
- cd->stackframesize = (cd->stackframesize + 3) & ~3; /* keep stack 16-byte aligned */
+/* cd->stackframesize = (cd->stackframesize + 3) & ~3;*/ /* keep stack 16-byte aligned */
/* create method header */
if (IS_INT_LNG_TYPE(t)) {
if (!md->params[i].inmemory) {
s1 = md->params[i].regoff;
- M_LST(rd->argintregs[s1], REG_SP, LA_SIZE + PA_SIZE + 4 * 8 + j * 8);
+ M_LST(rd->argintregs[s1], REG_SP, LA_SIZE + PA_SIZE + 4*8 + j * 8);
j++;
}
}
if (IS_FLT_DBL_TYPE(md->paramtypes[i].type)) {
if (!md->params[i].inmemory) {
s1 = md->params[i].regoff;
- M_DST(rd->argfltregs[s1], REG_SP, LA_SIZE + PA_SIZE + 4 * 8 + j * 8);
+ M_DST(rd->argfltregs[s1], REG_SP, LA_SIZE + PA_SIZE + 4*8 + j * 8);
j++;
}
}
s1 = md->params[i].regoff + cd->stackframesize;
s2 = nmd->params[j].regoff;
- if (IS_2_WORD_TYPE(t)) {
- M_DLD(REG_FTMP1, REG_SP, s1 * 8);
- M_DST(REG_FTMP1, REG_SP, s2 * 8);
+ M_DLD(REG_FTMP1, REG_SP, s1 * 8);
+ if (IS_2_WORD_TYPE(t)) {
+ M_DST(REG_FTMP1, REG_SP, s2 * 8);
} else {
- M_FLD(REG_FTMP1, REG_SP, s1 * 8);
- M_FST(REG_FTMP1, REG_SP, s2 * 8);
+ M_FST(REG_FTMP1, REG_SP, s2 * 8 + 4);
}
}
}
M_LST(REG_RESULT, REG_SP, LA_SIZE + PA_SIZE + 1 * 8);
}
else {
- if (IS_2_WORD_TYPE(md->returntype.type))
+/* if (IS_2_WORD_TYPE(md->returntype.type)) */
M_DST(REG_FRESULT, REG_SP, LA_SIZE + PA_SIZE + 1 * 8);
- else
- M_FST(REG_FRESULT, REG_SP, LA_SIZE + PA_SIZE + 1 * 8); /* FIXME, needed ?*/
+/* else
+ M_FST(REG_FRESULT, REG_SP, LA_SIZE + PA_SIZE + 1 * 8); */ /* FIXME, needed F XXX?*/
+
}
}
M_LLD(REG_RESULT, REG_SP, LA_SIZE + PA_SIZE + 1 * 8);
}
else {
- if (IS_2_WORD_TYPE(md->returntype.type))
+/* if (IS_2_WORD_TYPE(md->returntype.type)) */
M_DLD(REG_FRESULT, REG_SP, LA_SIZE + PA_SIZE + 1 * 8);
- else
- M_FLD(REG_FRESULT, REG_SP, LA_SIZE + PA_SIZE + 1 * 8);
+/* else
+ M_FLD(REG_FRESULT, REG_SP, LA_SIZE + PA_SIZE + 1 * 8); F XXX
+ */
}
}
M_FLD(tempreg, REG_SP, disp);
}
else {
- /* if (IS_2_WORD_TYPE(src->type))
- M_LLD(tempreg, REG_SP, disp);
- else
- M_ILD(tempreg, REG_SP, disp);
- */
M_LLD(tempreg, REG_SP, disp);
}
COUNT_SPILLS;
if (IS_FLT_DBL_TYPE(dst->type)) {
- if (IS_2_WORD_TYPE(dst->type))
+/* if (IS_2_WORD_TYPE(dst->type))*/
M_DST(d, REG_SP, dst->vv.regoff * 8);
- else
- M_FST(d, REG_SP, dst->vv.regoff * 8);
+/* else
+ M_DST(d, REG_SP, dst->vv.regoff * 8); F XXX */
}
else {
M_LST(d, REG_SP, dst->vv.regoff * 8);
Changes:
- $Id: md-abi.c 5940 2006-11-09 09:59:28Z tbfg $
+ $Id: md-abi.c 5978 2006-11-13 21:43:41Z tbfg $
*/
#include "vm/descriptor.h"
#include "vm/global.h"
#include "vm/jit/abi.h"
+#include <assert.h>
#define CACAO_ALIGN(a) do { if ((a) & 1) (a)++; } while (0)
/* register descripton array **************************************************/
s4 nregdescint[] = {
- /* zero, sp, TOC, a0/v0, a0/v1, a2, a3, a4, */
+ /* zero, sp, TOC, a0/v0, a1/v1, a2, a3, a4, */
REG_RES, REG_RES, REG_RES, REG_ARG, REG_ARG, REG_ARG, REG_ARG, REG_ARG,
/* a5, a6, a7, itmp1, itmp2, NO(SYS), pv, s0, */
s4 i;
s4 iarg;
s4 farg;
- s4 stacksize;
+ s4 arg;
+ s4 stacksize, stackcount;
+
/* set default values */
iarg = 0;
farg = 0;
+ arg = 0;
stacksize = LA_SIZE_IN_POINTERS + PA_SIZE_IN_POINTERS;
+ stackcount = 0;
/* get params field of methoddesc */
case TYPE_LNG:
case TYPE_INT:
case TYPE_ADR:
- if (iarg < INT_ARG_CNT) {
+ if (arg < INT_ARG_CNT) {
pd->inmemory = false;
pd->regoff = iarg;
iarg++;
} else {
pd->inmemory = true;
- pd->regoff = stacksize;
- stacksize++;
+ pd->regoff = stacksize + stackcount;
+ stackcount++;
}
break;
case TYPE_FLT:
- if (farg < FLT_ARG_CNT) {
- pd->inmemory = false;
- pd->regoff = farg;
- farg++;
- } else {
- pd->inmemory = true;
- pd->regoff = stacksize;
- stacksize++;
- }
- break;
case TYPE_DBL:
if (farg < FLT_ARG_CNT) {
pd->inmemory = false;
pd->regoff = farg;
farg++;
+ if (arg < INT_ARG_CNT) {
+ iarg++; /* yes, that is true, floating arguments take int register slots away */
+ stackcount++;
+ }
} else {
- CACAO_ALIGN(stacksize);
pd->inmemory = true;
- pd->regoff = stacksize;
- stacksize += 2;
+ pd->regoff = stacksize + stackcount + 1;
+ stackcount++;
}
break;
+ default:
+ assert(0);
}
+ arg++;
}
- /* Since R3/R4, F1 (==A0/A1, A0) are used for passing return values, this */
+ /* Since R3, F1 (==A0, A0) are used for passing return values, this */
/* argument register usage has to be regarded, too */
if (IS_INT_LNG_TYPE(md->returntype.type)) {
if (iarg < 1)
md->argintreguse = iarg;
md->argfltreguse = farg;
- md->memuse = stacksize;
+ md->memuse = stacksize + stackcount;
}