mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* compile.c (compile_dstr_fragments): use `putobject' instead of
`putstring' for all of strings used by NODE_DSTR because ruby users can not grab this string. For example, the string object of "baz" in "foo#{bar}baz" is located by `putobject' (users can not touch "baz" object directly). This change reduces GC pressure. This improvement is suggested by Aaron Patterson. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8addee9649
commit
49371b5420
2 changed files with 19 additions and 4 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Wed Oct 17 08:32:46 2012 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* compile.c (compile_dstr_fragments): use `putobject' instead of
|
||||
`putstring' for all of strings used by NODE_DSTR because
|
||||
ruby users can not grab this string.
|
||||
For example, the string object of "baz" in "foo#{bar}baz"
|
||||
is located by `putobject' (users can not touch "baz" object
|
||||
directly). This change reduces GC pressure.
|
||||
This improvement is suggested by Aaron Patterson.
|
||||
|
||||
Wed Oct 17 08:02:57 2012 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* thread.c (rb_threadptr_interrupt_mask): fix to check interrupt
|
||||
|
|
13
compile.c
13
compile.c
|
@ -2215,10 +2215,8 @@ iseq_set_sequence_stackcaching(rb_iseq_t *iseq, LINK_ANCHOR *anchor)
|
|||
return COMPILE_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
compile_dstr_fragments(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int *cntp)
|
||||
compile_dstr_fragments(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE *node, int *cntp)
|
||||
{
|
||||
NODE *list = node->nd_next;
|
||||
VALUE lit = node->nd_lit;
|
||||
|
@ -2232,7 +2230,14 @@ compile_dstr_fragments(rb_iseq_t *iseq, LINK_ANCHOR *ret, NODE * node, int *cntp
|
|||
}
|
||||
|
||||
while (list) {
|
||||
COMPILE(ret, "each string", list->nd_head);
|
||||
node = list->nd_head;
|
||||
if (nd_type(node) == NODE_STR) {
|
||||
hide_obj(node->nd_lit);
|
||||
ADD_INSN1(ret, nd_line(node), putobject, node->nd_lit);
|
||||
}
|
||||
else {
|
||||
COMPILE(ret, "each string", node);
|
||||
}
|
||||
cnt++;
|
||||
list = list->nd_next;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue