ruby-changes:66353
From: Alan <ko1@a...>
Date: Sat, 29 May 2021 01:34:32 +0900 (JST)
Subject: [ruby-changes:66353] 788d30a8b3 (master): Make range literal peephole optimization target "newrange"
https://git.ruby-lang.org/ruby.git/commit/?id=788d30a8b3 From 788d30a8b388cd5500862a4015537203ef49ea85 Mon Sep 17 00:00:00 2001 From: Alan Wu <XrXr@u...> Date: Thu, 6 May 2021 18:54:52 -0400 Subject: Make range literal peephole optimization target "newrange" It looks for "checkmatch", when it could be applied to anything that has "newrange". Making the optimization target more ranges might only be fair play when all ranges are frozen. So I'm putting a reference to the ticket that froze all ranges. [Feature #15504] --- compile.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/compile.c b/compile.c index 44fb53c..e8d5d05 100644 --- a/compile.c +++ b/compile.c @@ -3027,13 +3027,12 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal https://github.com/ruby/ruby/blob/trunk/compile.c#L3027 * * putobject "beg".."end" */ - if (IS_INSN_ID(iobj, checkmatch)) { - INSN *range = (INSN *)get_prev_insn(iobj); + if (IS_INSN_ID(iobj, newrange)) { + INSN *const range = iobj; INSN *beg, *end; VALUE str_beg, str_end; - if (range && IS_INSN_ID(range, newrange) && - (end = (INSN *)get_prev_insn(range)) != 0 && + if ((end = (INSN *)get_prev_insn(range)) != 0 && is_frozen_putstring(end, &str_end) && (beg = (INSN *)get_prev_insn(end)) != 0 && is_frozen_putstring(beg, &str_beg)) { -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/