mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-03 05:44:10 -08:00
Fix liveness analysis in split AST optimizer
This commit is contained in:
parent
02d8439920
commit
58563a3e2d
|
@ -125,7 +125,7 @@ public class Optimizer {
|
||||||
DefinitionExtractor defExtractor = new DefinitionExtractor();
|
DefinitionExtractor defExtractor = new DefinitionExtractor();
|
||||||
UsageExtractor useExtractor = new UsageExtractor();
|
UsageExtractor useExtractor = new UsageExtractor();
|
||||||
BasicBlock block = originalProgram.basicBlockAt(originalBlocks[i]);
|
BasicBlock block = originalProgram.basicBlockAt(originalBlocks[i]);
|
||||||
Instruction splitPoint = splitPoints[i];
|
Instruction splitPoint = splitPoints[i].getPrevious();
|
||||||
for (Instruction insn = block.getLastInstruction(); insn != splitPoint; insn = insn.getPrevious()) {
|
for (Instruction insn = block.getLastInstruction(); insn != splitPoint; insn = insn.getPrevious()) {
|
||||||
insn.acceptVisitor(defExtractor);
|
insn.acceptVisitor(defExtractor);
|
||||||
insn.acceptVisitor(useExtractor);
|
insn.acceptVisitor(useExtractor);
|
||||||
|
|
|
@ -36,9 +36,7 @@ public class ProgramNodeSplittingBackend implements GraphSplittingBackend {
|
||||||
int node = nodes[i];
|
int node = nodes[i];
|
||||||
BasicBlock block = program.basicBlockAt(node);
|
BasicBlock block = program.basicBlockAt(node);
|
||||||
BasicBlock blockCopy = program.createBasicBlock();
|
BasicBlock blockCopy = program.createBasicBlock();
|
||||||
blockCopy.addAll(ProgramUtils.copyInstructions(block.getFirstInstruction(), null, program));
|
ProgramUtils.copyBasicBlock(block, blockCopy);
|
||||||
blockCopy.getTryCatchBlocks().addAll(ProgramUtils.copyTryCatches(block, program));
|
|
||||||
blockCopy.setExceptionVariable(block.getExceptionVariable());
|
|
||||||
copies[i] = blockCopy.getIndex();
|
copies[i] = blockCopy.getIndex();
|
||||||
map.put(nodes[i], copies[i] + 1);
|
map.put(nodes[i], copies[i] + 1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user