summaryrefslogtreecommitdiff
path: root/variable.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 /variable.c
parent11d36a49c7209969043a37e1cf9a666bc9649d8d (diff)
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 'variable.c')
-rw-r--r--variable.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/variable.c b/variable.c
index 3364da5..006de23 100644
--- a/variable.c
+++ b/variable.c
@@ -1132,7 +1132,8 @@ rb_ivar_get(VALUE obj, ID id)
VALUE iv = rb_ivar_lookup(obj, id, Qundef);
if (iv == Qundef) {
- rb_warning("instance variable %"PRIsVALUE" not initialized", QUOTE_ID(id));
+ if (RTEST(ruby_verbose))
+ rb_warning("instance variable %"PRIsVALUE" not initialized", QUOTE_ID(id));
iv = Qnil;
}
return iv;