From 8e8e34319ba6d9457b3ffa374738baa41a96be05 Mon Sep 17 00:00:00 2001
From: ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Wed, 12 Aug 2009 05:55:06 +0000
Subject: * 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
---
 insns.def | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

(limited to 'insns.def')

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);
+	}
+    }
 }
 
 /**
-- 
cgit v1.2.3

