* merged with tip (040f180a056b)
[cacao.git] / src / vm / jit / patcher-common.c
index 823948b32febe4595a8bf1f6185ce8fab72da7da..4128205c4036be8a3f7cdb14293172523f303d8b 100644 (file)
@@ -209,6 +209,10 @@ void patcher_add_patch_ref(jitdata *jd, functionptr patcher, void* ref, s4 disp)
        pr->mcode   = 0;
        pr->done    = false;
 
+#if defined(ENABLE_JITCACHE)
+       pr->attached_ref = NULL;
+#endif
+
        /* Generate NOPs for opt_shownops. */
 
        if (opt_shownops)
@@ -364,6 +368,15 @@ java_handle_t *patcher_handler(u1 *pc)
        }
 #endif
 
+#if defined(ENABLE_JITCACHE)
+       /* Put cached reference into the code and remove it from the patcher */
+       if (pr->attached_ref)
+       {
+               jitcache_handle_cached_ref(pr->attached_ref, code);
+               pr->attached_ref = NULL;
+       }
+#endif
+
        /* check for return value and exit accordingly */
 
        if (result == false) {
@@ -479,6 +492,28 @@ bool patcher_resolve_native_function(patchref_t *pr)
        return true;
 }
 
+/** Placeholder functions to calm down linker */
+#if defined(__I386__)
+bool patcher_resolve_classref_to_classinfo(patchref_t *pr)
+{
+       return true;
+}
+
+bool patcher_resolve_classref_to_vftbl(patchref_t *pr)
+{
+       return true;
+}
+
+bool patcher_resolve_classref_to_index(patchref_t *pr)
+{
+       return true;
+}
+
+bool patcher_resolve_classref_to_flags(patchref_t *pr)
+{
+       return true;
+}
+#endif
 
 /*
  * These are local overrides for various environment variables in Emacs.