Additional diagnostic for internal state during jvm codegen

This commit is contained in:
Nikolay Krasko
2018-10-22 14:01:54 +03:00
parent 5fdb0df3fa
commit 8e1bff0e37
2 changed files with 10 additions and 1 deletions
@@ -4570,7 +4570,12 @@ The "returned" value of try expression with no finally is either the last expres
private void generateExceptionTable(@NotNull Label catchStart, @NotNull List<Label> catchedRegions, @Nullable String exception) {
for (int i = 0; i < catchedRegions.size(); i += 2) {
Label startRegion = catchedRegions.get(i);
Label endRegion = catchedRegions.get(i+1);
Label endRegion = catchedRegions.get(i + 1);
if (startRegion.info == null || endRegion.info == null || catchStart.info == null) {
throw new IllegalStateException("All labels should have nodes added to instruction list");
}
v.visitTryCatchBlock(startRegion, endRegion, catchStart, exception);
}
}
@@ -314,6 +314,10 @@ public class MaxStackFrameSizeAndLocalsCalculator extends MaxLocalsCalculator {
LabelWrapper e = handler.end;
while (l != e) {
if (l == null) {
throw new IllegalStateException("Bad exception handler end");
}
l.addSuccessor(handler.handlerLabel, 0, true);
l = l.nextLabel;
}