From bdedc17f0cd55e1c277330458ace9e6e8ff00383 Mon Sep 17 00:00:00 2001
From: usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Sat, 25 Mar 2017 16:31:54 +0000
Subject: merge revision(s) 57278,57279: [Backport #12855]

	fix optimization for hash aset/aref with fstring

	Patch by Eric Wong [ruby-core:78797].
	I don't like the idea of making insns.def any bigger to support
	a corner case, and "test_hash_aref_fstring_identity" shows
	how contrived this is.

	[ruby-core:78783] [Bug #12855]
	adjust indent [ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@58099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
---
 insns.def | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

(limited to 'insns.def')

diff --git a/insns.def b/insns.def
index 834f3dd691..fb7e0f11f4 100644
--- a/insns.def
+++ b/insns.def
@@ -1950,7 +1950,9 @@ opt_aset_with
 (VALUE recv, VALUE val)
 (VALUE val)
 {
-    if (!SPECIAL_CONST_P(recv) && RBASIC_CLASS(recv) == rb_cHash && BASIC_OP_UNREDEFINED_P(BOP_ASET, HASH_REDEFINED_OP_FLAG)) {
+    if (!SPECIAL_CONST_P(recv) && RBASIC_CLASS(recv) == rb_cHash &&
+	BASIC_OP_UNREDEFINED_P(BOP_ASET, HASH_REDEFINED_OP_FLAG) &&
+	rb_hash_compare_by_id_p(recv) == Qfalse) {
 	rb_hash_aset(recv, key, val);
     }
     else {
@@ -1972,7 +1974,9 @@ opt_aref_with
 (VALUE recv)
 (VALUE val)
 {
-    if (!SPECIAL_CONST_P(recv) && RBASIC_CLASS(recv) == rb_cHash && BASIC_OP_UNREDEFINED_P(BOP_AREF, HASH_REDEFINED_OP_FLAG)) {
+    if (!SPECIAL_CONST_P(recv) && RBASIC_CLASS(recv) == rb_cHash &&
+	BASIC_OP_UNREDEFINED_P(BOP_AREF, HASH_REDEFINED_OP_FLAG) &&
+	rb_hash_compare_by_id_p(recv) == Qfalse) {
 	val = rb_hash_aref(recv, key);
     }
     else {
@@ -2121,8 +2125,7 @@ opt_succ
 	    BASIC_OP_UNREDEFINED_P(BOP_SUCC, STRING_REDEFINED_OP_FLAG)) {
 	    val = rb_str_succ(recv);
 	}
-	else
-	  {
+	else {
 	    goto INSN_LABEL(normal_dispatch);
 	}
     }
-- 
cgit v1.2.3

