[macruby-changes] [1905] MacRuby/branches/experimental
source_changes at macosforge.org
source_changes at macosforge.org
Fri Jun 19 22:20:37 PDT 2009
Revision: 1905
http://trac.macosforge.org/projects/ruby/changeset/1905
Author: lsansonetti at apple.com
Date: 2009-06-19 22:20:37 -0700 (Fri, 19 Jun 2009)
Log Message:
-----------
introduce a cache to avoid optimizing+JITing the same function twice
Modified Paths:
--------------
MacRuby/branches/experimental/vm.cpp
MacRuby/branches/experimental/vm.h
Modified: MacRuby/branches/experimental/vm.cpp
===================================================================
--- MacRuby/branches/experimental/vm.cpp 2009-06-20 05:06:56 UTC (rev 1904)
+++ MacRuby/branches/experimental/vm.cpp 2009-06-20 05:20:37 UTC (rev 1905)
@@ -284,6 +284,11 @@
IMP
RoxorVM::compile(Function *func)
{
+ std::map<Function *, IMP>::iterator iter = JITcache.find(func);
+ if (iter != JITcache.end()) {
+ return iter->second;
+ }
+
#if ROXOR_COMPILER_DEBUG
if (verifyModule(*RoxorCompiler::module)) {
printf("Error during module verification\n");
@@ -296,6 +301,7 @@
// Optimize & compile.
optimize(func);
IMP imp = (IMP)ee->getPointerToFunction(func);
+ JITcache[func] = imp;
#if ROXOR_COMPILER_DEBUG
uint64_t elapsed = mach_absolute_time() - start;
Modified: MacRuby/branches/experimental/vm.h
===================================================================
--- MacRuby/branches/experimental/vm.h 2009-06-20 05:06:56 UTC (rev 1904)
+++ MacRuby/branches/experimental/vm.h 2009-06-20 05:20:37 UTC (rev 1905)
@@ -429,6 +429,7 @@
ExecutionEngine *iee;
FunctionPassManager *fpm;
bool running;
+ std::map<Function *, IMP> JITcache;
std::map<IMP, rb_vm_method_node_t *> ruby_imps;
std::map<SEL, struct mcache *> mcache;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090619/415da2d6/attachment.html>
More information about the macruby-changes
mailing list