aboutsummaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-10 02:35:22 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-10 02:35:22 +0000
commit7c41f09342cfdd0ec19997679bd088fef700bccf (patch)
treee3d0a73f34f6376c57a5170dfbbe0b2e429096e3 /compile.c
parent01c432169f53bfc83a001baac91a890dfbf5af35 (diff)
downloadruby-7c41f09342cfdd0ec19997679bd088fef700bccf.tar.gz
compile.c (iseq_compile_each): reduce needless rb_str_dup
There is no need to dup the fstring unless we want to set the debug ivar for it. [ruby-core:72018] <5668DB6E.8000101@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/compile.c b/compile.c
index a8935db0af..44e0d81aec 100644
--- a/compile.c
+++ b/compile.c
@@ -5339,16 +5339,16 @@ iseq_compile_each(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int poped)
ADD_INSN1(ret, line, putstring, node->nd_lit);
}
else {
- VALUE str = rb_str_dup(node->nd_lit);
if (ISEQ_COMPILE_DATA(iseq)->option->debug_frozen_string_literal || RTEST(ruby_debug)) {
VALUE debug_info = rb_ary_new_from_args(2, iseq->body->location.path, INT2FIX(line));
+ VALUE str = rb_str_dup(node->nd_lit);
rb_ivar_set(str, id_debug_created_info, rb_obj_freeze(debug_info));
ADD_INSN1(ret, line, putobject, rb_obj_freeze(str));
+ iseq_add_mark_object_compile_time(iseq, str);
}
else {
- ADD_INSN1(ret, line, putobject, rb_fstring(str));
+ ADD_INSN1(ret, line, putobject, node->nd_lit);
}
- iseq_add_mark_object_compile_time(iseq, str);
}
}
break;