* src/vm/jit/alpha/patcher.c (patcher_wrapper): Added return address
[cacao.git] / src / vm / jit / patcher.h
index 996bda95a750928e590b9b1fb6a92f97d699c877..6aba53588725b31f48d5866d7daee0fda2df91fe 100644 (file)
@@ -28,7 +28,7 @@
 
    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 $
 
 */
 
@@ -37,6 +37,9 @@
 #define _PATCHER_H
 
 #include "config.h"
+
+#include <assert.h>
+
 #include "vm/types.h"
 
 #include "vm/global.h"
@@ -44,6 +47,9 @@
 
 /* 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;                                     \
        }                                                    \
 
 
@@ -69,7 +77,7 @@
 #define PATCHER_MARK_PATCHED_MONITOREXIT \
        /* mark position as patched */                       \
                                                             \
-       o->vftbl = (vftbl_t *) 1;                            \
+       o->vftbl = PATCHER_FLAG_PATCHED;                     \
                                                             \
        PATCHER_MONITOREXIT
 
@@ -84,6 +92,9 @@
 
 /* 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
 
@@ -139,7 +150,7 @@ bool patcher_checkcast_instanceof_flags(u1 *sp);
 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
@@ -147,12 +158,12 @@ bool patcher_checkcast_class(u1 *sp);
 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