From a04a5fc18b7436eeccd7520d73d16f25f9f41b87 Mon Sep 17 00:00:00 2001 From: usa Date: Wed, 17 Oct 2018 09:10:26 +0000 Subject: [PATCH] merge revision(s) 64745: [Backport #15118] 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/branches/ruby_2_4@65116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 2 ++ version.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/compile.c b/compile.c index 9e9e177231..797e983816 100644 --- a/compile.c +++ b/compile.c @@ -5177,6 +5177,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int poppe 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 = rb_fstring(node->nd_args->nd_head->nd_lit); node->nd_args->nd_head->nd_lit = str; @@ -6229,6 +6230,7 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int poppe 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 = rb_fstring(node->nd_args->nd_head->nd_lit); diff --git a/version.h b/version.h index bc6c7df75c..a4306172c5 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.4.5" #define RUBY_RELEASE_DATE "2018-10-17" -#define RUBY_PATCHLEVEL 330 +#define RUBY_PATCHLEVEL 331 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 10