diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-19 17:23:31 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-10-19 17:23:31 +0000 |
commit | 6e21b611aaa485259545c0ce696b000aaadee5ed (patch) | |
tree | 1c98379aa5709ce7f20ac84357ffba9438434e50 /vm_insnhelper.c | |
parent | 11d36a49c7209969043a37e1cf9a666bc9649d8d (diff) | |
download | ruby-6e21b611aaa485259545c0ce696b000aaadee5ed.tar.gz |
variable.c, vm_insnhelper.c: improve performance
* variable.c (rb_ivar_get), vm_insnhelper.c (vm_getivar): improve
instance variable retrieval performance by checking ruby_verbose
before call of rb_warning and evaluation of its argument.
[ruby-core:65786] [Feature #10396]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r-- | vm_insnhelper.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 41c1d0678c..b81001b0ef 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -526,7 +526,8 @@ vm_getivar(VALUE obj, ID id, IC ic, rb_call_info_t *ci, int is_attr) } if (UNLIKELY(val == Qundef)) { - if (!is_attr) rb_warning("instance variable %s not initialized", rb_id2name(id)); + if (!is_attr && RTEST(ruby_verbose)) + rb_warning("instance variable %s not initialized", rb_id2name(id)); val = Qnil; } return val; |