[macruby-changes] [1619] MacRuby/branches/experimental/vm.cpp

source_changes at macosforge.org source_changes at macosforge.org
Wed May 27 18:52:38 PDT 2009


Revision: 1619
          http://trac.macosforge.org/projects/ruby/changeset/1619
Author:   lsansonetti at apple.com
Date:     2009-05-27 18:52:37 -0700 (Wed, 27 May 2009)
Log Message:
-----------
do not cache dispatch of ruby methods with a first arg then an optional hash + small improvement when doing helper method dispatch

Modified Paths:
--------------
    MacRuby/branches/experimental/vm.cpp

Modified: MacRuby/branches/experimental/vm.cpp
===================================================================
--- MacRuby/branches/experimental/vm.cpp	2009-05-27 23:19:43 UTC (rev 1618)
+++ MacRuby/branches/experimental/vm.cpp	2009-05-28 01:52:37 UTC (rev 1619)
@@ -2161,6 +2161,7 @@
 #if ROXOR_VM_DEBUG
     const bool cached = cache->flag != 0;
 #endif
+    bool do_rcache = true;
 
     if (cache->flag == 0) {
 recache:
@@ -2173,6 +2174,7 @@
 	}
 
 	if (method != NULL) {
+recache2:
 	    IMP imp = method_getImplementation(method);
 	    rb_vm_method_node_t *node = GET_VM()->method_node_get(imp);
 
@@ -2221,7 +2223,8 @@
 			    ((VALUE *)argv)[1] = h; // bad, I know...
 			    sel = new_sel;
 			    method = m;
-			    goto recache;
+			    do_rcache = false;
+			    goto recache2;
 			}
 		    }
 		}
@@ -2236,7 +2239,7 @@
 		    if (rb_vm_get_method_node(imp) == NULL) {
 			sel = new_sel;
 			method = m;
-			goto recache;	
+			goto recache2;
 		    }
 		}
 	    }
@@ -2271,6 +2274,9 @@
 	if (rcache.klass != klass) {
 	    goto recache;
 	}
+	if (!do_rcache) {
+	    cache->flag = 0;
+	}
 
 #if ROXOR_VM_DEBUG
 	printf("ruby dispatch %c[<%s %p> %s] (imp=%p, block=%p, cached=%s)\n",
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090527/9ad0e473/attachment.html>


More information about the macruby-changes mailing list