X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Fvm%2Fjit%2Fpatcher-common.h;h=994599a7826706d082cb6d168170350b4492492f;hb=032957bfb6cc84a4440fb6c3de972b15148b52b6;hp=0af93315357f6fd6f03cdf3457a6d53c5280e728;hpb=83e0e20c549e3e46eeba84da6f4195fdb3c1e6bd;p=cacao.git diff --git a/src/vm/jit/patcher-common.h b/src/vm/jit/patcher-common.h index 0af933153..994599a78 100644 --- a/src/vm/jit/patcher-common.h +++ b/src/vm/jit/patcher-common.h @@ -1,9 +1,7 @@ /* src/vm/jit/patcher-common.h - architecture independent code patching stuff - Copyright (C) 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) 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$ - */ @@ -41,6 +37,9 @@ #include "vm/jit/jit.h" +#if defined (ENABLE_JITCACHE) +struct cached_ref_t; +#endif /* patchref_t ****************************************************************** @@ -54,9 +53,14 @@ typedef struct patchref_t { ptrint datap; /* absolute position in data segment */ s4 disp; /* displacement of ref in the data segment */ functionptr patcher; /* patcher function to call */ - voidptr ref; /* reference passed */ + void* ref; /* reference passed */ u8 mcode; /* machine code to be patched back in */ bool done; /* XXX preliminary: patch already applied? */ +#if defined (ENABLE_JITCACHE) + struct cachedref_t *attached_ref; + /* cached reference which must be resolved * + * patcher has been run. */ +#endif listnode_t linkage; } patchref_t; @@ -70,15 +74,19 @@ void patcher_list_create(codeinfo *code); void patcher_list_reset(codeinfo *code); void patcher_list_free(codeinfo *code); -void patcher_add_patch_ref(jitdata *jd, functionptr patcher, voidptr ref, - s4 disp); +void patcher_add_patch_ref(jitdata *jd, functionptr patcher, void* ref, s4 disp); -java_objectheader *patcher_handler(u1 *pc); +void patcher_resolve(jitdata* jd); +java_handle_t *patcher_handler(u1 *pc); -/* patcher prototypes and macros **********************************************/ -#if defined(__ALPHA__) || defined(__ARM__) || defined(__POWERPC__) || defined (__S390__) +/* empty patcher (just patches back original mcode) ***************************/ + +void patcher_patch_code(patchref_t *pr); + + +/* patcher prototypes and macros **********************************************/ /* new patcher functions */ @@ -100,10 +108,8 @@ bool patcher_resolve_classref_to_index(patchref_t *pr); bool patcher_resolve_classref_to_flags(patchref_t *pr); #define PATCHER_resolve_classref_to_flags (functionptr) patcher_resolve_classref_to_flags -#if !defined(WITH_STATIC_CLASSPATH) bool patcher_resolve_native_function(patchref_t *pr); #define PATCHER_resolve_native_function (functionptr) patcher_resolve_native_function -#endif /* old patcher functions */ @@ -141,7 +147,7 @@ bool patcher_invokevirtual(patchref_t *pr); bool patcher_invokeinterface(patchref_t *pr); #define PATCHER_invokeinterface (functionptr) patcher_invokeinterface -#if defined(__ALPHA__) || defined(__POWERPC__) || defined(__S390__) +#if defined(__ALPHA__) || defined(__I386__) || defined(__MIPS__) || defined(__POWERPC__) || defined(__POWERPC64__) || defined(__S390__) || defined(__X86_64__) || defined(__M68K__) bool patcher_checkcast_interface(patchref_t *pr); #define PATCHER_checkcast_interface (functionptr) patcher_checkcast_interface @@ -149,21 +155,38 @@ bool patcher_checkcast_interface(patchref_t *pr); bool patcher_instanceof_interface(patchref_t *pr); #define PATCHER_instanceof_interface (functionptr) patcher_instanceof_interface -#endif /* defined(__ALPHA__) */ +#endif /* defined(__ALPHA__) || defined(__I386__) || defined(__MIPS__) || defined(__POWERPC__) || defined(__POWERPC64__) || defined(__S390__) || defined(__X86_64__) || defined(__M68K__) */ #if defined(__S390__) -bool patcher_clinit(patchref_t *pr); -#define PATCHER_clinit (functionptr) patcher_clinit - -bool patcher_athrow_areturn(patchref_t *pr); -#define PATCHER_athrow_areturn (functionptr) patcher_athrow_areturn bool patcher_checkcast_instanceof_interface(patchref_t *pr); #define PATCHER_checkcast_instanceof_interface (functionptr) patcher_checkcast_instanceof_interface -#endif /* defined (__S390__) */ -#endif /* architecture list */ +#endif /* defined(__S390__) */ + +#if defined(__I386__) + +bool patcher_aconst(patchref_t *pr); +#define PATCHER_aconst (functionptr) patcher_aconst + +bool patcher_builtin_multianewarray(patchref_t *pr); +#define PATCHER_builtin_multianewarray (functionptr) patcher_builtin_multianewarray + +bool patcher_builtin_arraycheckcast(patchref_t *pr); +#define PATCHER_builtin_arraycheckcast (functionptr) patcher_builtin_arraycheckcast + +bool patcher_checkcast_instanceof_flags(patchref_t *pr); +#define PATCHER_checkcast_instanceof_flags (functionptr) patcher_checkcast_instanceof_flags + +bool patcher_checkcast_class(patchref_t *pr); +#define PATCHER_checkcast_class (functionptr) patcher_checkcast_class + +bool patcher_instanceof_class(patchref_t *pr); +#define PATCHER_instanceof_class (functionptr) patcher_instanceof_class + +#endif /* defined(__I386__) */ +void patch_md(s4 md_patch, ptrint dest, voidptr ref); #endif /* _PATCHER_COMMON_H */