if (src->flags & INMEMORY) {
COUNT_SPILLS;
- disp = src->vv.regoff * 8;
+ disp = src->vv.regoff;
if (IS_FLT_DBL_TYPE(src->type)) {
M_DLD(tempreg, REG_SP, disp);
COUNT_SPILLS;
if (IS_FLT_DBL_TYPE(dst->type)) {
- M_DST(d, REG_SP, dst->vv.regoff * 8);
+ M_DST(d, REG_SP, dst->vv.regoff);
}
else {
- M_LST(d, REG_SP, dst->vv.regoff * 8);
+ M_LST(d, REG_SP, dst->vv.regoff);
}
}
}
if (!md->params[p].inmemory) { /* Param in Arg Reg */
M_LST(md->params[p].regoff, REG_SP, LA_SIZE + PA_SIZE + 8 + p * 8);
} else { /* Param on Stack */
- s1 = (md->params[p].regoff + cd->stackframesize) * 8 + stack_size;
+ s1 = md->params[p].regoff + cd->stackframesize * 8 + stack_size;
M_LLD(REG_ITMP2, REG_SP, s1);
M_LST(REG_ITMP2, REG_SP, LA_SIZE + PA_SIZE + 8 + p * 8);
}
/* if the long-branches flag isn't set yet, do it */
if (!CODEGENDATA_HAS_FLAG_LONGBRANCHES(cd)) {
- log_println("setting error");
cd->flags |= (CODEGENDATA_FLAG_ERROR |
CODEGENDATA_FLAG_LONGBRANCHES);
}
/* if the long-branches flag isn't set yet, do it */
if (!CODEGENDATA_HAS_FLAG_LONGBRANCHES(cd)) {
- log_println("setting error");
cd->flags |= (CODEGENDATA_FLAG_ERROR |
CODEGENDATA_FLAG_LONGBRANCHES);
}
- log_println("generating long-branch");
branchdisp --; /* we jump from the second instruction */
switch (condition) {
}
-/* emit_replacement_stubs ******************************************************
+/* emit_trap *******************************************************************
- Generates the code for the replacement stubs.
+ Emit a trap instruction and return the original machine code.
*******************************************************************************/
-#if defined(ENABLE_REPLACEMENT)
-void emit_replacement_stubs(jitdata *jd)
+uint32_t emit_trap(codegendata *cd)
{
- codegendata *cd;
- codeinfo *code;
- rplpoint *replacementpoint;
- s4 disp;
- s4 i;
-#if !defined(NDEBUG)
- u1 *savedmcodeptr;
-#endif
-
- /* get required compiler data */
-
- cd = jd->cd;
- code = jd->code;
-
- replacementpoint = jd->code->rplpoints;
-
- for (i = 0; i < code->rplpointcount; ++i, ++replacementpoint) {
- /* do not generate stubs for non-trappable points */
-
- if (replacementpoint->flags & RPLPOINT_FLAG_NOTRAP)
- continue;
+ uint32_t mcode;
+ /* Get machine code which is patched back in later. The
+ trap is 1 instruction word long. */
- /* check code segment size */
-
- MCODECHECK(200);
-
-#if !defined(NDEBUG)
- savedmcodeptr = cd->mcodeptr;
-#endif
- /* create stack frame - keep 16-byte aligned */
-
- M_AADD_IMM(REG_SP, -4 * 8, REG_SP);
+ mcode = *((uint32_t *) cd->mcodeptr);
- /* push address of `rplpoint` struct */
+ M_ALD_INTERN(REG_ZERO, REG_ZERO, EXCEPTION_HARDWARE_PATCHER);
- disp = dseg_add_address(cd, replacementpoint);
- M_ALD(REG_ITMP3, REG_PV, disp);
- M_AST_INTERN(REG_ITMP3, REG_SP, 0 * 8);
-
- /* jump to replacement function */
-
- disp = dseg_add_functionptr(cd, asm_replacement_out);
- M_ALD(REG_ITMP3, REG_PV, disp);
- M_MTCTR(REG_ITMP3);
- M_RTS;
-
- assert((cd->mcodeptr - savedmcodeptr) == 4*REPLACEMENT_STUB_SIZE);
-
-#if 0
- /* note start of stub code */
-
- replacementpoint->outcode = (u1 *) (cd->mcodeptr - cd->mcodebase);
-
- /* make machine code for patching */
-
- savedmcodeptr = cd->mcodeptr;
- cd->mcodeptr = (u1 *) &(replacementpoint->mcode) + 1 /* big-endian */;
-
- disp = (ptrint)((s4*)replacementpoint->outcode - (s4*)replacementpoint->pc) - 1;
- M_BR(disp);
-
- cd->mcodeptr = savedmcodeptr;
-
- /* create stack frame - keep 16-byte aligned */
-
- M_AADD_IMM(REG_SP, -4 * 4, REG_SP);
-
- /* push address of `rplpoint` struct */
-
- disp = dseg_add_unique_address(cd, replacementpoint);
- M_ALD(REG_ITMP3, REG_PV, disp);
- M_AST_INTERN(REG_ITMP3, REG_SP, 0 * 4);
-
- /* jump to replacement function */
-
- disp = dseg_add_functionptr(cd, asm_replacement_out);
- M_ALD(REG_ITMP3, REG_PV, disp);
- M_MTCTR(REG_ITMP3);
- M_RTS;
-#endif
- }
+ return mcode;
}
-#endif /* define(ENABLE_REPLACEMENT) */
+
/*
-* These are local overrides for various environment variables in Emacs.
-* Please do not remove this and leave it at the end of the file, where
-* Emacs will automagically detect them.
-* ---------------------------------------------------------------------
-* Local variables:
-* mode: c
-* indent-tabs-mode: t
-* c-basic-offset: 4
-* tab-width: 4
-* End:
-* vim:noexpandtab:sw=4:ts=4:
-*/
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */