mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
When splitting async program, don't process same blocks twice
The old assumption was: if a block has instructions, it was already processed. However, that might be not true in some cases. This led to duplication of exception handlers in some blocks which in turn broken decompiler. From now on processed blocks are stored in a set.
This commit is contained in:
parent
a445b1bef8
commit
0c8013dfcf
|
@ -19,6 +19,7 @@ import java.util.ArrayDeque;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
|
@ -67,11 +68,12 @@ public class AsyncProgramSplitter {
|
|||
initialStep.targetPart = initialPart;
|
||||
Queue<Step> queue = new ArrayDeque<>();
|
||||
queue.add(initialStep);
|
||||
Set<BasicBlock> visitedBlocks = new HashSet<>();
|
||||
|
||||
taskLoop: while (!queue.isEmpty()) {
|
||||
Step step = queue.remove();
|
||||
BasicBlock targetBlock = step.targetPart.program.basicBlockAt(step.source);
|
||||
if (targetBlock.instructionCount() > 0) {
|
||||
if (!visitedBlocks.add(targetBlock)) {
|
||||
continue;
|
||||
}
|
||||
BasicBlock sourceBlock = program.basicBlockAt(step.source);
|
||||
|
|
Loading…
Reference in New Issue
Block a user