Merged trunk and subtype.
[cacao.git] / src / vm / jit / i386 / patcher.c
index 709cc5a031c5306283ca66d91c55df1fae806762..034ca21ef2239421c87fcad37a950f382a7e9550 100644 (file)
@@ -1,9 +1,7 @@
 /* src/vm/jit/i386/patcher.c - i386 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.
 
@@ -22,8 +20,6 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: patcher.c 8295 2007-08-11 17:57:24Z michi $
-
 */
 
 
 #include "vm/types.h"
 
 #include "vm/jit/i386/codegen.h"
+#include "vm/jit/i386/md.h"
 
 #include "mm/memory.h"
 
 #include "native/native.h"
 
-#include "vm/builtin.h"
-#include "vm/exceptions.h"
+#include "vm/jit/builtin.hpp"
+#include "vm/class.h"
+#include "vm/field.hpp"
 #include "vm/initialize.h"
+#include "vm/options.h"
+#include "vm/references.h"
+#include "vm/resolve.h"
 
-#include "vm/jit/patcher.h"
-#include "vm/jit/stacktrace.h"
+#include "vm/jit/patcher-common.hpp"
 
-#include "vmcore/class.h"
-#include "vmcore/field.h"
-#include "vmcore/options.h"
-#include "vm/resolve.h"
-#include "vmcore/references.h"
 
+#define PATCH_BACK_ORIGINAL_MCODE                                                      \
+       do {                                                                                                    \
+               *((uint16_t*) pr->mpc) = (uint16_t) pr->mcode;          \
+               md_icacheflush((void*) pr->mpc, PATCHER_CALL_SIZE);     \
+       } while (0)
 
-/* patcher_wrapper *************************************************************
 
-   Wrapper for all patchers.  It also creates the stackframe info
-   structure.
+/* patcher_patch_code **********************************************************
 
-   If the return value of the patcher function is false, it gets the
-   exception object, clears the exception pointer and returns the
-   exception.
+   Just patches back the original machine code.
 
 *******************************************************************************/
 
-java_object_t *patcher_wrapper(u1 *sp, u1 *pv, u1 *ra)
+void patcher_patch_code(patchref_t *pr)
 {
-       stackframeinfo     sfi;
-       u1                *xpc;
-       java_object_t     *o;
-       functionptr        f;
-       bool               result;
-       java_handle_t     *e;
-
-       /* define the patcher function */
-
-       bool (*patcher_function)(u1 *);
-
-       /* get stuff from the stack */
-
-       xpc = (u1 *)                *((ptrint *) (sp + 6 * 4));
-       o   = (java_object_t *)     *((ptrint *) (sp + 4 * 4));
-       f   = (functionptr)         *((ptrint *) (sp + 0 * 4));
-
-       /* calculate and set the new return address */
-
-       xpc = xpc - PATCHER_CALL_SIZE;
-
-       *((ptrint *) (sp + 6 * 4)) = (ptrint) xpc;
-
-       /* cast the passed function to a patcher function */
-
-       patcher_function = (bool (*)(u1 *)) (ptrint) f;
-
-       /* enter a monitor on the patching position */
-
-       PATCHER_MONITORENTER;
-
-       /* create the stackframeinfo */
-
-       /* RA is passed as NULL, but the XPC is correct and can be used in
-          stacktrace_create_extern_stackframeinfo for
-          md_codegen_get_pv_from_pc. */
-
-       stacktrace_create_extern_stackframeinfo(&sfi, pv, sp + 7 * 4, xpc, xpc);
-
-       /* call the proper patcher function */
-
-       result = (patcher_function)(sp);
-
-       /* remove the stackframeinfo */
-
-       stacktrace_remove_stackframeinfo(&sfi);
-
-       /* check for return value and exit accordingly */
-
-       if (result == false) {
-               e = exceptions_get_and_clear_exception();
-
-               PATCHER_MONITOREXIT;
-
-               return e;
-       }
-
-       PATCHER_MARK_PATCHED_MONITOREXIT;
-
-       return NULL;
+       PATCH_BACK_ORIGINAL_MCODE;
 }
 
 
@@ -138,18 +75,16 @@ java_object_t *patcher_wrapper(u1 *sp, u1 *pv, u1 *ra)
 
 *******************************************************************************/
 
