|
|
@ -206,16 +206,15 @@ public class FlowBlock { |
|
|
|
(loopBlock.jumpMayBeChanged() |
|
|
|
(loopBlock.jumpMayBeChanged() |
|
|
|
|| loopBlock.getNextFlowBlock() == successor)) { |
|
|
|
|| loopBlock.getNextFlowBlock() == successor)) { |
|
|
|
|
|
|
|
|
|
|
|
loopBlock.setCondition(instr.negate()); |
|
|
|
|
|
|
|
loopBlock.moveDefinitions(cb, null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cb.removeBlock(); |
|
|
|
|
|
|
|
if (loopBlock.jumpMayBeChanged()) { |
|
|
|
if (loopBlock.jumpMayBeChanged()) { |
|
|
|
loopBlock.moveJump(jump); |
|
|
|
loopBlock.moveJump(jump); |
|
|
|
jumps.push(jump); |
|
|
|
jumps.push(jump); |
|
|
|
continue; |
|
|
|
} else |
|
|
|
} |
|
|
|
|
|
|
|
jump.prev.removeJump(); |
|
|
|
jump.prev.removeJump(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
loopBlock.setCondition(instr.negate()); |
|
|
|
|
|
|
|
loopBlock.moveDefinitions(cb, null); |
|
|
|
|
|
|
|
cb.removeBlock(); |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -241,18 +240,16 @@ public class FlowBlock { |
|
|
|
(loopBlock.jumpMayBeChanged() |
|
|
|
(loopBlock.jumpMayBeChanged() |
|
|
|
|| loopBlock.getNextFlowBlock() == successor)) { |
|
|
|
|| loopBlock.getNextFlowBlock() == successor)) { |
|
|
|
|
|
|
|
|
|
|
|
loopBlock.setType(LoopBlock.DOWHILE); |
|
|
|
|
|
|
|
loopBlock.setCondition(instr.negate()); |
|
|
|
|
|
|
|
loopBlock.moveDefinitions(cb, null); |
|
|
|
|
|
|
|
cb.removeBlock(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (loopBlock.jumpMayBeChanged()) { |
|
|
|
if (loopBlock.jumpMayBeChanged()) { |
|
|
|
loopBlock.moveJump(jump); |
|
|
|
loopBlock.moveJump(jump); |
|
|
|
jumps.push(jump); |
|
|
|
jumps.push(jump); |
|
|
|
continue; |
|
|
|
} else |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jump.prev.removeJump(); |
|
|
|
jump.prev.removeJump(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
loopBlock.setType(LoopBlock.DOWHILE); |
|
|
|
|
|
|
|
loopBlock.setCondition(instr.negate()); |
|
|
|
|
|
|
|
loopBlock.moveDefinitions(cb, null); |
|
|
|
|
|
|
|
cb.removeBlock(); |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1066,7 +1063,10 @@ public class FlowBlock { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void removeJSR(FlowBlock subRoutine) { |
|
|
|
public void removeJSR(FlowBlock subRoutine) { |
|
|
|
Enumeration enum = ((Stack)successors.remove(subRoutine)).elements(); |
|
|
|
Stack jumps = (Stack)successors.remove(subRoutine); |
|
|
|
|
|
|
|
if (jumps == null) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
Enumeration enum = jumps.elements(); |
|
|
|
while (enum.hasMoreElements()) { |
|
|
|
while (enum.hasMoreElements()) { |
|
|
|
Jump jump = (Jump)enum.nextElement(); |
|
|
|
Jump jump = (Jump)enum.nextElement(); |
|
|
|
|
|
|
|
|
|
|
@ -1468,8 +1468,10 @@ public class FlowBlock { |
|
|
|
.jump.destination.predecessors.removeElement(catchFlow); |
|
|
|
.jump.destination.predecessors.removeElement(catchFlow); |
|
|
|
|
|
|
|
|
|
|
|
subRoutine.analyzeSubRoutine(addr+length, end); |
|
|
|
subRoutine.analyzeSubRoutine(addr+length, end); |
|
|
|
updateInOut(subRoutine, true, |
|
|
|
Stack jumps = (Stack)successors.get(subRoutine); |
|
|
|
(Stack)successors.get(subRoutine)); |
|
|
|
if (jumps != null) |
|
|
|
|
|
|
|
updateInOut(subRoutine, true, jumps); |
|
|
|
|
|
|
|
|
|
|
|
if (subRoutine.successors.size() != 0) |
|
|
|
if (subRoutine.successors.size() != 0) |
|
|
|
throw new AssertError("Jump inside subroutine"); |
|
|
|
throw new AssertError("Jump inside subroutine"); |
|
|
|
length += subRoutine.length; |
|
|
|
length += subRoutine.length; |
|
|
@ -1480,6 +1482,7 @@ public class FlowBlock { |
|
|
|
newBlock.setTryBlock(tryFlow.block); |
|
|
|
newBlock.setTryBlock(tryFlow.block); |
|
|
|
mergeSuccessors(tryFlow); |
|
|
|
mergeSuccessors(tryFlow); |
|
|
|
newBlock.setFinallyBlock(subRoutine.block); |
|
|
|
newBlock.setFinallyBlock(subRoutine.block); |
|
|
|
|
|
|
|
mergeSuccessors(subRoutine); |
|
|
|
newBlock.moveJump(rawBlock.jump); |
|
|
|
newBlock.moveJump(rawBlock.jump); |
|
|
|
lastModified = newBlock; |
|
|
|
lastModified = newBlock; |
|
|
|
changed = true; |
|
|
|
changed = true; |
|
|
@ -1625,8 +1628,8 @@ public class FlowBlock { |
|
|
|
updateInOut(nextFlow, true, lastJumps); |
|
|
|
updateInOut(nextFlow, true, lastJumps); |
|
|
|
lastJumps.pop(); |
|
|
|
lastJumps.pop(); |
|
|
|
|
|
|
|
|
|
|
|
lastFlow.optimizeJumps(jumps); |
|
|
|
lastFlow.optimizeJumps(lastJumps); |
|
|
|
lastFlow.resolveRemaining(jumps); |
|
|
|
lastFlow.resolveRemaining(lastJumps); |
|
|
|
} else |
|
|
|
} else |
|
|
|
updateInOut(nextFlow, true, jumps); |
|
|
|
updateInOut(nextFlow, true, jumps); |
|
|
|
|
|
|
|
|
|
|
|