Changes: Christian Thalinger
- $Id: asmpart.S 4440 2006-02-05 12:03:43Z twisti $
+ $Id: asmpart.S 4497 2006-02-12 23:22:36Z twisti $
*/
SAVE_TEMPORARY_REGISTERS(18) /* the offset has to be even */
#endif
- stw a0,36(r1)
- addi itmp1,r1,36
+ mr itmp1,a0 /* pass method pointer via tmp1 */
+
mr a0,a1
mr a1,a2
mr a2,a3
lis mptr,asm_call_jit_compiler@ha
addi mptr,mptr,asm_call_jit_compiler@l
#endif
- stw mptr,32(r1)
- addi mptr,r1,28
+ stw mptr,8*4(r1)
+ addi mptr,r1,7*4
- lwz pv,4(mptr)
+ lwz pv,1*4(mptr)
mtctr pv
bctrl
SAVE_TEMPORARY_REGISTERS(18) /* the offset has to be even */
#endif
- stw r3,36(r1) /* save method pointer for compiler */
+ stw a0,9*4(r1) /* save method pointer for compiler */
+
mr itmp1,r6 /* pointer to arg block */
mr itmp2,r4 /* arg count */
L_register_copy_done:
L_stack_copy_done:
- addi itmp1,r1,36
+ lwz itmp1,9*4(sp) /* pass method pointer via tmp1 */
+
#if defined(__DARWIN__)
lis mptr,ha16(asm_call_jit_compiler)
addi mptr,mptr,lo16(asm_call_jit_compiler)
lis mptr,asm_call_jit_compiler@ha
addi mptr,mptr,asm_call_jit_compiler@l
#endif
- stw mptr,32(r1)
- addi mptr,r1,28
+ stw mptr,8*4(r1)
+ addi mptr,r1,7*4
- lwz pv,4(mptr)
+ lwz pv,1*4(mptr)
mtctr pv
bctrl
1:
mr a4,a3 /* xpc is equal to ra */
bl stacktrace_create_extern_stackframeinfo
- lwz itmp1,(LA_SIZE + 5*4 + INT_ARG_CNT*4 + FLT_ARG_CNT*8 + 1*4)(r1)
- lwz a0,0(itmp1)
+ lwz a0,(LA_SIZE + 5*4 + INT_ARG_CNT*4 + FLT_ARG_CNT*8 + 1*4)(r1)
bl jit_compile /* compile the Java method */
mr pv,r3 /* move address to pv register */
Changes: Christian Thalinger
Christian Ullrich
- $Id: codegen.c 4393 2006-01-31 15:41:22Z twisti $
+ $Id: codegen.c 4497 2006-02-12 23:22:36Z twisti $
*/
*******************************************************************************/
-#define COMPSTUBSIZE 6
+#define COMPILERSTUB_DATASIZE 2 * SIZEOF_VOID_P
+#define COMPILERSTUB_CODESIZE 4 * 4
+
+#define COMPILERSTUB_SIZE COMPILERSTUB_DATASIZE + COMPILERSTUB_CODESIZE
+
u1 *createcompilerstub(methodinfo *m)
{
- s4 *s = CNEW(s4, COMPSTUBSIZE); /* memory to hold the stub */
- s4 *mcodeptr = s; /* code generation pointer */
+ u1 *s; /* memory to hold the stub */
+ ptrint *d;
+ s4 *mcodeptr; /* code generation pointer */
+
+ s = CNEW(u1, COMPILERSTUB_SIZE);
+
+ /* set data pointer and code pointer */
+
+ d = (ptrint *) s;
+ s = s + COMPILERSTUB_DATASIZE;
- M_LDA(REG_ITMP1, REG_PV, 4 * 4);
- M_ALD_INTERN(REG_PV, REG_PV, 5 * 4);
+ mcodeptr = (s4 *) s;
+
+ /* Store the methodinfo* in the same place as in the methodheader
+ for compiled methods. */
+
+ d[0] = (ptrint) asm_call_jit_compiler;
+ d[1] = (ptrint) m;
+
+ M_ALD_INTERN(REG_ITMP1, REG_PV, -1 * SIZEOF_VOID_P);
+ M_ALD_INTERN(REG_PV, REG_PV, -2 * SIZEOF_VOID_P);
M_MTCTR(REG_PV);
M_RTS;
- s[4] = (s4) m; /* literals to be adressed */
- s[5] = (s4) asm_call_jit_compiler; /* jump directly via PV from above */
-
- asm_cacheflush((void *) s, (u1 *) mcodeptr - (u1 *) s);
+ asm_cacheflush((void *) d, COMPILERSTUB_SIZE);
#if defined(ENABLE_STATISTICS)
if (opt_stat)
- count_cstub_len += COMPSTUBSIZE * 4;
+ count_cstub_len += COMPILERSTUB_SIZE;
#endif
- return (u1 *) s;
+ return s;
}