Includes catch instruction into interference analysis

This commit is contained in:
konsoletyper 2014-03-31 15:26:20 +04:00
parent f66233c6aa
commit 0deb7ac4e6
2 changed files with 15 additions and 0 deletions

View File

@ -50,6 +50,16 @@ class InterferenceGraphBuilder {
for (Incoming outgoing : outgoings.get(i)) {
live.add(nodes.get(outgoing.getValue().getIndex()));
}
for (TryCatchBlock tryCatch : block.getTryCatchBlocks()) {
if (tryCatch.getExceptionVariable() != null) {
nodes.get(tryCatch.getExceptionVariable().getIndex()).connectAll(live);
}
}
for (TryCatchBlock tryCatch : block.getTryCatchBlocks()) {
if (tryCatch.getExceptionVariable() != null) {
live.remove(tryCatch.getExceptionVariable());
}
}
for (int j = block.getInstructions().size() - 1; j >= 0; --j) {
Instruction insn = block.getInstructions().get(j);
insn.acceptVisitor(useExtractor);

View File

@ -66,6 +66,11 @@ public class LivenessAnalyzer {
definitions[var.getIndex()] = i;
}
}
for (TryCatchBlock tryCatch : block.getTryCatchBlocks()) {
if (tryCatch.getExceptionVariable() != null) {
definitions[tryCatch.getExceptionVariable().getIndex()] = i;
}
}
for (Phi phi : block.getPhis()) {
definitions[phi.getReceiver().getIndex()] = i;
for (Incoming incoming : phi.getIncomings()) {