Changes: Edwin Steiner
- $Id: patcher.h 4921 2006-05-15 14:24:36Z twisti $
+ $Id: patcher.h 5081 2006-07-06 13:59:01Z tbfg $
*/
#define _PATCHER_H
#include "config.h"
+
+#include <assert.h>
+
#include "vm/types.h"
#include "vm/global.h"
/* patcher macros *************************************************************/
+#define PATCHER_FLAG_PATCHED (vftbl_t *) 0xdeadbeef
+
+
#if defined(ENABLE_THREADS)
#define PATCHER_MONITORENTER \
\
/* check if the position has already been patched */ \
\
- if (o->vftbl) { \
+ if (o->vftbl != NULL) { \
+ assert(o->vftbl == PATCHER_FLAG_PATCHED); \
+ \
builtin_monitorexit(o); \
\
- return true; \
+ return NULL; \
} \
#define PATCHER_MARK_PATCHED_MONITOREXIT \
/* mark position as patched */ \
\
- o->vftbl = (vftbl_t *) 1; \
+ o->vftbl = PATCHER_FLAG_PATCHED; \
\
PATCHER_MONITOREXIT
/* function prototypes ********************************************************/
+java_objectheader *patcher_wrapper(u1 *sp, u1 *pv, u1 *ra);
+#define PATCHER_wrapper (functionptr) patcher_wrapper
+
bool patcher_get_putstatic(u1 *sp);
#define PATCHER_get_putstatic (functionptr) patcher_get_putstatic
bool patcher_checkcast_instanceof_interface(u1 *sp);
#define PATCHER_checkcast_instanceof_interface (functionptr) patcher_checkcast_instanceof_interface
-#if defined(__I386__) || defined(__X86_64__) || defined(__POWERPC__)
+#if defined(__I386__) || defined(__X86_64__) || defined(__POWERPC__) || defined(__POWERPC64__)
bool patcher_checkcast_class(u1 *sp);
#define PATCHER_checkcast_class (functionptr) patcher_checkcast_class
bool patcher_instanceof_class(u1 *sp);
#define PATCHER_instanceof_class (functionptr) patcher_instanceof_class
-#else /* defined(__I386__) || defined(__X86_64__) || defined(__POWERPC__) */
+#else /* defined(__I386__) || defined(__X86_64__) || defined(__POWERPC__) || defined(__POWERPC64__)*/
bool patcher_checkcast_instanceof_class(u1 *sp);
#define PATCHER_checkcast_instanceof_class (functionptr) patcher_checkcast_instanceof_class
-#endif /* defined(__I386__) || defined(__X86_64__) || defined(__POWERPC__) */
+#endif /* defined(__I386__) || defined(__X86_64__) || defined(__POWERPC__) || defined(__POWERPC64__)*/
bool patcher_clinit(u1 *sp);
#define PATCHER_clinit (functionptr) patcher_clinit