* src/vm/jit/mips/codegen.c (codegen): Use REPLACEMENT_ macros.
authoredwin <none@none>
Tue, 2 Jan 2007 21:11:00 +0000 (21:11 +0000)
committeredwin <none@none>
Tue, 2 Jan 2007 21:11:00 +0000 (21:11 +0000)
src/vm/jit/mips/codegen.c

index 233e68a500c5c95e3d9546e9f76d8699ac1746bb..fff4898340563fdff6d193cb601dc40727dc357e 100644 (file)
@@ -34,7 +34,7 @@
    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 $
 
 */
 
@@ -103,7 +103,6 @@ bool codegen(jitdata *jd)
        methoddesc         *md;
        fieldinfo          *fi;
        unresolved_field   *uf;
-       rplpoint           *replacementpoint;
        s4                  fieldtype;
        s4                  varindex;
 
@@ -332,7 +331,9 @@ bool codegen(jitdata *jd)
 
        /* end of header generation */
 
-       replacementpoint = jd->code->rplpoints;
+       /* create replacement points */
+
+       REPLACEMENT_POINTS_INIT(cd, jd);
 
        /* walk through all basic blocks */
 
@@ -340,21 +341,7 @@ bool codegen(jitdata *jd)
 
                /* 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 */
 
@@ -421,7 +408,22 @@ bool codegen(jitdata *jd)
                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           */
@@ -2182,12 +2184,14 @@ bool codegen(jitdata *jd)
                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);
 
@@ -2202,18 +2206,22 @@ bool codegen(jitdata *jd)
 
            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;
@@ -2403,6 +2411,8 @@ nowperformreturn:
                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;
@@ -2540,6 +2550,7 @@ gen_method:
 
                        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);
 
@@ -2969,10 +2980,7 @@ gen_method:
 
        emit_exception_stubs(jd);
        emit_patcher_stubs(jd);
-
-#if 0
-       emit_replacement_stubs(jd);
-#endif
+       REPLACEMENT_EMIT_STUBS(jd);
 
        codegen_finish(jd);