summaryrefslogtreecommitdiff
path: root/insns.def
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-12 05:55:06 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-08-12 05:55:06 +0000
commit8e8e34319ba6d9457b3ffa374738baa41a96be05 (patch)
tree62ac39f6330d9c77612cefa5931497c6d06e15a8 /insns.def
parent56e69d71092e8bf41b94036f51c3a07575194f74 (diff)
* insns.def, vm.c, vm_insnhelper.c, vm_insnhelper.h: check
definition of (classes)#=== for case/when optimization. Fix Bug #1376 [ruby-core:23190]. * string.c (Init_String), bignum.c (Init_Bignum), numeric.c (Init_Numeric): define String#===, Symbol#===, Bignum#===, Fixnum#===, Float#=== as same as (classes)#==. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'insns.def')
-rw-r--r--insns.def19
1 files changed, 15 insertions, 4 deletions
diff --git a/insns.def b/insns.def
index 98f0dcd14c..dfae799b30 100644
--- a/insns.def
+++ b/insns.def
@@ -1233,10 +1233,7 @@ opt_case_dispatch
(..., VALUE key)
() // inc += -1;
{
- if (0) {
- /* TODO: if some === method is overrided */
- }
- else {
+ if (BASIC_OP_UNREDEFINED_P(BOP_EQQ)) {
VALUE val;
if (st_lookup(RHASH_TBL(hash), key, &val)) {
JUMP(FIX2INT(val));
@@ -1245,6 +1242,20 @@ opt_case_dispatch
JUMP(else_offset);
}
}
+ else {
+ struct opt_case_dispatch_i_arg arg = {
+ key, -1
+ };
+
+ st_foreach(RHASH_TBL(hash), opt_case_dispatch_i, &arg);
+
+ if (arg.label != -1) {
+ JUMP(arg.label);
+ }
+ else {
+ JUMP(else_offset);
+ }
+ }
}
/**