summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-09-26 00:53:07 +0900
committerKoichi Sasada <ko1@atdot.net>2020-10-02 09:22:17 +0900
commit8d76b729a180c47d8edf4392d84a02ec00aeb37b (patch)
tree31802e44825bf22a49915ae58b15d5185bd9dcbd
parentc881678cd75432f47903a5d1d8b86a7a723cb023 (diff)
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)`.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3587
-rw-r--r--compile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/compile.c b/compile.c
index 0d2d7fbf73..7053837bb6 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
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;