1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* insns.def (opt_case_dispatch), vm_insnhelper.c:

execute the procedures of "when" clauses by bytecode
  instead of st_foreach() when the object does not hit
  prepared hash.  [ruby-dev:42304]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2010-09-27 14:47:30 +00:00
parent 93fba33b47
commit 86a8b820d6
3 changed files with 9 additions and 33 deletions

View file

@ -1,3 +1,10 @@
Mon Sep 27 23:30:34 2010 Koichi Sasada <ko1@atdot.net>
* insns.def (opt_case_dispatch), vm_insnhelper.c:
execute the procedures of "when" clauses by bytecode
instead of st_foreach() when the object does not hit
prepared hash. [ruby-dev:42304]
Mon Sep 27 15:54:03 2010 URABE Shyouhei <shyouhei@ruby-lang.org>
* test/net/http/test_https.rb: As always, localhost is not

View file

@ -1281,20 +1281,8 @@ opt_case_dispatch
}
break;
}
default: { /* fall through (else) */
struct opt_case_dispatch_i_arg arg;
arg.obj = key;
arg.label = -1;
st_foreach(RHASH_TBL(hash), opt_case_dispatch_i, (st_data_t)&arg);
if (arg.label != -1) {
JUMP(arg.label);
}
else {
JUMP(else_offset);
}
}
default:
break;
}
}

View file

@ -1699,22 +1699,3 @@ opt_eq_func(VALUE recv, VALUE obj, IC ic)
return Qundef;
}
struct opt_case_dispatch_i_arg {
VALUE obj;
int label;
};
static int
opt_case_dispatch_i(st_data_t key, st_data_t data, st_data_t p)
{
struct opt_case_dispatch_i_arg *arg = (void *)p;
if (RTEST(rb_funcall((VALUE)key, idEqq, 1, arg->obj))) {
arg->label = FIX2INT((VALUE)data);
return ST_STOP;
}
else {
return ST_CONTINUE;
}
}