ruby-changes:65472
From: Aaron <ko1@a...>
Date: Thu, 18 Mar 2021 02:55:54 +0900 (JST)
Subject: [ruby-changes:65472] c3971bea33 (master): Stop calling `rb_iseq_defined_string` in vm_defined
https://git.ruby-lang.org/ruby.git/commit/?id=c3971bea33 From c3971bea3351e014171910402a220770196ed1cc Mon Sep 17 00:00:00 2001 From: Aaron Patterson <tenderlove@r...> Date: Tue, 16 Mar 2021 15:16:51 -0700 Subject: Stop calling `rb_iseq_defined_string` in vm_defined We already have access to the string from the iseqs, so we can stop calling this function. --- insns.def | 2 +- vm_insnhelper.c | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/insns.def b/insns.def index 55564c4..ca56416 100644 --- a/insns.def +++ b/insns.def @@ -667,7 +667,7 @@ defined https://github.com/ruby/ruby/blob/trunk/insns.def#L667 (VALUE val) // attr bool leaf = leafness_of_defined(op_type); { - if (vm_defined(ec, GET_CFP(), op_type, obj, Qfalse, v)) { + if (vm_defined(ec, GET_CFP(), op_type, obj, v)) { val = needstr; } else { diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 5f8bffb..81ac2eb 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -3986,7 +3986,7 @@ check_respond_to_missing(VALUE obj, VALUE v) https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L3986 } static VALUE -vm_defined(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, rb_num_t op_type, VALUE obj, VALUE needstr, VALUE v) +vm_defined(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, rb_num_t op_type, VALUE obj, VALUE v) { VALUE klass; enum defined_type expr_type = DEFINED_NOT_DEFINED; @@ -4081,15 +4081,10 @@ vm_defined(rb_execution_context_t *ec, rb_control_frame_t *reg_cfp, rb_num_t op_ https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L4081 } if (expr_type != 0) { - if (needstr != Qfalse) { - return rb_iseq_defined_string(expr_type); - } - else { - return Qtrue; - } + return Qtrue; } else { - return Qnil; + return Qfalse; } } -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/