/* 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.
/* forward typedefs ***********************************************************/
-typedef struct cachedref_t cachedref_t;
typedef struct patchref_t patchref_t;
#include "config.h"
#include "vm/jit/jit.hpp"
-#if defined (ENABLE_JITCACHE)
-struct cached_ref_t;
-#endif
/* 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 */
bool done; /* XXX preliminary: patch already applied? */
-#if defined (ENABLE_JITCACHE)
- cachedref_t *attached_ref;
- /* cached reference which must be resolved *
- * patcher has been run. */
-#endif
};
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);
#endif /* defined(__I386__) */
-#if defined (__ARM__)
-void patch_md(s4 md_patch, ptrint dest, void* ref);
-#endif /* defined(__ARM__) */
-
#ifdef __cplusplus
} // extern "C"
#endif