Changes: Christian Thalinger
Edwin Steiner
- $Id: asmpart.S 5145 2006-07-17 11:48:38Z twisti $
+ $Id: asmpart.S 5164 2006-07-19 15:54:01Z twisti $
*/
/* directly to the caller (ra). */
L_asm_call_jit_compiler_exception:
-#if defined(ENABLE_THREADS)
aaddiu sp,sp,-2*8
ast ra,0*8(sp)
- jal builtin_asm_get_exceptionptrptr
+ jal exceptions_get_and_clear_exception
ald ra,0*8(sp)
aaddiu sp,sp,2*8
-#else
- la v0,_exceptionptr
-#endif
- ald xptr,0(v0) /* get the exception pointer */
- ast zero,0(v0) /* clear the exception pointer */
- aaddiu xpc,ra,-4 /* faulting address is return adress - 4 */
+ move xptr,v0 /* get exception */
+ aaddiu xpc,ra,-4 /* exception address is RA - 4 */
b asm_handle_nat_exception
.end asm_call_jit_compiler
*******************************************************************************/
+ .ent asm_abstractmethoderror
+
asm_abstractmethoderror:
aaddiu sp,sp,-2*8 /* create stackframe */
ast ra,0*8(sp) /* save return address */
aaddiu xpc,ra,-4 /* exception address is ra - 4 */
b asm_handle_nat_exception
+ .end asm_abstractmethoderror
+
/* asm_patcher_wrapper *********************************************************
.ent asm_patcher_wrapper
asm_patcher_wrapper:
- aaddiu sp,sp,-((2+16+22+4)*8+sizestackframeinfo) /* create stack frame */
+ aaddiu sp,sp,-((2+16+22+4)*8)/* create stack frame */
SAVE_RETURN_REGISTERS(0) /* save 1 int/1 float return registers */
SAVE_ARGUMENT_REGISTERS(2) /* save 8 int/8 float argument registers */
ast ra,(2+16+22+2)*8(sp) /* save method return address (for leafs) */
ast pv,(2+16+22+3)*8(sp) /* save pv of calling java function */
- aaddiu a0,sp,(2+16+22+4)*8 /* create stackframe info */
- move a1,pv /* pass java pv */
- aaddiu a2,sp,((6+2+16+22+4)*8+sizestackframeinfo) /* pass java sp */
- move a3,ra /* this is correct for leafs */
- ald a4,((5+2+16+22+4)*8+sizestackframeinfo)(sp) /* pass xpc */
- jal stacktrace_create_extern_stackframeinfo
-
- aaddiu a0,sp,((0+2+16+22+4)*8+sizestackframeinfo) /* pass sp */
- ald itmp3,((0+2+16+22+4)*8+sizestackframeinfo)(sp) /* get function */
- ald itmp1,(2+16+22+3)*8(sp) /* save pv to the position of fp */
- ast itmp1,((0+2+16+22+4)*8+sizestackframeinfo)(sp)
- jalr itmp3
- ast v0,((0+2+16+22+4)*8+sizestackframeinfo)(sp) /* save return value */
-
- aaddiu a0,sp,(2+16+22+4)*8 /* remove stackframe info */
- jal stacktrace_remove_stackframeinfo
+ aaddiu a0,sp,(2+16+22+4)*8 /* pass SP of patcher stub */
+ move a1,pv /* pass PV */
+ move a2,ra /* pass RA (correct for leafs) */
+ jal patcher_wrapper
+ move itmp3,v0
RESTORE_RETURN_REGISTERS(0) /* restore 1 int/1 float return registers */
RESTORE_ARGUMENT_REGISTERS(2) /* restore 8 int/8 float argument registers */
ald ra,(2+16+22+2)*8(sp) /* restore method return address (for leafs)*/
ald pv,(2+16+22+3)*8(sp) /* restore pv of calling java function */
- ald itmp3,((0+2+16+22+4)*8+sizestackframeinfo)(sp) /* get return value*/
- beqz itmp3,L_asm_patcher_wrapper_exception
+ bnez itmp3,L_asm_patcher_wrapper_exception
- ald itmp3,((5+2+16+22+4)*8+sizestackframeinfo)(sp) /* get RA to JIT */
- aaddiu sp,sp,((6+2+16+22+4)*8+sizestackframeinfo) /* remove stack frame */
+ ald itmp3,(5+2+16+22+4)*8(sp) /* load RA */
+ aaddiu sp,sp,(6+2+16+22+4)*8 /* remove stack frame */
jr itmp3 /* jump to new patched code */
L_asm_patcher_wrapper_exception:
- ald xpc,((5+2+16+22+4)*8+sizestackframeinfo)(sp) /* RA to JIT is xpc */
- aaddiu sp,sp,((6+2+16+22+4)*8+sizestackframeinfo) /* remove stack frame */
-
-#if defined(ENABLE_THREADS)
- daddiu sp,sp,-4*8
- sd xpc,0*8(sp)
- sd ra,1*8(sp)
- sd pv,2*8(sp)
- jal builtin_asm_get_exceptionptrptr
- ld xpc,0*8(sp)
- ld ra,1*8(sp)
- ld pv,2*8(sp)
- daddiu sp,sp,4*8
-#else
- la v0,_exceptionptr
-#endif
- ld xptr,0(v0) /* get the exception pointer */
- sd zero,0(v0) /* clear the exception pointer */
+ move xptr,itmp3 /* get exception */
+ ald xpc,(5+2+16+22+4)*8(sp) /* xpc is RA */
+ aaddiu sp,sp,(6+2+16+22+4)*8 /* remove stack frame */
b asm_handle_exception
.end asm_patcher_wrapper
Changes:
- $Id: patcher.c 4640 2006-03-16 17:24:18Z twisti $
+ $Id: patcher.c 5164 2006-07-19 15:54:01Z twisti $
*/
#include "config.h"
+
+#include <assert.h>
+
#include "vm/types.h"
#include "mm/memory.h"
#include "native/native.h"
#include "vm/builtin.h"
#include "vm/class.h"
+#include "vm/exceptions.h"
#include "vm/field.h"
#include "vm/initialize.h"
#include "vm/options.h"
#include "vm/jit/patcher.h"
+/* patcher_wrapper *************************************************************
+
+ Wrapper for all patchers. It also creates the stackframe info
+ structure.
+
+ If the return value of the patcher function is false, it gets the
+ exception object, clears the exception pointer and returns the
+ exception.
+
+*******************************************************************************/
+
+java_objectheader *patcher_wrapper(u1 *sp, u1 *pv, u1 *ra)
+{
+ stackframeinfo sfi;
+ u1 *xpc;
+ java_objectheader *o;
+ functionptr f;
+ bool result;
+ java_objectheader *e;
+
+ /* define the patcher function */
+
+ bool (*patcher_function)(u1 *);
+
+ assert(pv != NULL);
+
+ /* get stuff from the stack */
+
+ xpc = (u1 *) *((ptrint *) (sp + 5 * 8));
+ o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
+ f = (functionptr) *((ptrint *) (sp + 0 * 8));
+
+ /* store PV into the patcher function position */
+
+ *((ptrint *) (sp + 0 * 8)) = (ptrint) pv;
+
+ /* 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 */
+
+ stacktrace_create_extern_stackframeinfo(&sfi, pv, sp + 6 * 8, ra, 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;
+}
+
+
/* patcher_get_putstatic *******************************************************
Machine code:
bool patcher_get_putstatic(u1 *sp)
{
- u1 *ra;
- java_objectheader *o;
+ u1 *ra;
#if SIZEOF_VOID_P == 8
- u8 mcode;
+ u8 mcode;
#else
- u4 mcode[2];
+ u4 mcode[2];
#endif
- unresolved_field *uf;
- s4 disp;
- u1 *pv;
- fieldinfo *fi;
+ unresolved_field *uf;
+ s4 disp;
+ u1 *pv;
+ fieldinfo *fi;
/* get stuff from the stack */
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
#if SIZEOF_VOID_P == 8
- mcode = *((u8 *) (sp + 3 * 8));
+ mcode = *((u8 *) (sp + 3 * 8));
#else
- mcode[0] = *((u4 *) (sp + 3 * 8));
- mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
+ mcode[0] = *((u4 *) (sp + 3 * 8));
+ mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
#endif
- uf = (unresolved_field *) *((ptrint *) (sp + 2 * 8));
- disp = *((s4 *) (sp + 1 * 8));
- pv = (u1 *) *((ptrint *) (sp + 0 * 8));
-
- PATCHER_MONITORENTER;
+ uf = (unresolved_field *) *((ptrint *) (sp + 2 * 8));
+ disp = *((s4 *) (sp + 1 * 8));
+ pv = (u1 *) *((ptrint *) (sp + 0 * 8));
/* get the fieldinfo */
- if (!(fi = resolve_field_eager(uf))) {
- PATCHER_MONITOREXIT;
-
+ if (!(fi = resolve_field_eager(uf)))
return false;
- }
/* check if the field's class is initialized */
- if (!(fi->class->state & CLASS_INITIALIZED)) {
- if (!initialize_class(fi->class)) {
- PATCHER_MONITOREXIT;
-
+ if (!(fi->class->state & CLASS_INITIALIZED))
+ if (!initialize_class(fi->class))
return false;
- }
- }
/* patch back original code */
md_dcacheflush(pv + disp, SIZEOF_VOID_P);
- PATCHER_MARK_PATCHED_MONITOREXIT;
-
return true;
}
bool patcher_get_putfield(u1 *sp)
{
- u1 *ra;
- java_objectheader *o;
+ u1 *ra;
#if SIZEOF_VOID_P == 8
- u8 mcode;
+ u8 mcode;
#else
- u4 mcode[2];
+ u4 mcode[2];
#endif
- unresolved_field *uf;
- fieldinfo *fi;
+ unresolved_field *uf;
+ fieldinfo *fi;
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
#if SIZEOF_VOID_P == 8
- mcode = *((u8 *) (sp + 3 * 8));
+ mcode = *((u8 *) (sp + 3 * 8));
#else
- mcode[0] = *((u4 *) (sp + 3 * 8));
- mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
+ mcode[0] = *((u4 *) (sp + 3 * 8));
+ mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
#endif
- uf = (unresolved_field *) *((ptrint *) (sp + 2 * 8));
-
- PATCHER_MONITORENTER;
+ uf = (unresolved_field *) *((ptrint *) (sp + 2 * 8));
/* get the fieldinfo */
- if (!(fi = resolve_field_eager(uf))) {
- PATCHER_MONITOREXIT;
-
+ if (!(fi = resolve_field_eager(uf)))
return false;
- }
/* patch back original code */
if (opt_showdisassemble) {
#if SIZEOF_VOID_P == 4
- if (fi->type == TYPE_LNG) {
+ if (fi->type == TYPE_LNG)
md_icacheflush(ra - 2 * 4, 4 * 4);
- } else
+ else
#endif
md_icacheflush(ra - 2 * 4, 3 * 4);
- } else {
+ }
+ else {
md_icacheflush(ra, 2 * 4);
}
- PATCHER_MARK_PATCHED_MONITOREXIT;
-
return true;
}
bool patcher_aconst(u1 *sp)
{
u1 *ra;
- java_objectheader *o;
#if SIZEOF_VOID_P == 8
u8 mcode;
#else
/* get stuff from the stack */
ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
#if SIZEOF_VOID_P == 8
mcode = *((u8 *) (sp + 3 * 8));
#else
disp = *((s4 *) (sp + 1 * 8));
pv = (u1 *) *((ptrint *) (sp + 0 * 8));
- PATCHER_MONITORENTER;
-
/* get the classinfo */
- if (!(c = resolve_classref_eager(cr))) {
- PATCHER_MONITOREXIT;
-
+ if (!(c = resolve_classref_eager(cr)))
return false;
- }
/* patch back original code */
md_dcacheflush(pv + disp, SIZEOF_VOID_P);
- PATCHER_MARK_PATCHED_MONITOREXIT;
-
return true;
}
bool patcher_builtin_multianewarray(u1 *sp)
{
u1 *ra;
- java_objectheader *o;
#if SIZEOF_VOID_P == 8
u8 mcode;
#else
/* get stuff from the stack */
ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
#if SIZEOF_VOID_P == 8
mcode = *((u8 *) (sp + 3 * 8));
#else
disp = *((s4 *) (sp + 1 * 8));
pv = (u1 *) *((ptrint *) (sp + 0 * 8));
- PATCHER_MONITORENTER;
-
/* get the classinfo */
- if (!(c = resolve_classref_eager(cr))) {
- PATCHER_MONITOREXIT;
-
+ if (!(c = resolve_classref_eager(cr)))
return false;
- }
/* patch back original code */
md_dcacheflush(pv + disp, SIZEOF_VOID_P);
- PATCHER_MARK_PATCHED_MONITOREXIT;
-
return true;
}
bool patcher_builtin_arraycheckcast(u1 *sp)
{
u1 *ra;
- java_objectheader *o;
#if SIZEOF_VOID_P == 8
u8 mcode;
#else
/* get stuff from the stack */
ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
#if SIZEOF_VOID_P == 8
mcode = *((u8 *) (sp + 3 * 8));
#else
disp = *((s4 *) (sp + 1 * 8));
pv = (u1 *) *((ptrint *) (sp + 0 * 8));
- PATCHER_MONITORENTER;
-
/* get the classinfo */
- if (!(c = resolve_classref_eager(cr))) {
- PATCHER_MONITOREXIT;
-
+ if (!(c = resolve_classref_eager(cr)))
return false;
- }
/* patch back original code */
md_dcacheflush(pv + disp, SIZEOF_VOID_P);
- PATCHER_MARK_PATCHED_MONITOREXIT;
-
return true;
}
bool patcher_invokestatic_special(u1 *sp)
{
u1 *ra;
- java_objectheader *o;
#if SIZEOF_VOID_P == 8
u8 mcode;
#else
/* get stuff from the stack */
ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
#if SIZEOF_VOID_P == 8
mcode = *((u8 *) (sp + 3 * 8));
#else
disp = *((s4 *) (sp + 1 * 8));
pv = (u1 *) *((ptrint *) (sp + 0 * 8));
- PATCHER_MONITORENTER;
-
/* get the fieldinfo */
- if (!(m = resolve_method_eager(um))) {
- PATCHER_MONITOREXIT;
-
+ if (!(m = resolve_method_eager(um)))
return false;
- }
/* patch back original code */
md_dcacheflush(pv + disp, SIZEOF_VOID_P);
- PATCHER_MARK_PATCHED_MONITOREXIT;
-
return true;
}
bool patcher_invokevirtual(u1 *sp)
{
u1 *ra;
- java_objectheader *o;
#if SIZEOF_VOID_P == 8
u8 mcode;
#else
/* get stuff from the stack */
ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
#if SIZEOF_VOID_P == 8
mcode = *((u8 *) (sp + 3 * 8));
#else
#endif
um = (unresolved_method *) *((ptrint *) (sp + 2 * 8));
- PATCHER_MONITORENTER;
-
/* get the fieldinfo */
- if (!(m = resolve_method_eager(um))) {
- PATCHER_MONITOREXIT;
-
+ if (!(m = resolve_method_eager(um)))
return false;
- }
/* patch back original code */
else
md_icacheflush(ra, 2 * 4);
- PATCHER_MARK_PATCHED_MONITOREXIT;
-
return true;
}
bool patcher_invokeinterface(u1 *sp)
{
u1 *ra;
- java_objectheader *o;
#if SIZEOF_VOID_P == 8
u8 mcode;
#else
/* get stuff from the stack */
ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
#if SIZEOF_VOID_P == 8
mcode = *((u8 *) (sp + 3 * 8));
#else
#endif
um = (unresolved_method *) *((ptrint *) (sp + 2 * 8));
- PATCHER_MONITORENTER;
-
/* get the fieldinfo */
- if (!(m = resolve_method_eager(um))) {
- PATCHER_MONITOREXIT;
-
+ if (!(m = resolve_method_eager(um)))
return false;
- }
/* patch back original code */
else
md_icacheflush(ra, 3 * 4);
- PATCHER_MARK_PATCHED_MONITOREXIT;
-
return true;
}
bool patcher_checkcast_instanceof_flags(u1 *sp)
{
u1 *ra;
- java_objectheader *o;
#if SIZEOF_VOID_P == 8
u8 mcode;
#else
/* get stuff from the stack */
ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
#if SIZEOF_VOID_P == 8
mcode = *((u8 *) (sp + 3 * 8));
#else
disp = *((s4 *) (sp + 1 * 8));
pv = (u1 *) *((ptrint *) (sp + 0 * 8));
- PATCHER_MONITORENTER;
-
/* get the fieldinfo */
- if (!(c = resolve_classref_eager(cr))) {
- PATCHER_MONITOREXIT;
-
+ if (!(c = resolve_classref_eager(cr)))
return false;
- }
/* patch back original code */
md_dcacheflush(pv + disp, sizeof(s4));
- PATCHER_MARK_PATCHED_MONITOREXIT;
-
return true;
}
bool patcher_checkcast_instanceof_interface(u1 *sp)
{
u1 *ra;
- java_objectheader *o;
#if SIZEOF_VOID_P == 8
u8 mcode;
#else
/* get stuff from the stack */
ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
#if SIZEOF_VOID_P == 8
mcode = *((u8 *) (sp + 3 * 8));
#else
#endif
cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
- PATCHER_MONITORENTER;
-
/* get the fieldinfo */
- if (!(c = resolve_classref_eager(cr))) {
- PATCHER_MONITOREXIT;
-
+ if (!(c = resolve_classref_eager(cr)))
return false;
- }
/* patch back original code */
else
md_icacheflush(ra, 6 * 4);
- PATCHER_MARK_PATCHED_MONITOREXIT;
-
return true;
}
bool patcher_checkcast_instanceof_class(u1 *sp)
{
u1 *ra;
- java_objectheader *o;
#if SIZEOF_VOID_P == 8
u8 mcode;
#else
/* get stuff from the stack */
ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
#if SIZEOF_VOID_P == 8
mcode = *((u8 *) (sp + 3 * 8));
#else
disp = *((s4 *) (sp + 1 * 8));
pv = (u1 *) *((ptrint *) (sp + 0 * 8));
- PATCHER_MONITORENTER;
-
/* get the fieldinfo */
- if (!(c = resolve_classref_eager(cr))) {
- PATCHER_MONITOREXIT;
-
+ if (!(c = resolve_classref_eager(cr)))
return false;
- }
/* patch back original code */
md_dcacheflush(pv + disp, SIZEOF_VOID_P);
- PATCHER_MARK_PATCHED_MONITOREXIT;
-
return true;
}
bool patcher_clinit(u1 *sp)
{
- u1 *ra;
- java_objectheader *o;
+ u1 *ra;
#if SIZEOF_VOID_P == 8
- u8 mcode;
+ u8 mcode;
#else
- u4 mcode[2];
+ u4 mcode[2];
#endif
- classinfo *c;
+ classinfo *c;
/* get stuff from the stack */
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
#if SIZEOF_VOID_P == 8
- mcode = *((u8 *) (sp + 3 * 8));
+ mcode = *((u8 *) (sp + 3 * 8));
#else
- mcode[0] = *((u4 *) (sp + 3 * 8));
- mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
+ mcode[0] = *((u4 *) (sp + 3 * 8));
+ mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
#endif
- c = (classinfo *) *((ptrint *) (sp + 2 * 8));
-
- PATCHER_MONITORENTER;
+ c = (classinfo *) *((ptrint *) (sp + 2 * 8));
/* check if the class is initialized */
- if (!(c->state & CLASS_INITIALIZED)) {
- if (!initialize_class(c)) {
- PATCHER_MONITOREXIT;
-
+ if (!(c->state & CLASS_INITIALIZED))
+ if (!initialize_class(c))
return false;
- }
- }
/* patch back original code */
md_icacheflush(ra, 2 * 4);
- PATCHER_MARK_PATCHED_MONITOREXIT;
-
return true;
}
#ifdef ENABLE_VERIFIER
bool patcher_athrow_areturn(u1 *sp)
{
- u1 *ra;
- java_objectheader *o;
+ u1 *ra;
#if SIZEOF_VOID_P == 8
- u8 mcode;
+ u8 mcode;
#else
- u4 mcode[2];
+ u4 mcode[2];
#endif
- unresolved_class *uc;
- classinfo *c;
+ unresolved_class *uc;
+ classinfo *c;
/* get stuff from the stack */
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
#if SIZEOF_VOID_P == 8
- mcode = *((u8 *) (sp + 3 * 8));
+ mcode = *((u8 *) (sp + 3 * 8));
#else
- mcode[0] = *((u4 *) (sp + 3 * 8));
- mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
+ mcode[0] = *((u4 *) (sp + 3 * 8));
+ mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
#endif
- uc = (unresolved_class *) *((ptrint *) (sp + 2 * 8));
-
- PATCHER_MONITORENTER;
+ uc = (unresolved_class *) *((ptrint *) (sp + 2 * 8));
/* resolve the class */
- if (!resolve_class(uc, resolveEager, false, &c)) {
- PATCHER_MONITOREXIT;
-
+ if (!resolve_class(uc, resolveEager, false, &c))
return false;
- }
/* patch back original code */
md_icacheflush(ra, 2 * 4);
- PATCHER_MARK_PATCHED_MONITOREXIT;
-
return true;
}
#endif /* ENABLE_VERIFIER */
#if !defined(WITH_STATIC_CLASSPATH)
bool patcher_resolve_native(u1 *sp)
{
- u1 *ra;
- java_objectheader *o;
+ u1 *ra;
#if SIZEOF_VOID_P == 8
- u8 mcode;
+ u8 mcode;
#else
- u4 mcode[2];
+ u4 mcode[2];
#endif
- methodinfo *m;
- s4 disp;
- u1 *pv;
- functionptr f;
+ methodinfo *m;
+ s4 disp;
+ u1 *pv;
+ functionptr f;
/* get stuff from the stack */
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
+ ra = (u1 *) *((ptrint *) (sp + 5 * 8));
#if SIZEOF_VOID_P == 8
- mcode = *((u8 *) (sp + 3 * 8));
+ mcode = *((u8 *) (sp + 3 * 8));
#else
- mcode[0] = *((u4 *) (sp + 3 * 8));
- mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
+ mcode[0] = *((u4 *) (sp + 3 * 8));
+ mcode[1] = *((u4 *) (sp + 3 * 8 + 4));
#endif
- m = (methodinfo *) *((ptrint *) (sp + 2 * 8));
- disp = *((s4 *) (sp + 1 * 8));
- pv = (u1 *) *((ptrint *) (sp + 0 * 8));
+ m = (methodinfo *) *((ptrint *) (sp + 2 * 8));
+ disp = *((s4 *) (sp + 1 * 8));
+ pv = (u1 *) *((ptrint *) (sp + 0 * 8));
/* calculate and set the new return address */
ra = ra - 2 * 4;
*((ptrint *) (sp + 5 * 8)) = (ptrint) ra;
- PATCHER_MONITORENTER;
-
/* resolve native function */
- if (!(f = native_resolve_function(m))) {
- PATCHER_MONITOREXIT;
-
+ if (!(f = native_resolve_function(m)))
return false;
- }
/* patch back original code */
md_dcacheflush(pv + disp, SIZEOF_VOID_P);
- PATCHER_MARK_PATCHED_MONITOREXIT;
-
return true;
}
#endif /* !defined(WITH_STATIC_CLASSPATH) */