merged volatile memory barriers
[cacao.git] / src / vm / jit / patcher-common.hpp
index 5f25ae83f77e0cd21a5817f2a929cdb3230bd7a2..684b41c13a8c28f846aa398237af6ea390da78bd 100644 (file)
@@ -1,6 +1,6 @@
 /* src/vm/jit/patcher-common.hpp - architecture independent code patching stuff
 
-   Copyright (C) 2007, 2008
+   Copyright (C) 2007, 2008, 2009
    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
 /* forward typedefs ***********************************************************/
 
+typedef struct patchref_t patchref_t;
+
 #include "config.h"
 #include "vm/types.h"
 
-#include "toolbox/list.h"
+#include "toolbox/list.hpp"
 
 #include "vm/global.h"
 
 
 *******************************************************************************/
 
-typedef 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    */
+struct patchref_t {
+       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    */
+       int32_t      disp_mb;       /* auxiliary code displacement (for membar)   */
        functionptr  patcher;       /* patcher function to call                   */
        void*        ref;           /* reference passed                           */
        uint32_t     mcode;         /* machine code to be patched back in         */
        bool         done;          /* XXX preliminary: patch already applied?    */
-       listnode_t   linkage;
-} patchref_t;
+};
 
 
 /* macros *********************************************************************/
@@ -70,7 +72,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);
 
@@ -80,7 +86,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) ***************************/
@@ -113,6 +119,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);