* merged default branch into jitcache-arm-x86 branch
[cacao.git] / src / vm / jit / patcher-common.cpp
index b4799b3138184ab603afefb94ae348f42dab2a79..2bcf973ba8b43bbcd714f433e3bae8dc1c90c977 100644 (file)
@@ -189,6 +189,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
+
        // Store patcher in the list (NOTE: structure is copied).
        code->patchers->push_back(pr);
 
@@ -387,6 +391,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) {
@@ -504,6 +517,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.