* Removed all Id tags.
[cacao.git] / src / vm / jit / arm / emit.c
index 2967a7872d14f65d4fecf28f8eecb382cd62c09b..456d27cb9a86201a225db9972fbbe122965ee6a8 100644 (file)
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: emit.c 4398 2006-01-31 23:43:08Z twisti $
-
 */
 
 
 #include "config.h"
 
 #include <assert.h>
+#include <stdint.h>
 
 #include "vm/types.h"
 
@@ -511,7 +510,7 @@ void emit_nullpointer_check_force(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_INTERN(REG_ITMP3, s1, OFFSET(java_arrayheader, size));
+               M_ILD_INTERN(REG_ITMP3, s1, OFFSET(java_array_t, size));
                M_CMP(s2, REG_ITMP3);
                M_TRAPHS(s2, EXCEPTION_HARDWARE_ARRAYINDEXOUTOFBOUNDS);
        }
@@ -561,46 +560,24 @@ void emit_exception_check(codegendata *cd, instruction *iptr)
 }
 
 
-/* emit_patcher_traps **********************************************************
+/* emit_trap *******************************************************************
 
-   Generates the code for the patcher traps.
+   Emit a trap instruction and return the original machine code.
 
 *******************************************************************************/
 
-void emit_patcher_traps(jitdata *jd)
+uint32_t emit_trap(codegendata *cd)
 {
-       codegendata *cd;
-       codeinfo    *code;
-       patchref_t  *pr;
-       u1          *savedmcodeptr;
-       u1          *tmpmcodeptr;
-
-       /* get required compiler data */
-
-       cd   = jd->cd;
-       code = jd->code;
-
-       /* generate patcher traps code */
+       uint32_t mcode;
 
-       for (pr = list_first_unsynced(code->patchers); pr != NULL; pr = list_next_unsynced(code->patchers, pr)) {
+       /* Get machine code which is patched back in later. The
+          trap is 1 instruction word long. */
 
-               /* Get machine code which is patched back in later. The
-                  trap is 1 instruction word long. */
+       mcode = *((u4 *) cd->mcodeptr);
 
-               tmpmcodeptr = (u1 *) (cd->mcodebase + pr->mpc);
+       M_TRAP(0, EXCEPTION_HARDWARE_PATCHER);
 
-               pr->mcode = *((u4 *) tmpmcodeptr);
-
-               /* Patch in the trap to call the signal handler (done at
-                  compile time). */
-
-               savedmcodeptr = cd->mcodeptr;   /* save current mcodeptr              */
-               cd->mcodeptr  = tmpmcodeptr;    /* set mcodeptr to patch position     */
-
-               M_TRAP(0, EXCEPTION_HARDWARE_PATCHER);
-
-               cd->mcodeptr = savedmcodeptr;   /* restore the current mcodeptr       */
-       }
+       return mcode;
 }