summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-19 17:23:31 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-19 17:23:31 +0000
commit6e21b611aaa485259545c0ce696b000aaadee5ed (patch)
tree1c98379aa5709ce7f20ac84357ffba9438434e50 /vm_insnhelper.c
parent11d36a49c7209969043a37e1cf9a666bc9649d8d (diff)
downloadruby-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.c3
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;