ruby-changes:63252
From: Koichi <ko1@a...>
Date: Fri, 2 Oct 2020 09:22:33 +0900 (JST)
Subject: [ruby-changes:63252] 8d76b729a1 (master): Put same frozen Range literal if possible
https://git.ruby-lang.org/ruby.git/commit/?id=8d76b729a1 From 8d76b729a180c47d8edf4392d84a02ec00aeb37b Mon Sep 17 00:00:00 2001 From: Koichi Sasada <ko1@a...> Date: Sat, 26 Sep 2020 00:53:07 +0900 Subject: Put same frozen Range literal if possible Range literal is now frozen so we can reuse same Range object if the begin and the last are Numeric (frozen), such as `(1..2)`. diff --git a/compile.c b/compile.c index 0d2d7fb..7053837 100644 --- a/compile.c +++ b/compile.c @@ -8644,8 +8644,8 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in https://github.com/ruby/ruby/blob/trunk/compile.c#L8644 VALUE flag = INT2FIX(excl); const NODE *b = node->nd_beg; const NODE *e = node->nd_end; - // TODO: Ractor can not use cached Range objects - if (0 && optimizable_range_item_p(b) && optimizable_range_item_p(e)) { + + if (optimizable_range_item_p(b) && optimizable_range_item_p(e)) { if (!popped) { VALUE bv = nd_type(b) == NODE_LIT ? b->nd_lit : Qnil; VALUE ev = nd_type(e) == NODE_LIT ? e->nd_lit : Qnil; -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/