Merged with tip.
[cacao.git] / src / vm / jit / arm / patcher.c
index 600a553e0cd40da29262a4ccaa922a163ba8a8a1..84e8287c502cb4a1b5f509a1e77f70daa1462aef 100644 (file)
@@ -1,9 +1,7 @@
 /* src/vm/jit/arm/patcher.c - ARM code patching functions
 
-   Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel,
-   C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
-   E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
-   J. Wenninger, Institut f. Computersprachen - TU Wien
+   Copyright (C) 1996-2005, 2006, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: patcher.c 8160 2007-06-28 01:52:19Z michi $
-
 */
 
 
 #include "config.h"
 
 #include <assert.h>
+#include <stdint.h>
 
 #include "vm/types.h"
 
+#include "vm/jit/arm/md.h"
+
 #include "mm/memory.h"
 
 #include "native/native.h"
@@ -42,7 +41,6 @@
 #include "vm/initialize.h"
 
 #include "vm/jit/asmpart.h"
-#include "vm/jit/md.h"
 #include "vm/jit/patcher-common.h"
 
 #include "vmcore/field.h"
        }
 
 
+/* patcher_patch_code **********************************************************
+
+   Just patches back the original machine code.
+
+*******************************************************************************/
+
+void patcher_patch_code(patchref_t *pr)
+{
+       PATCH_BACK_ORIGINAL_MCODE;
+}
+
+
 /* patcher_get_putstatic *******************************************************
 
    Machine code:
@@ -94,15 +104,15 @@ bool patcher_get_putstatic(patchref_t *pr)
 
        /* check if the field's class is initialized */
 
-       if (!(fi->class->state & CLASS_INITIALIZED))
-               if (!initialize_class(fi->class))
+       if (!(fi->clazz->state & CLASS_INITIALIZED))
+               if (!initialize_class(fi->clazz))
                        return false;
 
        PATCH_BACK_ORIGINAL_MCODE;
 
        /* patch the field value's address */
 
-       *((ptrint *) datap) = (ptrint) &(fi->value);
+       *((intptr_t *) datap) = (intptr_t) fi->value;
 
        return true;
 }
@@ -138,7 +148,7 @@ bool patcher_get_putfield(patchref_t *pr)
 
        /* if we show disassembly, we have to skip the nop */
 
-       if (opt_showdisassemble)
+       if (opt_shownops)
                ra = ra + 1 * 4;
 
        /* patch the field's offset into the instruction */
@@ -300,7 +310,7 @@ bool patcher_invokevirtual(patchref_t *pr)
 
        /* if we show disassembly, we have to skip the nop */
 
-       if (opt_showdisassemble)
+       if (opt_shownops)
                ra = ra + 1 * 4;
 
        /* patch vftbl index */
@@ -349,16 +359,16 @@ bool patcher_invokeinterface(patchref_t *pr)
 
        /* if we show disassembly, we have to skip the nop */
 
-       if (opt_showdisassemble)
+       if (opt_shownops)
                ra = ra + 1 * 4;
 
        /* patch interfacetable index */
 
-       gen_resolveload(*((s4 *) (ra + 1 * 4)), (s4) (OFFSET(vftbl_t, interfacetable[0]) - sizeof(methodptr*) * m->class->index));
+       gen_resolveload(*((s4 *) (ra + 1 * 4)), (s4) (OFFSET(vftbl_t, interfacetable[0]) - sizeof(methodptr*) * m->clazz->index));
 
        /* patch method offset */
 
-       gen_resolveload(*((s4 *) (ra + 2 * 4)), (s4) (sizeof(methodptr) * (m - m->class->methods)));
+       gen_resolveload(*((s4 *) (ra + 2 * 4)), (s4) (sizeof(methodptr) * (m - m->clazz->methods)));
 
        /* synchronize instruction cache */
 
@@ -470,95 +480,6 @@ bool patcher_resolve_classref_to_vftbl(patchref_t *pr)
 }
 
 
-/* patcher_initialize_class ****************************************************
-
-   XXX
-
-*******************************************************************************/
-
-bool patcher_initialize_class(patchref_t *pr)
-{
-       classinfo *c;
-
-       /* get stuff from the stack */
-
-       c = (classinfo *) pr->ref;
-
-       /* check if the class is initialized */
-
-       if (!(c->state & CLASS_INITIALIZED))
-               if (!initialize_class(c))
-                       return false;
-
-       PATCH_BACK_ORIGINAL_MCODE;
-
-       return true;
-}
-
-
-/* patcher_resolve_class *******************************************************
-
-   Machine code:
-
-   <patched call position>
-
-*******************************************************************************/
-
-#ifdef ENABLE_VERIFIER
-bool patcher_resolve_class(patchref_t *pr)
-{
-       unresolved_class *uc;
-
-       /* get stuff from the stack */
-
-       uc = (unresolved_class *) pr->ref;
-
-       /* resolve the class and check subtype constraints */
-
-       if (!resolve_class_eager_no_access_check(uc))
-               return false;
-
-       PATCH_BACK_ORIGINAL_MCODE;
-
-       return true;
-}
-#endif /* ENABLE_VERIFIER */
-
-
-/* patcher_resolve_native_function *********************************************
-
-   XXX
-
-*******************************************************************************/
-
-#if !defined(WITH_STATIC_CLASSPATH)
-bool patcher_resolve_native_function(patchref_t *pr)
-{
-       methodinfo  *m;
-       u1          *datap;
-       functionptr  f;
-
-       /* get stuff from the stack */
-
-       m     = (methodinfo *) pr->ref;
-       datap = (u1 *)         pr->datap;
-
-       /* resolve native function */
-
-       if (!(f = native_resolve_function(m)))
-               return false;
-
-       PATCH_BACK_ORIGINAL_MCODE;
-
-       /* patch native function pointer */
-
-       *((ptrint *) datap) = (ptrint) f;
-
-       return true;
-}
-#endif /* !defined(WITH_STATIC_CLASSPATH) */
-
-
 /*
  * 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