/* 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 *********************************************************************/
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);
// 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) ***************************/
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);