ruby-changes:40457
From: nobu <ko1@a...>
Date: Wed, 11 Nov 2015 18:38:27 +0900 (JST)
Subject: [ruby-changes:40457] nobu:r52538 (trunk): compile.c: comments for r52517 [ci skip]
nobu 2015-11-11 18:38:20 +0900 (Wed, 11 Nov 2015) New Revision: 52538 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52538 Log: compile.c: comments for r52517 [ci skip] Modified files: trunk/compile.c Index: compile.c =================================================================== --- compile.c (revision 52537) +++ compile.c (revision 52538) @@ -2001,11 +2001,19 @@ iseq_peephole_optimize(rb_iseq_t *iseq, https://github.com/ruby/ruby/blob/trunk/compile.c#L2001 } 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); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/