ruby-changes:52534
From: nobu <ko1@a...>
Date: Sat, 15 Sep 2018 11:20:55 +0900 (JST)
Subject: [ruby-changes:52534] nobu:r64745 (trunk): Use opt_{aref, aset} over opt_{aref, aset}_with
nobu 2018-09-15 11:20:47 +0900 (Sat, 15 Sep 2018) New Revision: 64745 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64745 Log: 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 <chopraanmol1@g...> Modified files: trunk/compile.c Index: compile.c =================================================================== --- compile.c (revision 64744) +++ compile.c (revision 64745) @@ -6405,6 +6405,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK https://github.com/ruby/ruby/blob/trunk/compile.c#L6405 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 https://github.com/ruby/ruby/blob/trunk/compile.c#L7399 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); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/