* Updated to jitcache-arm-x86 branch d4f6023b26c5+d1b5b1c106ac
[cacao.git] / src / vm / jit / patcher-common.hpp
index 5f25ae83f77e0cd21a5817f2a929cdb3230bd7a2..7a10d4d22cf278dadb0fb84425ab15672169308f 100644 (file)
 
 /* forward typedefs ***********************************************************/
 
+typedef struct cachedref_t cachedref_t;
+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"
 
 #include "vm/jit/jit.hpp"
 
+#if defined (ENABLE_JITCACHE)
+struct cached_ref_t;
+#endif
 
 /* patchref_t ******************************************************************
 
@@ -45,7 +51,7 @@
 
 *******************************************************************************/
 
-typedef struct 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    */
@@ -53,8 +59,12 @@ typedef struct patchref_t {
        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;
+#if defined (ENABLE_JITCACHE)
+       cachedref_t  *attached_ref;
+                                                               /* cached reference which must be resolved    *
+                                                                * patcher has been run.                      */
+#endif
+};
 
 
 /* macros *********************************************************************/
@@ -188,6 +198,10 @@ bool patcher_instanceof_class(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