PR144 (aligned patchers on x86_64)
[cacao.git] / src / vm / jit / patcher-common.hpp
index 72ed1ec0bf5a9948d0af08ef9de861bd9f633492..1c6f7b7c62674f129e48f776817dc74cf20a7368 100644 (file)
@@ -1,6 +1,6 @@
 /* src/vm/jit/patcher-common.hpp - architecture independent code patching stuff
 
-   Copyright (C) 2007, 2008
+   Copyright (C) 1996-2011
    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
@@ -48,9 +48,11 @@ typedef struct patchref_t patchref_t;
 *******************************************************************************/
 
 struct patchref_t {
-       ptrint       mpc;           /* absolute position in code segment          */
-       ptrint       datap;         /* absolute position in data segment          */
-       s4           disp;          /* displacement of ref in the data segment    */
+       uintptr_t    mpc;           /* absolute position in code segment          */
+       uintptr_t    datap;         /* absolute position in data segment          */
+       int32_t      disp;          /* displacement of ref in the data segment    */
+       int16_t      disp_mb;       /* auxiliary code displacement (for membar)   */
+       int16_t      patch_align;   /* auxiliary displacement for alignment       */
        functionptr  patcher;       /* patcher function to call                   */
        void*        ref;           /* reference passed                           */
        uint32_t     mcode;         /* machine code to be patched back in         */
@@ -71,7 +73,11 @@ 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, void* ref, s4 disp);
+#if !defined(NDEBUG)
+void patcher_list_show(codeinfo *code);
+#endif
+
+patchref_t *patcher_add_patch_ref(jitdata *jd, functionptr patcher, void* ref, s4 disp);
 
 void patcher_resolve(jitdata* jd);
 
@@ -81,7 +87,7 @@ bool patcher_is_patched_at(void* pc);
 // MD function.
 bool patcher_is_valid_trap_instruction_at(void* pc);
 
-java_handle_t *patcher_handler(u1 *pc);
+bool patcher_handler(u1 *pc);
 
 
 /* empty patcher (just patches back original mcode) ***************************/
@@ -114,6 +120,9 @@ bool patcher_resolve_classref_to_flags(patchref_t *pr);
 bool patcher_resolve_native_function(patchref_t *pr);
 #define PATCHER_resolve_native_function (functionptr) patcher_resolve_native_function
 
+bool patcher_breakpoint(patchref_t *pr);
+#define PATCHER_breakpoint (functionptr) patcher_breakpoint
+
 /* old patcher functions */
 
 bool patcher_get_putstatic(patchref_t *pr);