compile.c: comments for r52517 [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
56e3b49304
commit
66688cde3b
@ -2001,11 +2001,19 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (iobj->insn_id == BIN(pop)) {
|
if (iobj->insn_id == BIN(pop)) {
|
||||||
|
/*
|
||||||
|
* putself / putnil / putobject obj / putstring "..."
|
||||||
|
* pop
|
||||||
|
* =>
|
||||||
|
* # do nothing
|
||||||
|
*/
|
||||||
LINK_ELEMENT *prev = iobj->link.prev;
|
LINK_ELEMENT *prev = iobj->link.prev;
|
||||||
if (prev->type == ISEQ_ELEMENT_INSN) {
|
if (prev->type == ISEQ_ELEMENT_INSN) {
|
||||||
enum ruby_vminsn_type previ = ((INSN *)prev)->insn_id;
|
enum ruby_vminsn_type previ = ((INSN *)prev)->insn_id;
|
||||||
if (previ == BIN(putobject) || previ == BIN(putnil) ||
|
if (previ == BIN(putobject) || previ == BIN(putnil) ||
|
||||||
previ == BIN(putself) || previ == BIN(putstring)) {
|
previ == BIN(putself) || previ == BIN(putstring)) {
|
||||||
|
/* just push operand or static value and pop soon, no
|
||||||
|
* side effects */
|
||||||
REMOVE_ELEM(prev);
|
REMOVE_ELEM(prev);
|
||||||
REMOVE_ELEM(&iobj->link);
|
REMOVE_ELEM(&iobj->link);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user