Revision
4487
Author
martinlagardette@apple.com
Date
2010-09-01 14:48:49 -0700 (Wed, 01 Sep 2010)

Log Message

Re-cache Obj-C variadic calls when argc is different than cached

Modified Paths

Diff

Modified: MacRuby/trunk/dispatcher.cpp (4486 => 4487)


--- MacRuby/trunk/dispatcher.cpp	2010-09-01 05:11:53 UTC (rev 4486)
+++ MacRuby/trunk/dispatcher.cpp	2010-09-01 21:48:49 UTC (rev 4487)
@@ -501,6 +501,7 @@
     cache->sel = sel;
     cache->klass = klass;
     cache->as.ocall.imp = imp;
+    cache->as.ocall.argc = argc;
     cache->as.ocall.bs_method = GET_CORE()->find_bs_method(klass, sel);
 
     char types[200];
@@ -829,6 +830,9 @@
 	return v;
     }
     else if (cache->flag & MCACHE_OCALL) {
+	if (cache->as.ocall.argc != argc) {
+	    goto recache;
+	}
 	if (!cache_method) {
 	    cache->flag = 0;
 	}

Modified: MacRuby/trunk/vm.h (4486 => 4487)


--- MacRuby/trunk/vm.h	2010-09-01 05:11:53 UTC (rev 4486)
+++ MacRuby/trunk/vm.h	2010-09-01 21:48:49 UTC (rev 4487)
@@ -556,6 +556,7 @@
 	} rcall;
 	struct {
 	    IMP imp;
+	    int argc;
 	    bs_element_method_t *bs_method;	
 	    rb_vm_objc_stub_t *stub;
 	} ocall;