* Removed all Id tags.
[cacao.git] / src / vm / jit / x86_64 / emit.c
index 356590e3cbca8f422dbb36d30a016ef6aa943dd4..44f3742a704166127f9e5f0a97401c5cfbe85e59 100644 (file)
@@ -22,8 +22,6 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: emit.c 8123 2007-06-20 23:50:55Z michi $
-
 */
 
 #include "config.h"
@@ -353,7 +351,7 @@ void emit_arithmetic_check(codegendata *cd, instruction *iptr, s4 reg)
 void emit_arrayindexoutofbounds_check(codegendata *cd, instruction *iptr, s4 s1, s4 s2)
 {
        if (INSTRUCTION_MUST_CHECK(iptr)) {
-        M_ILD(REG_ITMP3, s1, OFFSET(java_arrayheader, size));
+        M_ILD(REG_ITMP3, s1, OFFSET(java_array_t, size));
         M_ICMP(REG_ITMP3, s2);
                M_BULT(8);
                M_ALD_MEM(s2, EXCEPTION_HARDWARE_ARRAYINDEXOUTOFBOUNDS);
@@ -507,65 +505,25 @@ void emit_patcher_stubs(jitdata *jd)
 }
 
 
-/* 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    *rplp;
-       s4           i;
-#if !defined(NDEBUG)
-       u1          *savedmcodeptr;
-#endif
-
-       /* get required compiler data */
-
-       cd   = jd->cd;
-       code = jd->code;
-
-       rplp = code->rplpoints;
-
-       /* store beginning of replacement stubs */
-
-       code->replacementstubs = (u1*) (cd->mcodeptr - cd->mcodebase);
-
-       for (i = 0; i < code->rplpointcount; ++i, ++rplp) {
-               /* do not generate stubs for non-trappable points */
+       uint32_t mcode;
 
-               if (rplp->flags & RPLPOINT_FLAG_NOTRAP)
-                       continue;
+       /* Get machine code which is patched back in later. The
+          trap is 1 instruction word long. */
 
-               /* check code segment size */
+       mcode = *((uint32_t *) cd->mcodeptr);
 
-               MCODECHECK(512);
-
-               /* note start of stub code */
-
-#if !defined(NDEBUG)
-               savedmcodeptr = cd->mcodeptr;
-#endif
-
-               /* push address of `rplpoint` struct */
-                       
-               M_MOV_IMM(rplp, REG_ITMP3);
-               M_PUSH(REG_ITMP3);
-
-               /* jump to replacement function */
-
-               M_MOV_IMM(asm_replacement_out, REG_ITMP3);
-               M_PUSH(REG_ITMP3);
-               M_RET;
+       M_NOP;
 
-               assert((cd->mcodeptr - savedmcodeptr) == REPLACEMENT_STUB_SIZE);
-       }
+       return mcode;
 }
-#endif /* defined(ENABLE_REPLACEMENT) */
 
 
 /* emit_verbosecall_enter ******************************************************