ruby-changes:64352
From: Nobuyoshi <ko1@a...>
Date: Sun, 20 Dec 2020 03:11:45 +0900 (JST)
Subject: [ruby-changes:64352] b2acae3274 (master): Reduced ID caches
https://git.ruby-lang.org/ruby.git/commit/?id=b2acae3274 From b2acae32742adf86a64ba5c0af55830bb3bddc0d Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 20 Dec 2020 02:56:18 +0900 Subject: Reduced ID caches NEW_GASGN and NEW_GVAR evaluate `id` argument twice. diff --git a/parse.y b/parse.y index 6144fd1..477580f 100644 --- a/parse.y +++ b/parse.y @@ -11524,7 +11524,8 @@ range_op(struct parser_params *p, NODE *node, const YYLTYPE *loc) https://github.com/ruby/ruby/blob/trunk/parse.y#L11524 value_expr(node); if (type == NODE_LIT && FIXNUM_P(node->nd_lit)) { if (!e_option_supplied(p)) parser_warn(p, node, "integer literal in flip-flop"); - return NEW_CALL(node, tEQ, NEW_LIST(NEW_GVAR(rb_intern("$."), loc), loc), loc); + ID lineno = rb_intern("$."); + return NEW_CALL(node, tEQ, NEW_LIST(NEW_GVAR(lineno, loc), loc), loc); } return cond0(p, node, COND_IN_FF, loc); } @@ -12795,8 +12796,10 @@ parser_append_options(struct parser_params *p, NODE *node) https://github.com/ruby/ruby/blob/trunk/parse.y#L12796 if (p->do_loop) { if (p->do_split) { - NODE *args = NEW_LIST(NEW_GVAR(rb_intern("$;"), LOC), LOC); - NODE *split = NEW_GASGN(rb_intern("$F"), + ID ifs = rb_intern("$;"); + ID fields = rb_intern("$F"); + NODE *args = NEW_LIST(NEW_GVAR(ifs, LOC), LOC); + NODE *split = NEW_GASGN(fields, NEW_CALL(NEW_GVAR(idLASTLINE, LOC), rb_intern("split"), args, LOC), LOC); -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/