Revision: 2760 http://trac.macosforge.org/projects/ruby/changeset/2760 Author: lsansonetti@apple.com Date: 2009-10-07 20:21:33 -0700 (Wed, 07 Oct 2009) Log Message: ----------- backport r2759 from trunk Revision Links: -------------- http://trac.macosforge.org/projects/ruby/changeset/2759 Modified Paths: -------------- MacRuby/tags/0.5b1/dispatcher.cpp Modified: MacRuby/tags/0.5b1/dispatcher.cpp =================================================================== --- MacRuby/tags/0.5b1/dispatcher.cpp 2009-10-08 03:18:57 UTC (rev 2759) +++ MacRuby/tags/0.5b1/dispatcher.cpp 2009-10-08 03:21:33 UTC (rev 2760) @@ -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; } }