[macruby-changes] [2759] MacRuby/trunk/dispatcher.cpp

source_changes at macosforge.org source_changes at macosforge.org
Wed Oct 7 20:18:58 PDT 2009


Revision: 2759
          http://trac.macosforge.org/projects/ruby/changeset/2759
Author:   lsansonetti at apple.com
Date:     2009-10-07 20:18:57 -0700 (Wed, 07 Oct 2009)
Log Message:
-----------
fixed a bug in the sel_of_type implementation

Modified Paths:
--------------
    MacRuby/trunk/dispatcher.cpp

Modified: MacRuby/trunk/dispatcher.cpp
===================================================================
--- MacRuby/trunk/dispatcher.cpp	2009-10-08 02:23:39 UTC (rev 2758)
+++ MacRuby/trunk/dispatcher.cpp	2009-10-08 03:18:57 UTC (rev 2759)
@@ -17,7 +17,8 @@
 #include <execinfo.h>
 #include <dlfcn.h>
 
-#define MAX_DISPATCH_ARGS 100
+#define ROXOR_VM_DEBUG		0
+#define MAX_DISPATCH_ARGS 	100
 
 static force_inline void
 __rb_vm_fix_args(const VALUE *argv, VALUE *new_argv,
@@ -787,7 +788,9 @@
 		    // Therefore, we apply here a naive heuristic by assuming
 		    // that either the receiver or one of the arguments of this
 		    // call is the future target.
-		    ID arg_selid = rb_to_id(argv[i]);
+		    const int arg_i = arg->index;
+		    assert(arg_i >= 0);
+		    ID arg_selid = rb_to_id(argv[arg_i]);
 		    SEL arg_sel = sel_registerName(rb_id2name(arg_selid));
 
 		    if (reinstall_method_maybe(*(Class *)ocrcv, arg_sel,
@@ -795,9 +798,9 @@
 			goto sel_target_found;
 		    }
 		    for (int j = 0; j < argc; j++) {
-			if (j != i && !SPECIAL_CONST_P(argv[j])) {
-			    if (reinstall_method_maybe(*(Class *)argv[j], arg_sel,
-					arg->sel_of_type)) {
+			if (j != arg_i && !SPECIAL_CONST_P(argv[j])) {
+			    if (reinstall_method_maybe(*(Class *)argv[j],
+					arg_sel, arg->sel_of_type)) {
 				goto sel_target_found;
 			    }
 			}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091007/5034576a/attachment-0001.html>


More information about the macruby-changes mailing list