X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Fvm%2Fjit%2Fx86_64%2Fpatcher.c;h=81cc09e0e8bbc78583471327af0d14c9203634c0;hb=67da78971605bb8a2953a9f6d5a7862857049538;hp=ae4b7aa2131eb14c9949dca08ab808ba38f185ab;hpb=8c6bb03b79a31fcdb02e2331a91a928d558c2845;p=cacao.git diff --git a/src/vm/jit/x86_64/patcher.c b/src/vm/jit/x86_64/patcher.c index ae4b7aa21..81cc09e0e 100644 --- a/src/vm/jit/x86_64/patcher.c +++ b/src/vm/jit/x86_64/patcher.c @@ -1,6 +1,6 @@ /* src/vm/jit/x86_64/patcher.c - x86_64 code patching functions - Copyright (C) 1996-2005, 2006, 2007, 2008 + Copyright (C) 1996-2005, 2006, 2007, 2008, 2009 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -176,6 +176,8 @@ bool patcher_resolve_classref_to_flags(patchref_t *pr) if (c == NULL) return false; + ra += PATCHER_CALL_SIZE; + // Patch class flags. /* *datap = c->flags; */ *((int32_t*) (ra + 2)) = c->flags; @@ -205,6 +207,7 @@ bool patcher_get_putstatic(patchref_t *pr) { unresolved_field* uf = (unresolved_field*) pr->ref; uintptr_t* datap = (uintptr_t*) pr->datap; + uint8_t* ra = (uint8_t*) pr->mpc; // Resolve the field. fieldinfo* fi = resolve_field_eager(uf); @@ -212,6 +215,8 @@ bool patcher_get_putstatic(patchref_t *pr) if (fi == NULL) return false; + ra += PATCHER_CALL_SIZE; + // Check if the field's class is initialized/ if (!(fi->clazz->state & CLASS_INITIALIZED)) if (!initialize_class(fi->clazz)) @@ -250,6 +255,8 @@ bool patcher_get_putfield(patchref_t *pr) if (fi == NULL) return false; + pc += PATCHER_CALL_SIZE; + // Patch the field's offset: we check for the field type, because // the instructions have different lengths. if (IS_INT_LNG_TYPE(fi->type)) { @@ -297,6 +304,8 @@ bool patcher_putfieldconst(patchref_t *pr) if (fi == NULL) return false; + pc += PATCHER_CALL_SIZE; + // Patch the field's offset. if (IS_2_WORD_TYPE(fi->type) || IS_ADR_TYPE(fi->type)) { // Handle special case when the base register is %r12. @@ -379,6 +388,8 @@ bool patcher_invokevirtual(patchref_t *pr) if (m == NULL) return false; + pc += PATCHER_CALL_SIZE; + // Patch vftbl index. *((int32_t*) (pc + 3 + 3)) = (int32_t) (OFFSET(vftbl_t, table[0]) + sizeof(methodptr) * m->vftblindex); @@ -415,6 +426,8 @@ bool patcher_invokeinterface(patchref_t *pr) if (m == NULL) return false; + pc += PATCHER_CALL_SIZE; + // Patch interfacetable index. *((int32_t*) (pc + 3 + 3)) = (int32_t) (OFFSET(vftbl_t, interfacetable[0]) - sizeof(methodptr) * m->clazz->index); @@ -455,6 +468,8 @@ bool patcher_checkcast_interface(patchref_t *pr) if (c == NULL) return false; + pc += PATCHER_CALL_SIZE; + // Patch super class index. *((int32_t*) (pc + 7 + 3)) = c->index; @@ -493,6 +508,8 @@ bool patcher_instanceof_interface(patchref_t *pr) if (c == NULL) return false; + pc += PATCHER_CALL_SIZE; + // Patch super class index. *((int32_t*) (pc + 7 + 3)) = c->index;