summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-11 09:38:20 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-11 09:38:20 (GMT)
commit66688cde3b31f8244e8afda6b724c1f525a67dd6 (patch)
tree4d493f6d138a2e20edb18050448e7363036f8011
parent56e3b493043f5d1b25a52d073f25b8c0f825052f (diff)
compile.c: comments for r52517 [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--compile.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/compile.c b/compile.c
index bd41fef..3e34994 100644
--- a/compile.c
+++ b/compile.c
@@ -2001,11 +2001,19 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
}
if (iobj->insn_id == BIN(pop)) {
+ /*
+ * putself / putnil / putobject obj / putstring "..."
+ * pop
+ * =>
+ * # do nothing
+ */
LINK_ELEMENT *prev = iobj->link.prev;
if (prev->type == ISEQ_ELEMENT_INSN) {
enum ruby_vminsn_type previ = ((INSN *)prev)->insn_id;
if (previ == BIN(putobject) || previ == BIN(putnil) ||
previ == BIN(putself) || previ == BIN(putstring)) {
+ /* just push operand or static value and pop soon, no
+ * side effects */
REMOVE_ELEM(prev);
REMOVE_ELEM(&iobj->link);
}