Permalink
Browse files

backport r2759 from trunk

git-svn-id: http://svn.macosforge.org/repository/ruby/MacRuby/tags/0.5b1@2760 23306eb0-4c56-4727-a40e-e92c0eb68959
  • Loading branch information...
1 parent c74e4e8 commit f71b1b63825c835d0da026db69a772e28ced60bf @lrz lrz committed Oct 8, 2009
Showing with 8 additions and 5 deletions.
  1. +8 −5 dispatcher.cpp
View
@@ -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,17 +788,19 @@ __rb_vm_dispatch(RoxorVM *vm, struct mcache *cache, VALUE self, Class klass,
// 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,
arg->sel_of_type)) {
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;
}
}

0 comments on commit f71b1b6

Please sign in to comment.