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

source_changes at macosforge.org source_changes at macosforge.org
Tue May 26 14:29:25 PDT 2009


Revision: 1602
          http://trac.macosforge.org/projects/ruby/changeset/1602
Author:   lsansonetti at apple.com
Date:     2009-05-26 14:29:23 -0700 (Tue, 26 May 2009)
Log Message:
-----------
fixed a lazy JIT bug when dealing with modules included in modules included in ...

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

Modified: MacRuby/branches/experimental/vm.cpp
===================================================================
--- MacRuby/branches/experimental/vm.cpp	2009-05-26 21:11:44 UTC (rev 1601)
+++ MacRuby/branches/experimental/vm.cpp	2009-05-26 21:29:23 UTC (rev 1602)
@@ -1431,6 +1431,7 @@
     Method *methods;
     unsigned int i, methods_count;
 
+    // Copy existing Objective-C methods.
     methods = class_copyMethodList(from_class, &methods_count);
     if (methods != NULL) {
 	for (i = 0; i < methods_count; i++) {
@@ -1444,18 +1445,20 @@
 	free(methods);
     }
 
+    // Copy methods that have not been JIT'ed yet.
     std::multimap<Class, SEL>::iterator iter =
 	GET_VM()->method_source_sels.find(from_class);
 
     if (iter != GET_VM()->method_source_sels.end()) {
 	std::multimap<Class, SEL>::iterator last =
 	    GET_VM()->method_source_sels.upper_bound(from_class);
+	std::vector<SEL> sels_to_add;
+
 	for (; iter != last; ++iter) {
 	    SEL sel = iter->second;
-	
+
 	    std::map<Class, rb_vm_method_source_t *> *dict =
 		GET_VM()->method_sources_for_sel(sel, false);
-
 	    if (dict == NULL) {
 		continue;
 	    }
@@ -1471,7 +1474,14 @@
 	    m->func = iter2->second->func;
 	    m->node = iter2->second->node;
 	    dict->insert(std::make_pair(to_class, m));
+	    sels_to_add.push_back(sel);
 	}
+
+	for (std::vector<SEL>::iterator i = sels_to_add.begin();
+	     i != sels_to_add.end();
+	     ++i) {
+	    GET_VM()->method_source_sels.insert(std::make_pair(to_class, *i));
+	}
     } 
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090526/336bb1a7/attachment.html>


More information about the macruby-changes mailing list