-bool patcher_get_putstatic(u1 *sp)
+bool patcher_get_putstatic(patchref_t *pr)
 {
        u1               *ra;
-       u8                mcode;
        unresolved_field *uf;
        fieldinfo        *fi;
 
        /* get stuff from the stack */
 
-       ra    = (u1 *)               *((ptrint *) (sp + 6 * 4));
-       mcode =                      *((u8 *)     (sp + 2 * 4));
-       uf    = (unresolved_field *) *((ptrint *) (sp + 1 * 4));
+       ra    = (u1 *)               pr->mpc;
+       uf    = (unresolved_field *) pr->ref;
 
        /* get the fieldinfo */
 
@@ -158,19 +93,11 @@ bool patcher_get_putstatic(u1 *sp)
 
        /* 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 code */
-
-       *((u4 *) (ra + 0)) = (u4) mcode;
-       *((u1 *) (ra + 4)) = (u1) (mcode >> 32);
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
+       PATCH_BACK_ORIGINAL_MCODE;
 
        /* patch the field value's address */
 
@@ -189,33 +116,23 @@ bool patcher_get_putstatic(u1 *sp)
 
 *******************************************************************************/
 
-bool patcher_getfield(u1 *sp)
+bool patcher_getfield(patchref_t *pr)
 {
        u1               *ra;
-       u8                mcode;
        unresolved_field *uf;
        fieldinfo        *fi;
 
        /* get stuff from the stack */
 
-       ra    = (u1 *)               *((ptrint *) (sp + 6 * 4));
-       mcode =                      *((u8 *)     (sp + 2 * 4));
-       uf    = (unresolved_field *) *((ptrint *) (sp + 1 * 4));
+       ra    = (u1 *)               pr->mpc;
+       uf    = (unresolved_field *) pr->ref;
 
        /* get the fieldinfo */
 
        if (!(fi = resolve_field_eager(uf)))
                return false;
 
-       /* patch back original code */
-
-       *((u4 *) (ra + 0)) = (u4) mcode;
-       *((u1 *) (ra + 4)) = (u1) (mcode >> 32);
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
+       PATCH_BACK_ORIGINAL_MCODE;
 
        /* patch the field's offset */
 
@@ -239,33 +156,23 @@ bool patcher_getfield(u1 *sp)
 
 *******************************************************************************/
 
-bool patcher_putfield(u1 *sp)
+bool patcher_putfield(patchref_t *pr)
 {
        u1               *ra;
-       u8                mcode;
        unresolved_field *uf;
        fieldinfo        *fi;
 
        /* get stuff from the stack */
 
-       ra    = (u1 *)               *((ptrint *) (sp + 6 * 4));
-       mcode =                      *((u8 *)     (sp + 2 * 4));
-       uf    = (unresolved_field *) *((ptrint *) (sp + 1 * 4));
+       ra    = (u1 *)               pr->mpc;
+       uf    = (unresolved_field *) pr->ref;
 
        /* get the fieldinfo */
 
        if (!(fi = resolve_field_eager(uf)))
                return false;
 
-       /* patch back original code */
-
-       *((u4 *) (ra + 0)) = (u4) mcode;
-       *((u1 *) (ra + 4)) = (u1) (mcode >> 32);
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
+       PATCH_BACK_ORIGINAL_MCODE;
 
        /* patch the field's offset */
 
@@ -296,33 +203,23 @@ bool patcher_putfield(u1 *sp)
 
 *******************************************************************************/
 
-bool patcher_putfieldconst(u1 *sp)
+bool patcher_putfieldconst(patchref_t *pr)
 {
        u1               *ra;
-       u8                mcode;
        unresolved_field *uf;
        fieldinfo        *fi;
 
        /* get stuff from the stack */
 
-       ra    = (u1 *)               *((ptrint *) (sp + 6 * 4));
-       mcode =                      *((u8 *)     (sp + 2 * 4));
-       uf    = (unresolved_field *) *((ptrint *) (sp + 1 * 4));
+       ra    = (u1 *)               pr->mpc;
+       uf    = (unresolved_field *) pr->ref;
 
        /* get the fieldinfo */
 
        if (!(fi = resolve_field_eager(uf)))
                return false;
 
-       /* patch back original code */
-
-       *((u4 *) (ra + 0)) = (u4) mcode;
-       *((u1 *) (ra + 4)) = (u1) (mcode >> 32);
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
+       PATCH_BACK_ORIGINAL_MCODE;
 
        /* patch the field's offset */
 
@@ -354,33 +251,23 @@ bool patcher_putfieldconst(u1 *sp)
 
 *******************************************************************************/
 
-bool patcher_aconst(u1 *sp)
+bool patcher_aconst(patchref_t *pr)
 {
        u1                *ra;
-       u8                 mcode;
        constant_classref *cr;
        classinfo         *c;
 
        /* get stuff from the stack */
 
-       ra    = (u1 *)                *((ptrint *) (sp + 6 * 4));
-       mcode =                       *((u8 *)     (sp + 2 * 4));
-       cr    = (constant_classref *) *((ptrint *) (sp + 1 * 4));
+       ra    = (u1 *)                pr->mpc;
+       cr    = (constant_classref *) pr->ref;
 
        /* get the classinfo */
 
        if (!(c = resolve_classref_eager(cr)))
                return false;
 
-       /* patch back original code */
-
-       *((u4 *) (ra + 0)) = (u4) mcode;
-       *((u1 *) (ra + 4)) = (u1) (mcode >> 32);
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
+       PATCH_BACK_ORIGINAL_MCODE;
 
        /* patch the classinfo pointer */
 
@@ -405,33 +292,23 @@ bool patcher_aconst(u1 *sp)
 
 *******************************************************************************/
 
-bool patcher_builtin_multianewarray(u1 *sp)
+bool patcher_builtin_multianewarray(patchref_t *pr)
 {
        u1                *ra;
-       u8                 mcode;
        constant_classref *cr;
        classinfo         *c;
 
        /* get stuff from the stack */
 
-       ra    = (u1 *)                *((ptrint *) (sp + 6 * 4));
-       mcode =                       *((u8 *)     (sp + 2 * 4));
-       cr    = (constant_classref *) *((ptrint *) (sp + 1 * 4));
+       ra    = (u1 *)                pr->mpc;
+       cr    = (constant_classref *) pr->ref;
 
        /* get the classinfo */
 
        if (!(c = resolve_classref_eager(cr)))
                return false;
 
-       /* patch back original code */
-
-       *((u4 *) (ra + 0)) = (u4) mcode;
-       *((u1 *) (ra + 4)) = (u1) (mcode >> 32);
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
+       PATCH_BACK_ORIGINAL_MCODE;
 
        /* patch the classinfo pointer */
 
@@ -452,33 +329,23 @@ bool patcher_builtin_multianewarray(u1 *sp)
 
 *******************************************************************************/
 
-bool patcher_builtin_arraycheckcast(u1 *sp)
+bool patcher_builtin_arraycheckcast(patchref_t *pr)
 {
        u1                *ra;
-       u8                 mcode;
        constant_classref *cr;
        classinfo         *c;
 
        /* get stuff from the stack */
 
-       ra    = (u1 *)                *((ptrint *) (sp + 6 * 4));
-       mcode =                       *((u8 *)     (sp + 2 * 4));
-       cr    = (constant_classref *) *((ptrint *) (sp + 1 * 4));
+       ra    = (u1 *)                pr->mpc;
+       cr    = (constant_classref *) pr->ref;
 
        /* get the classinfo */
 
        if (!(c = resolve_classref_eager(cr)))
                return false;
 
-       /* patch back original code */
-
-       *((u4 *) (ra + 0)) = (u4) mcode;
-       *((u1 *) (ra + 4)) = (u1) (mcode >> 32);
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
+       PATCH_BACK_ORIGINAL_MCODE;
 
        /* patch the classinfo pointer */
 
@@ -502,33 +369,23 @@ bool patcher_builtin_arraycheckcast(u1 *sp)
 
 *******************************************************************************/
 
-bool patcher_invokestatic_special(u1 *sp)
+bool patcher_invokestatic_special(patchref_t *pr)
 {
        u1                *ra;
-       u8                 mcode;
        unresolved_method *um;
        methodinfo        *m;
 
        /* get stuff from the stack */
 
-       ra    = (u1 *)                *((ptrint *) (sp + 6 * 4));
-       mcode =                       *((u8 *)     (sp + 2 * 4));
-       um    = (unresolved_method *) *((ptrint *) (sp + 1 * 4));
+       ra    = (u1 *)                pr->mpc;
+       um    = (unresolved_method *) pr->ref;
 
        /* get the fieldinfo */
 
        if (!(m = resolve_method_eager(um)))
                return false;
 
-       /* patch back original code */
-
-       *((u4 *) (ra + 0)) = (u4) mcode;
-       *((u1 *) (ra + 4)) = (u1) (mcode >> 32);
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
+       PATCH_BACK_ORIGINAL_MCODE;
 
        /* patch stubroutine */
 
@@ -549,33 +406,23 @@ bool patcher_invokestatic_special(u1 *sp)
 
 *******************************************************************************/
 
-bool patcher_invokevirtual(u1 *sp)
+bool patcher_invokevirtual(patchref_t *pr)
 {
        u1                *ra;
-       u8                 mcode;
        unresolved_method *um;
        methodinfo        *m;
 
        /* get stuff from the stack */
 
-       ra    = (u1 *)                *((ptrint *) (sp + 6 * 4));
-       mcode =                       *((u8 *)     (sp + 2 * 4));
-       um    = (unresolved_method *) *((ptrint *) (sp + 1 * 4));
+       ra    = (u1 *)                pr->mpc;
+       um    = (unresolved_method *) pr->ref;
 
        /* get the fieldinfo */
 
        if (!(m = resolve_method_eager(um)))
                return false;
 
-       /* patch back original code */
-
-       *((u4 *) (ra + 0)) = (u4) mcode;
-       *((u1 *) (ra + 4)) = (u1) (mcode >> 32);
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
+       PATCH_BACK_ORIGINAL_MCODE;
 
        /* patch vftbl index */
 
@@ -598,43 +445,33 @@ bool patcher_invokevirtual(u1 *sp)
 
 *******************************************************************************/
 
-bool patcher_invokeinterface(u1 *sp)
+bool patcher_invokeinterface(patchref_t *pr)
 {
        u1                *ra;
-       u8                 mcode;
        unresolved_method *um;
        methodinfo        *m;
 
        /* get stuff from the stack */
 
-       ra    = (u1 *)                *((ptrint *) (sp + 6 * 4));
-       mcode =                       *((u8 *)     (sp + 2 * 4));
-       um    = (unresolved_method *) *((ptrint *) (sp + 1 * 4));
+       ra    = (u1 *)                pr->mpc;
+       um    = (unresolved_method *) pr->ref;
 
        /* get the fieldinfo */
 
        if (!(m = resolve_method_eager(um)))
                return false;
 
-       /* patch back original code */
-
-       *((u4 *) (ra + 0)) = (u4) mcode;
-       *((u1 *) (ra + 4)) = (u1) (mcode >> 32);
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
+       PATCH_BACK_ORIGINAL_MCODE;
 
        /* patch interfacetable index */
 
        *((s4 *) (ra + 2 + 2)) = (s4) (OFFSET(vftbl_t, interfacetable[0]) -
-                                                                  sizeof(methodptr) * m->class->index);
+                                                                  sizeof(methodptr) * m->clazz->index);
 
        /* patch method offset */
 
        *((s4 *) (ra + 2 + 6 + 2)) =
-               (s4) (sizeof(methodptr) * (m - m->class->methods));
+               (s4) (sizeof(methodptr) * (m - m->clazz->methods));
 
        return true;
 }
@@ -649,33 +486,23 @@ bool patcher_invokeinterface(u1 *sp)
 
 *******************************************************************************/
 
-bool patcher_checkcast_instanceof_flags(u1 *sp)
+bool patcher_checkcast_instanceof_flags(patchref_t *pr)
 {
        u1                *ra;
-       u8                 mcode;
        constant_classref *cr;
        classinfo         *c;
 
        /* get stuff from the stack */
 
-       ra    = (u1 *)                *((ptrint *) (sp + 6 * 4));
-       mcode =                       *((u8 *)     (sp + 2 * 4));
-       cr    = (constant_classref *) *((ptrint *) (sp + 1 * 4));
+       ra    = (u1 *)                pr->mpc;
+       cr    = (constant_classref *) pr->ref;
 
        /* get the fieldinfo */
 
        if (!(c = resolve_classref_eager(cr)))
                return false;
 
-       /* patch back original code */
-
-       *((u4 *) (ra + 0)) = (u4) mcode;
-       *((u1 *) (ra + 4)) = (u1) (mcode >> 32);
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
+       PATCH_BACK_ORIGINAL_MCODE;
 
        /* patch class flags */
 
@@ -699,33 +526,23 @@ bool patcher_checkcast_instanceof_flags(u1 *sp)
 
 *******************************************************************************/
 
-bool patcher_checkcast_interface(u1 *sp)
+bool patcher_checkcast_interface(patchref_t *pr)
 {
        u1                *ra;
-       u8                 mcode;
        constant_classref *cr;
        classinfo         *c;
 
        /* get stuff from the stack */
 
-       ra    = (u1 *)                *((ptrint *) (sp + 6 * 4));
-       mcode =                       *((u8 *)     (sp + 2 * 4));
-       cr    = (constant_classref *) *((ptrint *) (sp + 1 * 4));
+       ra    = (u1 *)                pr->mpc;
+       cr    = (constant_classref *) pr->ref;
 
        /* get the fieldinfo */
 
        if (!(c = resolve_classref_eager(cr)))
                return false;
 
-       /* patch back original code */
-
-       *((u4 *) (ra + 0)) = (u4) mcode;
-       *((u1 *) (ra + 4)) = (u1) (mcode >> 32);
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
+       PATCH_BACK_ORIGINAL_MCODE;
 
        /* patch super class index */
 
@@ -752,33 +569,23 @@ bool patcher_checkcast_interface(u1 *sp)
 
 *******************************************************************************/
 
-bool patcher_instanceof_interface(u1 *sp)
+bool patcher_instanceof_interface(patchref_t *pr)
 {
        u1                *ra;
-       u8                 mcode;
        constant_classref *cr;
        classinfo         *c;
 
        /* get stuff from the stack */
 
-       ra    = (u1 *)                *((ptrint *) (sp + 6 * 4));
-       mcode =                       *((u8 *)     (sp + 2 * 4));
-       cr    = (constant_classref *) *((ptrint *) (sp + 1 * 4));
+       ra    = (u1 *)                pr->mpc;
+       cr    = (constant_classref *) pr->ref;
 
        /* get the fieldinfo */
 
        if (!(c = resolve_classref_eager(cr)))
                return false;
 
-       /* patch back original code */
-
-       *((u4 *) (ra + 0)) = (u4) mcode;
-       *((u1 *) (ra + 4)) = (u1) (mcode >> 32);
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
+       PATCH_BACK_ORIGINAL_MCODE;
 
        /* patch super class index */
 
@@ -805,38 +612,27 @@ bool patcher_instanceof_interface(u1 *sp)
 
 *******************************************************************************/
 
-bool patcher_checkcast_class(u1 *sp)
+bool patcher_checkcast_class(patchref_t *pr)
 {
        u1                *ra;
-       u8                 mcode;
        constant_classref *cr;
        classinfo         *c;
 
        /* get stuff from the stack */
 
-       ra    = (u1 *)                *((ptrint *) (sp + 6 * 4));
-       mcode =                       *((u8 *)     (sp + 2 * 4));
-       cr    = (constant_classref *) *((ptrint *) (sp + 1 * 4));
+       ra    = (u1 *)                pr->mpc;
+       cr    = (constant_classref *) pr->ref;
 
        /* get the fieldinfo */
 
        if (!(c = resolve_classref_eager(cr)))
                return false;
 
-       /* patch back original code */
-
-       *((u4 *) (ra + 0)) = (u4) mcode;
-       *((u1 *) (ra + 4)) = (u1) (mcode >> 32);
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
+       PATCH_BACK_ORIGINAL_MCODE;
 
        /* patch super class' vftbl */
 
        *((ptrint *) (ra + 1)) = (ptrint) c->vftbl;
-       *((ptrint *) (ra + 5 + 6 + 6 + 2 + 1)) = (ptrint) c->vftbl;
 
        return true;
 }
@@ -854,33 +650,23 @@ bool patcher_checkcast_class(u1 *sp)
 
 *******************************************************************************/
 
-bool patcher_instanceof_class(u1 *sp)
+bool patcher_instanceof_class(patchref_t *pr)
 {
        u1                *ra;
-       u8                 mcode;
        constant_classref *cr;
        classinfo         *c;
 
        /* get stuff from the stack */
 
-       ra    = (u1 *)                *((ptrint *) (sp + 6 * 4));
-       mcode =                       *((u8 *)     (sp + 2 * 4));
-       cr    = (constant_classref *) *((ptrint *) (sp + 1 * 4));
+       ra    = (u1 *)                pr->mpc;
+       cr    = (constant_classref *) pr->ref;
 
        /* get the fieldinfo */
 
        if (!(c = resolve_classref_eager(cr)))
                return false;
 
-       /* patch back original code */
-
-       *((u4 *) (ra + 0)) = (u4) mcode;
-       *((u1 *) (ra + 4)) = (u1) (mcode >> 32);
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
+       PATCH_BACK_ORIGINAL_MCODE;
 
        /* patch super class' vftbl */
 
@@ -890,128 +676,6 @@ bool patcher_instanceof_class(u1 *sp)
 }
 
 
-/* patcher_clinit **************************************************************
-
-   Is used int PUT/GETSTATIC and native stub.
-
-   Machine code:
-
-   <patched call position>
-
-*******************************************************************************/
-
-bool patcher_clinit(u1 *sp)
-{
-       u1        *ra;
-       u8         mcode;
-       classinfo *c;
-
-       /* get stuff from the stack */
-
-       ra    = (u1 *)        *((ptrint *) (sp + 6 * 4));
-       mcode =               *((u8 *)     (sp + 2 * 4));
-       c     = (classinfo *) *((ptrint *) (sp + 1 * 4));
-
-       /* check if the class is initialized */
-
-       if (!(c->state & CLASS_INITIALIZED))
-               if (!initialize_class(c))
-                       return false;
-
-       /* patch back original code */
-
-       *((u4 *) (ra + 0)) = (u4) mcode;
-       *((u1 *) (ra + 4)) = (u1) (mcode >> 32);
-
-       return true;
-}
-
-
-/* patcher_athrow_areturn ******************************************************
-
-   Machine code:
-
-   <patched call position>
-
-*******************************************************************************/
-
-#ifdef ENABLE_VERIFIER
-bool patcher_athrow_areturn(u1 *sp)
-{
-       u1               *ra;
-       u8                mcode;
-       unresolved_class *uc;
-
-       /* get stuff from the stack */
-
-       ra    = (u1 *)               *((ptrint *) (sp + 6 * 4));
-       mcode =                      *((u8 *)     (sp + 2 * 4));
-       uc    = (unresolved_class *) *((ptrint *) (sp + 1 * 4));
-
-       /* resolve the class and check subtype constraints */
-
-       if (!resolve_class_eager_no_access_check(uc))
-               return false;
-
-       /* patch back original code */
-
-       *((u4 *) (ra + 0)) = (u4) mcode;
-       *((u1 *) (ra + 4)) = (u1) (mcode >> 32);
-
-       return true;
-}
-#endif /* ENABLE_VERIFIER */
-
-
-/* patcher_resolve_native ******************************************************
-
-   Is used in native stub.
-
-   Machine code:
-
-   <patched call position>
-   c7 44 24 04 28 90 01 40    movl   $0x40019028,0x4(%esp)
-
-*******************************************************************************/
-
-#if !defined(WITH_STATIC_CLASSPATH)
-bool patcher_resolve_native(u1 *sp)
-{
-       u1          *ra;
-       u8           mcode;
-       methodinfo  *m;
-       functionptr  f;
-
-       /* get stuff from the stack */
-
-       ra    = (u1 *)         *((ptrint *) (sp + 6 * 4));
-       mcode =                *((u8 *)     (sp + 2 * 4));
-       m     = (methodinfo *) *((ptrint *) (sp + 1 * 4));
-
-       /* resolve native function */
-
-       if (!(f = native_resolve_function(m)))
-               return false;
-
-       /* patch back original code */
-
-       *((u4 *) (ra + 0)) = (u4) mcode;
-       *((u1 *) (ra + 4)) = (u1) (mcode >> 32);
-
-       /* if we show disassembly, we have to skip the nop's */
-
-       if (opt_shownops)
-               ra = ra + 5;
-
-       /* patch native function pointer */
-
-       *((ptrint *) (ra + 4)) = (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