Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: codegen.c 7259 2007-01-30 13:58:35Z twisti $
+ $Id: codegen.c 7276 2007-02-02 11:58:18Z michi $
*/
disp = dseg_add_functionptr(cd, LOCK_monitor_enter);
M_DSEG_BRANCH(disp);
s1 = (s4) (cd->mcodeptr - cd->mcodebase);
- M_RECOMPUTE_IP(s1);
+ M_RECOMPUTE_PV(s1);
# if !defined(NDEBUG)
if (JITDATA_HAS_FLAG_VERBOSECALL(jd))
disp = dseg_add_functionptr(cd, bte->fp);
M_DSEG_BRANCH(disp);
- /* recompute ip */
+ /* recompute pv */
s1 = (s4) (cd->mcodeptr - cd->mcodebase);
- M_RECOMPUTE_IP(s1);
+ M_RECOMPUTE_PV(s1);
/* move result into destination register */
d = codegen_reg_of_dst(jd, iptr, REG_RESULT);
disp = dseg_add_functionptr(cd, bte->fp);
M_DSEG_BRANCH(disp);
- /* recompute ip */
+ /* recompute pv */
s1 = (s4) (cd->mcodeptr - cd->mcodebase);
- M_RECOMPUTE_IP(s1);
+ M_RECOMPUTE_PV(s1);
/* move result into destination register */
d = codegen_reg_of_dst(jd, iptr, REG_RESULT_PACKED);
disp = dseg_add_functionptr(cd, BUILTIN_canstore);
M_DSEG_BRANCH(disp);
- /* recompute ip */
+ /* recompute pv */
s1 = (s4) (cd->mcodeptr - cd->mcodebase);
- M_RECOMPUTE_IP(s1);
+ M_RECOMPUTE_PV(s1);
/* check resturn value of builtin */
M_TST(REG_RESULT, REG_RESULT);
/* length of dataseg after last dseg_add_target is used by load */
/* TODO: this loads from data-segment */
- M_ADD(REG_ITMP2, REG_IP, REG_LSL(REG_ITMP1, 2));
+ M_ADD(REG_ITMP2, REG_PV, REG_LSL(REG_ITMP1, 2));
M_LDR(REG_PC, REG_ITMP2, -(cd->dseglen));
break;
disp = dseg_add_functionptr(cd, LOCK_monitor_exit);
M_DSEG_BRANCH(disp);
- /* we no longer need IP here, no more loading */
+ /* we no longer need PV here, no more loading */
/*s1 = (s4) (cd->mcodeptr - cd->mcodebase);
- M_RECOMPUTE_IP(s1);*/
+ M_RECOMPUTE_PV(s1);*/
switch (iptr->opc) {
case ICMD_IRETURN:
case ICMD_BUILTIN:
disp = dseg_add_functionptr(cd, bte->fp);
- M_DSEG_LOAD(REG_IP, disp); /* Pointer to built-in-function */
+ M_DSEG_LOAD(REG_PV, disp); /* Pointer to built-in-function */
break;
case ICMD_INVOKESPECIAL:
else
disp = dseg_add_address(cd, lm->stubroutine);
- M_DSEG_LOAD(REG_IP, disp); /* Pointer to method */
+ M_DSEG_LOAD(REG_PV, disp); /* Pointer to method */
break;
case ICMD_INVOKEVIRTUAL:
M_LDR_INTERN(REG_METHODPTR, REG_A0,
OFFSET(java_objectheader, vftbl));
- M_LDR_INTERN(REG_IP, REG_METHODPTR, s1);
+ M_LDR_INTERN(REG_PV, REG_METHODPTR, s1);
break;
case ICMD_INVOKEINTERFACE:
M_LDR_INTERN(REG_METHODPTR, REG_A0,
OFFSET(java_objectheader, vftbl));
M_LDR_INTERN(REG_METHODPTR, REG_METHODPTR, s1);
- M_LDR_INTERN(REG_IP, REG_METHODPTR, s2);
+ M_LDR_INTERN(REG_PV, REG_METHODPTR, s2);
break;
}
/* generate the actual call */
M_MOV(REG_LR, REG_PC); /* save return address in LR */
- M_MOV(REG_PC, REG_IP); /* branch to method */
+ M_MOV(REG_PC, REG_PV); /* branch to method */
s1 = (s4) (cd->mcodeptr - cd->mcodebase);
- M_RECOMPUTE_IP(s1);
+ M_RECOMPUTE_PV(s1);
/* actually only used for ICMD_BUILTIN */
disp = dseg_add_functionptr(cd, BUILTIN_arraycheckcast);
M_DSEG_BRANCH(disp);
- /* recompute ip */
+ /* recompute pv */
disp = (s4) (cd->mcodeptr - cd->mcodebase);
- M_RECOMPUTE_IP(disp);
+ M_RECOMPUTE_PV(disp);
s1 = emit_load_s1(jd, iptr, REG_ITMP1);
M_TST(REG_RESULT, REG_RESULT);
disp = dseg_add_functionptr(cd, BUILTIN_multianewarray);
M_DSEG_BRANCH(disp);
- /* recompute ip (pv) */
+ /* recompute pv */
s1 = (s4) (cd->mcodeptr - cd->mcodebase);
- M_RECOMPUTE_IP(s1);
+ M_RECOMPUTE_PV(s1);
/* check for exception before result assignment */
assert(IS_IMM(4*4 + cd->stackframesize * 4));
M_ADD_IMM(REG_A0, REG_SP, 4*4 + cd->stackframesize * 4 - SIZEOF_VOID_P);
- M_MOV(REG_A1, REG_IP);
+ M_MOV(REG_A1, REG_PV);
M_ADD_IMM(REG_A2, REG_SP, 4*4 + cd->stackframesize * 4);
M_LDR_INTERN(REG_A3, REG_SP, 4*4 + cd->stackframesize * 4 - SIZEOF_VOID_P);
disp = dseg_add_functionptr(cd, codegen_start_native_call);
M_DSEG_BRANCH(disp);
- /* recompute ip */
+ /* recompute pv */
s1 = (s4) (cd->mcodeptr - cd->mcodebase);
- M_RECOMPUTE_IP(s1);
+ M_RECOMPUTE_PV(s1);
/* Restore integer and float argument registers (these are 4
registers, stack is 8-byte aligned). */
M_DSEG_BRANCH(funcdisp);
- /* recompute ip from pc */
+ /* recompute pv */
/* TODO: this is only needed because of the tracer ... do we
really need it? */
s1 = (s4) (cd->mcodeptr - cd->mcodebase);
- M_RECOMPUTE_IP(s1);
+ M_RECOMPUTE_PV(s1);
#if !defined(__SOFTFP__)
/* TODO: this is only a hack, since we use R0/R1 for float return! */
disp = dseg_add_functionptr(cd, codegen_finish_native_call);
M_DSEG_BRANCH(disp);
s1 = (s4) (cd->mcodeptr - cd->mcodebase);
- M_RECOMPUTE_IP(s1);
+ M_RECOMPUTE_PV(s1);
M_MOV(REG_ITMP1_XPTR, REG_RESULT);
M_LDMFD(BITMASK_RESULT, REG_SP);
Authors: Michael Starzinger
Christian Thalinger
- $Id: codegen.h 7259 2007-01-30 13:58:35Z twisti $
+ $Id: codegen.h 7276 2007-02-02 11:58:18Z michi $
*/
} else { \
disp = dseg_adds4(cd, const); \
/* TODO: implement this using M_DSEG_LOAD!!! */ \
- /* M_LDR_INTERN */ CHECK_OFFSET(disp,0x0fff); M_MEM(cond,1,0,d,REG_IP,(disp<0)?-disp:disp,0,1,(disp<0)?0:1,0); \
+ /* M_LDR_INTERN */ CHECK_OFFSET(disp,0x0fff); M_MEM(cond,1,0,d,REG_PV,(disp<0)?-disp:disp,0,1,(disp<0)?0:1,0); \
}
#define LCONST(d,c) \
ICONST(GET_HIGH_REG(d), (s4) ((s8) (c) >> 32)); \
} else { \
disp = dseg_add_s8(cd, (c)); \
- M_LDRD(d, REG_IP, disp); \
+ M_LDRD(d, REG_PV, disp); \
}
#define FCONST(d,c) \
do { \
disp = dseg_add_float(cd, (c)); \
- M_LDFS(d, REG_IP, disp); \
+ M_LDFS(d, REG_PV, disp); \
} while (0)
#define DCONST(d,c) \
do { \
disp = dseg_add_double(cd, (c)); \
- M_LDFD(d, REG_IP, disp); \
+ M_LDFD(d, REG_PV, disp); \
} while (0)
#endif /* !defined(ENABLE_SOFTFLOAT) */
-/* M_RECOMPUTE_IP:
- used to recompute our IP (something like PV) out of the current PC
+/* M_RECOMPUTE_PV:
+ used to recompute our PV (we use the IP for this) out of the current PC
ATTENTION: if you change this, you have to look at other functions as well!
Following things depend on it: asm_call_jit_compiler(); codegen_findmethod();
*/
-#define M_RECOMPUTE_IP(disp) \
+#define M_RECOMPUTE_PV(disp) \
disp += 8; /* we use PC relative addr. */ \
assert((disp & 0x03) == 0); \
assert(disp >= 0 && disp <= 0x03ffffff); \
- M_SUB_IMM(REG_IP, REG_PC, IMM_ROTL(disp >> 2, 1)); \
- if (disp > 0x000003ff) M_SUB_IMM(REG_IP, REG_IP, IMM_ROTL(disp >> 10, 5)); \
- if (disp > 0x0003ffff) M_SUB_IMM(REG_IP, REG_IP, IMM_ROTL(disp >> 18, 9)); \
+ M_SUB_IMM(REG_PV, REG_PC, IMM_ROTL(disp >> 2, 1)); \
+ if (disp > 0x000003ff) M_SUB_IMM(REG_PV, REG_PV, IMM_ROTL(disp >> 10, 5)); \
+ if (disp > 0x0003ffff) M_SUB_IMM(REG_PV, REG_PV, IMM_ROTL(disp >> 18, 9)); \
/* M_INTMOVE:
generates an integer-move from register a to b.
ATTENTION: we use M_LDR, so the same restrictions apply to us!
*/
#define M_DSEG_LOAD(reg, offset) \
- M_LDR_NEGATIVE(reg, REG_IP, offset)
+ M_LDR_NEGATIVE(reg, REG_PV, offset)
#define M_DSEG_BRANCH(offset) \
if (IS_OFFSET(offset, 0x0fff)) { \
M_MOV(REG_LR, REG_PC); \
- M_LDR_INTERN(REG_PC, REG_IP, offset); \
+ M_LDR_INTERN(REG_PC, REG_PV, offset); \
} else { \
/*assert((offset) <= 0);*/ \
CHECK_OFFSET(offset,0x0fffff); \
- M_SUB_IMM(REG_ITMP3, REG_IP, ((-(offset) >> 12) & 0xff) | (((10) & 0x0f) << 8)); /*TODO: more to go*/ \
+ M_SUB_IMM(REG_ITMP3, REG_PV, ((-(offset) >> 12) & 0xff) | (((10) & 0x0f) << 8)); /*TODO: more to go*/ \
M_MOV(REG_LR, REG_PC); \
M_LDR_INTERN(REG_PC, REG_ITMP3, -(-(offset) & 0x0fff)); /*TODO: this looks ugly*/ \
}
/* calcuate exception address */
assert((er->branchpos - 4) % 4 == 0);
- M_ADD_IMM_EXT_MUL4(REG_ITMP2_XPC, REG_IP, (er->branchpos - 4) / 4);
+ M_ADD_IMM_EXT_MUL4(REG_ITMP2_XPC, REG_PV, (er->branchpos - 4) / 4);
/* move function to call into REG_ITMP3 */
if (targetdisp == 0) {
targetdisp = ((u4 *) cd->mcodeptr) - ((u4 *) cd->mcodebase);
- M_MOV(rd->argintregs[0], REG_IP);
+ M_MOV(rd->argintregs[0], REG_PV);
M_MOV(rd->argintregs[1], REG_SP);
if (jd->isleafmethod)
/* save registers */
/* TODO: we only need to save LR in leaf methods */
- M_STMFD(BITMASK_ARGS | 1<<REG_IP | 1<<REG_LR, REG_SP);
+ M_STMFD(BITMASK_ARGS | 1<<REG_PV | 1<<REG_LR, REG_SP);
/* move a3 to stack */
/* restore registers */
- M_LDMFD(BITMASK_ARGS | 1<<REG_IP | 1<<REG_LR, REG_SP);
+ M_LDMFD(BITMASK_ARGS | 1<<REG_PV | 1<<REG_LR, REG_SP);
disp = dseg_add_functionptr(cd, asm_handle_exception);
M_DSEG_LOAD(REG_ITMP3, disp);
(void) dseg_add_unique_address(cd, lock_get_initial_lock_word());
disp = dseg_add_unique_address(cd, NULL); /* vftbl */
- M_SUB_IMM_EXT_MUL4(REG_ITMP3, REG_IP, -disp / 4);
+ M_SUB_IMM_EXT_MUL4(REG_ITMP3, REG_PV, -disp / 4);
M_STR_INTERN(REG_ITMP3, REG_SP, 3 * 4);
#else
M_EOR(REG_ITMP3, REG_ITMP3, REG_ITMP3);
M_STR_INTERN(REG_ITMP3, REG_SP, 0 * 4);
/* finally call the patcher via asm_patcher_wrapper */
- /* ATTENTION: don't use REG_IP here, because some patchers need it */
+ /* ATTENTION: don't use REG_PV here, because some patchers need it */
if (targetdisp == 0) {
targetdisp = ((u4 *) cd->mcodeptr) - ((u4 *) cd->mcodebase);
disp = dseg_add_functionptr(cd, asm_patcher_wrapper);
- /*M_DSEG_BRANCH_NOLINK(REG_PC, REG_IP, a);*/
+ /*M_DSEG_BRANCH_NOLINK(REG_PC, REG_PV, a);*/
/* TODO: this is only a hack */
M_DSEG_LOAD(REG_ITMP3, disp);
M_MOV(REG_PC, REG_ITMP3);
M_NOP;
- /* save argument registers to stack (including LR and IP) */
- M_STMFD(BITMASK_ARGS | (1<<REG_LR) | (1<<REG_IP), REG_SP);
+ /* save argument registers to stack (including LR and PV) */
+ M_STMFD(BITMASK_ARGS | (1<<REG_LR) | (1<<REG_PV), REG_SP);
M_SUB_IMM(REG_SP, REG_SP, (2 + 2 + 1) * 4); /* space for a3, a4 and m */
stackframesize += 6 + 2 + 2 + 1;
/* restore argument registers from stack */
M_ADD_IMM(REG_SP, REG_SP, (2 + 2 + 1) * 4); /* free argument stack */
- M_LDMFD(BITMASK_ARGS | (1<<REG_LR) | (1<<REG_IP), REG_SP);
+ M_LDMFD(BITMASK_ARGS | (1<<REG_LR) | (1<<REG_PV), REG_SP);
/* mark trace code */
M_NOP;
- M_STMFD(BITMASK_RESULT | (1<<REG_LR) | (1<<REG_IP), REG_SP);
+ M_STMFD(BITMASK_RESULT | (1<<REG_LR) | (1<<REG_PV), REG_SP);
M_SUB_IMM(REG_SP, REG_SP, (1 + 1) * 4); /* space for d[high reg] and f */
switch (md->returntype.type) {
M_LONGBRANCH(builtin_displaymethodstop);
M_ADD_IMM(REG_SP, REG_SP, (1 + 1) * 4); /* free argument stack */
- M_LDMFD(BITMASK_RESULT | (1<<REG_LR) | (1<<REG_IP), REG_SP);
+ M_LDMFD(BITMASK_RESULT | (1<<REG_LR) | (1<<REG_PV), REG_SP);
/* mark trace code */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-abi.h 7259 2007-01-30 13:58:35Z twisti $
+ $Id: md-abi.h 7276 2007-02-02 11:58:18Z michi $
*/
#define REG_RESULT 0 /* to deliver method results */
#define REG_RESULT2 1 /* to deliver long method results */
-#define REG_IP 12 /* intra-procedure-call scratch register */
+#define REG_PV 12 /* intra-procedure-call scratch register */
#define REG_SP 13 /* stack pointer */
#define REG_LR 14 /* link register */
#define REG_PC 15 /* program counter */