* src/vm/jit/parse.cpp,
[cacao.git] / src / vm / jit / jit.cpp
index cdb5cdffa55c603796f582b1350e3f9b904d0266..1dbb5c695c52c1b33d816289d32d55769d8767f9 100644 (file)
@@ -40,7 +40,7 @@
 
 #include "threads/mutex.hpp"
 
-#include "vm/class.h"
+#include "vm/class.hpp"
 #include "vm/global.h"
 #include "vm/globals.hpp"
 #include "vm/initialize.hpp"
 #include "vm/jit/disass.h"
 #include "vm/jit/dseg.h"
 #include "vm/jit/jit.hpp"
-#include "vm/jit/parse.h"
+#include "vm/jit/parse.hpp"
 #include "vm/jit/reg.h"
 
 #include "vm/jit/show.hpp"
 #include "vm/jit/stack.h"
 #include "vm/jit/stubs.hpp"
 
+#if defined(ENABLE_JITCACHE)
+# include "vm/jit/jitcache.hpp"
+#endif
+
 #if defined(ENABLE_OPAGENT)
 #include "vm/jit/oprofile-agent.hpp"
 #endif
@@ -312,6 +316,17 @@ u1 *jit_compile(methodinfo *m)
 
        STATISTICS(count_methods++);
 
+#if defined (ENABLE_JITCACHE)
+
+       if (jitcache_load (m))
+       {
+               m->mutex->unlock();
+
+               return m->code->entrypoint;
+       }
+
+#endif
+
 #if defined(ENABLE_STATISTICS)
        /* measure time */
 
@@ -402,6 +417,10 @@ u1 *jit_compile(methodinfo *m)
                DEBUG_JIT_COMPILEVERBOSE("Running: ");
        }
 
+#if defined (ENABLE_JITCACHE)
+       jitcache_store(m);
+#endif
+
 #if defined(ENABLE_STATISTICS)
        /* measure time */