mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
compile.c: moved comments [ci skip]
* compile.c (iseq_peephole_optimize): moved comments inside proper blocks. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7971a1246b
commit
0faeb9039f
1 changed files with 24 additions and 24 deletions
48
compile.c
48
compile.c
|
@ -2158,16 +2158,6 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
|
||||||
again:
|
again:
|
||||||
if (IS_INSN_ID(iobj, jump)) {
|
if (IS_INSN_ID(iobj, jump)) {
|
||||||
INSN *niobj, *diobj, *piobj;
|
INSN *niobj, *diobj, *piobj;
|
||||||
/*
|
|
||||||
* useless jump elimination:
|
|
||||||
* jump LABEL1
|
|
||||||
* ...
|
|
||||||
* LABEL1:
|
|
||||||
* jump LABEL2
|
|
||||||
*
|
|
||||||
* => in this case, first jump instruction should jump to
|
|
||||||
* LABEL2 directly
|
|
||||||
*/
|
|
||||||
diobj = (INSN *)get_destination_insn(iobj);
|
diobj = (INSN *)get_destination_insn(iobj);
|
||||||
niobj = (INSN *)get_next_insn(iobj);
|
niobj = (INSN *)get_next_insn(iobj);
|
||||||
|
|
||||||
|
@ -2183,6 +2173,16 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
|
||||||
}
|
}
|
||||||
else if (iobj != diobj && IS_INSN_ID(diobj, jump) &&
|
else if (iobj != diobj && IS_INSN_ID(diobj, jump) &&
|
||||||
OPERAND_AT(iobj, 0) != OPERAND_AT(diobj, 0)) {
|
OPERAND_AT(iobj, 0) != OPERAND_AT(diobj, 0)) {
|
||||||
|
/*
|
||||||
|
* useless jump elimination:
|
||||||
|
* jump LABEL1
|
||||||
|
* ...
|
||||||
|
* LABEL1:
|
||||||
|
* jump LABEL2
|
||||||
|
*
|
||||||
|
* => in this case, first jump instruction should jump to
|
||||||
|
* LABEL2 directly
|
||||||
|
*/
|
||||||
replace_destination(iobj, diobj);
|
replace_destination(iobj, diobj);
|
||||||
remove_unreachable_chunk(iseq, iobj->link.next);
|
remove_unreachable_chunk(iseq, iobj->link.next);
|
||||||
goto again;
|
goto again;
|
||||||
|
@ -2208,24 +2208,24 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
|
||||||
INSERT_ELEM_NEXT(&iobj->link, &popiobj->link);
|
INSERT_ELEM_NEXT(&iobj->link, &popiobj->link);
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* useless jump elimination (if/unless destination):
|
|
||||||
* if L1
|
|
||||||
* jump L2
|
|
||||||
* L1:
|
|
||||||
* ...
|
|
||||||
* L2:
|
|
||||||
*
|
|
||||||
* ==>
|
|
||||||
* unless L2
|
|
||||||
* L1:
|
|
||||||
* ...
|
|
||||||
* L2:
|
|
||||||
*/
|
|
||||||
else if ((piobj = (INSN *)get_prev_insn(iobj)) != 0 &&
|
else if ((piobj = (INSN *)get_prev_insn(iobj)) != 0 &&
|
||||||
(IS_INSN_ID(piobj, branchif) ||
|
(IS_INSN_ID(piobj, branchif) ||
|
||||||
IS_INSN_ID(piobj, branchunless))) {
|
IS_INSN_ID(piobj, branchunless))) {
|
||||||
if (niobj == (INSN *)get_destination_insn(piobj)) {
|
if (niobj == (INSN *)get_destination_insn(piobj)) {
|
||||||
|
/*
|
||||||
|
* useless jump elimination (if/unless destination):
|
||||||
|
* if L1
|
||||||
|
* jump L2
|
||||||
|
* L1:
|
||||||
|
* ...
|
||||||
|
* L2:
|
||||||
|
*
|
||||||
|
* ==>
|
||||||
|
* unless L2
|
||||||
|
* L1:
|
||||||
|
* ...
|
||||||
|
* L2:
|
||||||
|
*/
|
||||||
piobj->insn_id = (IS_INSN_ID(piobj, branchif))
|
piobj->insn_id = (IS_INSN_ID(piobj, branchif))
|
||||||
? BIN(branchunless) : BIN(branchif);
|
? BIN(branchunless) : BIN(branchif);
|
||||||
replace_destination(piobj, iobj);
|
replace_destination(piobj, iobj);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue