This module generates MIPS machine code for a sequence of
intermediate code commands (ICMDs).
- $Id: codegen.c 6180 2006-12-11 23:29:26Z twisti $
+ $Id: codegen.c 6269 2007-01-02 21:11:00Z edwin $
*/
methoddesc *md;
fieldinfo *fi;
unresolved_field *uf;
- rplpoint *replacementpoint;
s4 fieldtype;
s4 varindex;
/* end of header generation */
- replacementpoint = jd->code->rplpoints;
+ /* create replacement points */
+
+ REPLACEMENT_POINTS_INIT(cd, jd);
/* walk through all basic blocks */
/* handle replacement points */
-#if 0
- if (bptr->bitflags & BBFLAG_REPLACEMENT && bptr->flags >= BBREACHED) {
-
- /* 8-byte align pc */
- if ((ptrint) cd->mcodeptr & 4) {
- M_NOP;
- }
-
- replacementpoint->pc = (u1*)(ptrint) (cd->mcodeptr - cd->mcodebase);
- replacementpoint++;
-
- assert(cd->lastmcodeptr <= cd->mcodeptr);
- cd->lastmcodeptr = cd->mcodeptr + 2 * 4; /* br + delay slot */
- }
-#endif
+ REPLACEMENT_POINT_BLOCK_START(cd, bptr);
/* store relative start of block */
case ICMD_POP2: /* ..., value, value ==> ... */
break;
+ case ICMD_INLINE_START:
+
+ REPLACEMENT_POINT_INLINE_START(cd, iptr);
+ break;
+
+ case ICMD_INLINE_BODY:
+
+ REPLACEMENT_POINT_INLINE_BODY(cd, iptr);
+ dseg_addlinenumber_inline_start(cd, iptr);
+ dseg_addlinenumber(cd, iptr->line);
+ break;
+
+ case ICMD_INLINE_END:
+ dseg_addlinenumber_inline_end(cd, iptr);
+ dseg_addlinenumber(cd, iptr->line);
break;
case ICMD_CHECKNULL: /* ..., objectref ==> ..., objectref */
case ICMD_IRETURN: /* ..., retvalue ==> ... */
case ICMD_LRETURN:
+ REPLACEMENT_POINT_RETURN(cd, iptr);
s1 = emit_load_s1(jd, iptr, REG_RESULT);
M_INTMOVE(s1, REG_RESULT);
goto nowperformreturn;
case ICMD_ARETURN: /* ..., retvalue ==> ... */
+ REPLACEMENT_POINT_RETURN(cd, iptr);
s1 = emit_load_s1(jd, iptr, REG_RESULT);
M_INTMOVE(s1, REG_RESULT);
case ICMD_FRETURN: /* ..., retvalue ==> ... */
+ REPLACEMENT_POINT_RETURN(cd, iptr);
s1 = emit_load_s1(jd, iptr, REG_FRESULT);
M_FLTMOVE(s1, REG_FRESULT);
goto nowperformreturn;
case ICMD_DRETURN: /* ..., retvalue ==> ... */
+ REPLACEMENT_POINT_RETURN(cd, iptr);
s1 = emit_load_s1(jd, iptr, REG_FRESULT);
M_DBLMOVE(s1, REG_FRESULT);
goto nowperformreturn;
case ICMD_RETURN: /* ... ==> ... */
+ REPLACEMENT_POINT_RETURN(cd, iptr);
+
nowperformreturn:
{
s4 i, p;
case ICMD_INVOKEVIRTUAL:/* op1 = arg count, val.a = method pointer */
case ICMD_INVOKEINTERFACE:
+ REPLACEMENT_POINT_INVOKE(cd, iptr);
+
if (INSTRUCTION_IS_UNRESOLVED(iptr)) {
lm = NULL;
um = iptr->sx.s23.s3.um;
M_JSR(REG_RA, s1);
M_NOP;
+ REPLACEMENT_POINT_INVOKE_RETURN(cd, iptr);
disp = (s4) (cd->mcodeptr - cd->mcodebase);
M_LDA(REG_PV, REG_RA, -disp);
emit_exception_stubs(jd);
emit_patcher_stubs(jd);
-
-#if 0
- emit_replacement_stubs(jd);
-#endif
+ REPLACEMENT_EMIT_STUBS(jd);
codegen_finish(jd);