Fix KT-8608: Compiler crashes with assertion Restore stack is unavailable

- fix SAVE_STACK_BEFORE_TRY insertion:
  TRYCATCHBLOCK LA, LB, LC
  LA
    NOP
    try_body
  LB
    ...
  LC
    handler_body
should be transformed into:
  LA
    {SAVE_STACK_BEFORE_TRY}
  LA' // new TCB start label
    NOP
    try_body
  LB
    ...
  LC
    handler_body
with all TCBs start labels remapped

- properly wrap exceptions from MandatoryMethodTransformer

 #KT-8608 Fixed
This commit is contained in:
Dmitry Petrov
2015-07-24 10:02:34 +03:00
parent a58f249a01
commit a64f1a86c0
7 changed files with 145 additions and 41 deletions
@@ -2322,6 +2322,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("deadTryCatch.kt")
public void testDeadTryCatch() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/deadTryCatch.kt");
doTest(fileName);
}
@TestMetadata("differentTypes.kt")
public void testDifferentTypes() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/differentTypes.kt");
@@ -2358,6 +2364,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("kt8608.kt")
public void testKt8608() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/kt8608.kt");
doTest(fileName);
}
@TestMetadata("multipleCatchBlocks.kt")
public void testMultipleCatchBlocks() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/multipleCatchBlocks.kt");