From 9580586b63459318664e5309b8d19a626fff46f2 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 15 Sep 2018 02:20:47 +0000 Subject: Use opt_{aref,aset} over opt_{aref,aset}_with * compile.c (iseq_compile_each0): Use `opt_aref`/`opt_aset` over `opt_aref_with`/`opt_aset_with` when frozen_string_literal: true, not to resurrect the index string on non-Hash receiver. [Fix GH-1957] From: chopraanmol1 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'compile.c') diff --git a/compile.c b/compile.c index 9c2770d158..7d221d5dee 100644 --- a/compile.c +++ b/compile.c @@ -6405,6 +6405,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in nd_type(node->nd_args) == NODE_ARRAY && node->nd_args->nd_alen == 1 && nd_type(node->nd_args->nd_head) == NODE_STR && ISEQ_COMPILE_DATA(iseq)->current_block == NULL && + !ISEQ_COMPILE_DATA(iseq)->option->frozen_string_literal && ISEQ_COMPILE_DATA(iseq)->option->specialized_instruction) { VALUE str = freeze_literal(iseq, node->nd_args->nd_head->nd_lit); CHECK(COMPILE(ret, "recv", node->nd_recv)); @@ -7398,6 +7399,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in nd_type(node->nd_args) == NODE_ARRAY && node->nd_args->nd_alen == 2 && nd_type(node->nd_args->nd_head) == NODE_STR && ISEQ_COMPILE_DATA(iseq)->current_block == NULL && + !ISEQ_COMPILE_DATA(iseq)->option->frozen_string_literal && ISEQ_COMPILE_DATA(iseq)->option->specialized_instruction) { VALUE str = freeze_literal(iseq, node->nd_args->nd_head->nd_lit); -- cgit v1.2.3