compile.c: stop the jump-jump optimization if the second has any event
Fixes [Bug #17868]
This commit is contained in:
parent
821e3c128f
commit
5026f9a5d5
@ -2926,7 +2926,8 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
|
|||||||
}
|
}
|
||||||
else if (iobj != diobj && IS_INSN(&diobj->link) &&
|
else if (iobj != diobj && IS_INSN(&diobj->link) &&
|
||||||
IS_INSN_ID(diobj, jump) &&
|
IS_INSN_ID(diobj, jump) &&
|
||||||
OPERAND_AT(iobj, 0) != OPERAND_AT(diobj, 0)) {
|
OPERAND_AT(iobj, 0) != OPERAND_AT(diobj, 0) &&
|
||||||
|
diobj->insn_info.events == 0) {
|
||||||
/*
|
/*
|
||||||
* useless jump elimination:
|
* useless jump elimination:
|
||||||
* jump LABEL1
|
* jump LABEL1
|
||||||
|
@ -2386,4 +2386,19 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
|||||||
EOS
|
EOS
|
||||||
assert_equal [:return, :unpack], event
|
assert_equal [:return, :unpack], event
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_while_in_while
|
||||||
|
lines = []
|
||||||
|
|
||||||
|
TracePoint.new(:line){|tp|
|
||||||
|
next unless target_thread?
|
||||||
|
lines << tp.lineno
|
||||||
|
}.enable{
|
||||||
|
n = 3
|
||||||
|
while n > 0
|
||||||
|
n -= 1 while n > 0
|
||||||
|
end
|
||||||
|
}
|
||||||
|
assert_equal [__LINE__ - 5, __LINE__ - 4, __LINE__ - 3], lines, 'Bug #17868'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user