From 3d7c22f242858b49b55e595d76153e79cb7143d4 Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Fri, 29 Aug 2014 19:51:54 +0400 Subject: [PATCH] Added exact label names for labels --- .../jet/lang/cfg/JetControlFlowProcessor.java | 20 +-- .../basic/IfWithUninitialized.instructions | 10 +- .../basic/UsageInFunctionLiteral.instructions | 4 +- ...eferenceToPropertyInitializer.instructions | 10 +- .../bugs/varInitializationInIf.instructions | 10 +- .../varInitializationInIfInCycle.instructions | 16 +-- .../lexicalScopes/forScope.instructions | 8 +- .../functionLiteralScope.instructions | 6 +- .../lexicalScopes/ifScope.instructions | 10 +- .../lexicalScopes/localClass.instructions | 6 +- .../localFunctionScope.instructions | 6 +- ...localFunctionScopeWithoutBody.instructions | 6 +- .../lexicalScopes/localObject.instructions | 6 +- .../objectLiteralScope.instructions | 6 +- .../propertyAccessorScope.instructions | 10 +- .../testData/cfg/basic/Basic.instructions | 18 +-- .../cfg/bugs/jumpToOuterScope.instructions | 28 ++-- .../controlStructures/Finally.instructions | 134 +++++++++--------- .../FinallyTestCopy.instructions | 38 ++--- .../cfg/controlStructures/For.instructions | 12 +- .../cfg/controlStructures/If.instructions | 46 +++--- .../returnsInWhen.instructions | 14 +- .../whenConditions.instructions | 60 ++++---- .../cfg/conventions/equals.instructions | 14 +- .../cfg/conventions/notEqual.instructions | 14 +- .../cfg/deadCode/returnInElvis.instructions | 4 +- .../unusedFunctionLiteral.instructions | 16 +-- .../local/LocalDeclarations.instructions | 24 ++-- .../local/localClass.instructions | 14 +- .../local/localProperty.instructions | 8 +- .../cfg/expressions/Assignments.instructions | 26 ++-- .../cfg/expressions/LazyBooleans.instructions | 74 +++++----- .../ReturnFromExpression.instructions | 8 +- .../parenthesizedSelector.instructions | 8 +- .../testData/cfg/tailCalls/sum.instructions | 12 +- 35 files changed, 353 insertions(+), 353 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java index 4232348d684..97b1be40fc4 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/cfg/JetControlFlowProcessor.java @@ -118,7 +118,7 @@ public class JetControlFlowProcessor { JetElement parent = PsiTreeUtil.getParentOfType(subroutine, JetElement.class); assert parent != null; - Label afterDeclaration = builder.createUnboundLabel(); + Label afterDeclaration = builder.createUnboundLabel("after local declaration"); builder.nondeterministicJump(afterDeclaration, parent, null); generate(subroutine); @@ -383,7 +383,7 @@ public class JetControlFlowProcessor { else if (operationType == ELVIS) { generateInstructions(left); mark(expression); - Label afterElvis = builder.createUnboundLabel(); + Label afterElvis = builder.createUnboundLabel("after elvis operator"); builder.jumpOnTrue(afterElvis, expression, builder.getBoundValue(left)); if (right != null) { generateInstructions(right); @@ -403,7 +403,7 @@ public class JetControlFlowProcessor { JetExpression left = expression.getLeft(); JetExpression right = expression.getRight(); - Label resultLabel = builder.createUnboundLabel(); + Label resultLabel = builder.createUnboundLabel("result of boolean operation"); generateInstructions(left); if (operationType == ANDAND) { builder.jumpOnFalse(resultLabel, expression, builder.getBoundValue(left)); @@ -640,7 +640,7 @@ public class JetControlFlowProcessor { if (condition != null) { generateInstructions(condition); } - Label elseLabel = builder.createUnboundLabel(); + Label elseLabel = builder.createUnboundLabel("else branch"); builder.jumpOnFalse(elseLabel, expression, builder.getBoundValue(condition)); JetExpression thenBranch = expression.getThen(); if (thenBranch != null) { @@ -650,7 +650,7 @@ public class JetControlFlowProcessor { else { builder.loadUnit(expression); } - Label resultLabel = builder.createUnboundLabel(); + Label resultLabel = builder.createUnboundLabel("'if' expression result"); builder.jump(resultLabel, expression); builder.bindLabel(elseLabel); JetExpression elseBranch = expression.getElse(); @@ -864,8 +864,8 @@ public class JetControlFlowProcessor { declareLoopParameter(expression); // TODO : primitive cases - Label loopExitPoint = builder.createUnboundLabel(); - Label conditionEntryPoint = builder.createUnboundLabel(); + Label loopExitPoint = builder.createUnboundLabel("'for' loop exit point"); + Label conditionEntryPoint = builder.createUnboundLabel("'for' loop condition entry point"); builder.bindLabel(conditionEntryPoint); builder.nondeterministicJump(loopExitPoint, expression, null); @@ -1296,7 +1296,7 @@ public class JetControlFlowProcessor { List branches = new ArrayList(); - Label doneLabel = builder.createUnboundLabel(); + Label doneLabel = builder.createUnboundLabel("after 'when' expression"); Label nextLabel = null; for (Iterator iterator = expression.getEntries().iterator(); iterator.hasNext(); ) { @@ -1309,7 +1309,7 @@ public class JetControlFlowProcessor { trace.report(ELSE_MISPLACED_IN_WHEN.on(whenEntry)); } } - Label bodyLabel = builder.createUnboundLabel(); + Label bodyLabel = builder.createUnboundLabel("'when' entry body"); JetWhenCondition[] conditions = whenEntry.getConditions(); for (int i = 0; i < conditions.length; i++) { @@ -1321,7 +1321,7 @@ public class JetControlFlowProcessor { } if (!isElse) { - nextLabel = builder.createUnboundLabel(); + nextLabel = builder.createUnboundLabel("next 'when' entry"); JetWhenCondition lastCondition = KotlinPackage.lastOrNull(conditions); builder.nondeterministicJump(nextLabel, expression, builder.getBoundValue(lastCondition)); } diff --git a/compiler/testData/cfg-variables/basic/IfWithUninitialized.instructions b/compiler/testData/cfg-variables/basic/IfWithUninitialized.instructions index 960c0705739..0a97ac8e605 100644 --- a/compiler/testData/cfg-variables/basic/IfWithUninitialized.instructions +++ b/compiler/testData/cfg-variables/basic/IfWithUninitialized.instructions @@ -18,17 +18,17 @@ L0: r(2) -> mark(1 < 2) call(1 < 2, compareTo|, ) -> - jf(L2|) + jf(L2 [else branch]|) 3 mark({ use(b) }) USE: in: {b=READ} out: {b=READ} r(b) -> USE: in: {} out: {b=READ} mark(use(b)) call(use(b), use|) -> - 2 jmp(L3) USE: in: {} out: {} -L2: + 2 jmp(L3 ['if' expression result]) USE: in: {} out: {} +L2 [else branch]: 3 mark({ b = true }) r(true) -> USE: in: {b=ONLY_WRITTEN_NEVER_READ} out: {b=ONLY_WRITTEN_NEVER_READ} w(b|) INIT: in: {b=D} out: {b=ID} USE: in: {} out: {b=ONLY_WRITTEN_NEVER_READ} -L3: +L3 ['if' expression result]: 2 merge(if (1 < 2) { use(b) } else { b = true }|, !) -> INIT: in: {b=D} out: {b=D} L1: 1 INIT: in: {} out: {} @@ -53,4 +53,4 @@ error: INIT: in: {} out: {} sink: INIT: in: {a=ID} out: {a=ID} USE: in: {} out: {} -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg-variables/basic/UsageInFunctionLiteral.instructions b/compiler/testData/cfg-variables/basic/UsageInFunctionLiteral.instructions index 832a5d179f0..592a7c93e87 100644 --- a/compiler/testData/cfg-variables/basic/UsageInFunctionLiteral.instructions +++ b/compiler/testData/cfg-variables/basic/UsageInFunctionLiteral.instructions @@ -15,9 +15,9 @@ L0: w(a|) INIT: in: {a=D} out: {a=ID} v(val f = { (x: Int) -> val y = x + a use(a) }) INIT: in: {a=ID} out: {a=ID, f=D} mark({ (x: Int) -> val y = x + a use(a) }) INIT: in: {a=ID, f=D} out: {a=ID, f=D} - jmp?(L2) + jmp?(L2 [after local declaration]) d({ (x: Int) -> val y = x + a use(a) }) USE: in: {a=READ} out: {a=READ} -L2: +L2 [after local declaration]: r({ (x: Int) -> val y = x + a use(a) }) -> w(f|) INIT: in: {a=ID, f=D} out: {a=ID, f=ID} L1: diff --git a/compiler/testData/cfg-variables/bugs/referenceToPropertyInitializer.instructions b/compiler/testData/cfg-variables/bugs/referenceToPropertyInitializer.instructions index d9e601d617a..c10ec23117f 100644 --- a/compiler/testData/cfg-variables/bugs/referenceToPropertyInitializer.instructions +++ b/compiler/testData/cfg-variables/bugs/referenceToPropertyInitializer.instructions @@ -9,9 +9,9 @@ L0: 1 INIT: in: {} out: {} v(val sum: (Int)->Int = { (x: Int) -> sum(x - 1) + x }) INIT: in: {} out: {sum=D} mark({ (x: Int) -> sum(x - 1) + x }) INIT: in: {sum=D} out: {sum=D} - jmp?(L2) + jmp?(L2 [after local declaration]) d({ (x: Int) -> sum(x - 1) + x }) USE: in: {sum=READ} out: {sum=READ} -L2: +L2 [after local declaration]: r({ (x: Int) -> sum(x - 1) + x }) -> w(sum|) INIT: in: {sum=D} out: {sum=ID} L1: @@ -91,9 +91,9 @@ L0: magic[IMPLICIT_RECEIVER](obj) -> INIT: in: {obj=D, x=D} out: {obj=D, x=D} r(obj|) -> w(x|) INIT: in: {obj=D, x=D} out: {obj=D, x=ID} - 1 jmp?(L2) INIT: in: {obj=D} out: {obj=D} + 1 jmp?(L2 [after local declaration]) INIT: in: {obj=D} out: {obj=D} d(fun foo() { val y = obj }) USE: in: {obj=READ} out: {obj=READ} -L2: +L2 [after local declaration]: r(object: A(obj) { { val x = obj } fun foo() { val y = obj } }) -> w(obj|) INIT: in: {obj=D} out: {obj=ID} L1: @@ -142,4 +142,4 @@ error: INIT: in: {} out: {} sink: INIT: in: {x=ID} out: {x=ID} USE: in: {} out: {} -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg-variables/bugs/varInitializationInIf.instructions b/compiler/testData/cfg-variables/bugs/varInitializationInIf.instructions index 485f53b0b25..c3a21f6a552 100644 --- a/compiler/testData/cfg-variables/bugs/varInitializationInIf.instructions +++ b/compiler/testData/cfg-variables/bugs/varInitializationInIf.instructions @@ -19,16 +19,16 @@ L0: r(2) -> mark(1 < 2) call(1 < 2, compareTo|, ) -> - jf(L2|) + jf(L2 [else branch]|) 3 mark({ b = false }) r(false) -> USE: in: {b=WRITTEN_AFTER_READ} out: {b=WRITTEN_AFTER_READ} w(b|) INIT: in: {b=D} out: {b=ID} USE: in: {b=READ} out: {b=WRITTEN_AFTER_READ} - 2 jmp(L3) INIT: in: {b=ID} out: {b=ID} USE: in: {b=READ} out: {b=READ} -L2: + 2 jmp(L3 ['if' expression result]) INIT: in: {b=ID} out: {b=ID} USE: in: {b=READ} out: {b=READ} +L2 [else branch]: 3 mark({ b = true }) INIT: in: {b=D} out: {b=D} r(true) -> USE: in: {b=WRITTEN_AFTER_READ} out: {b=WRITTEN_AFTER_READ} w(b|) INIT: in: {b=D} out: {b=ID} USE: in: {b=READ} out: {b=WRITTEN_AFTER_READ} -L3: +L3 ['if' expression result]: 2 merge(if (1 < 2) { b = false } else { b = true }|!, !) -> INIT: in: {b=ID} out: {b=ID} error(use(b), No resolved call) USE: in: {b=READ} out: {b=READ} r(b) -> USE: in: {} out: {b=READ} @@ -41,4 +41,4 @@ error: sink: USE: in: {} out: {} -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg-variables/bugs/varInitializationInIfInCycle.instructions b/compiler/testData/cfg-variables/bugs/varInitializationInIfInCycle.instructions index 26c0aac16aa..d4f81840858 100644 --- a/compiler/testData/cfg-variables/bugs/varInitializationInIfInCycle.instructions +++ b/compiler/testData/cfg-variables/bugs/varInitializationInIfInCycle.instructions @@ -21,8 +21,8 @@ L0: 2 mark({ for (i in numbers) { val b: Boolean if (1 < 2) { b = false } else { b = true } use(b) continue } }) INIT: in: {numbers=ID} out: {numbers=ID} USE: in: {numbers=READ} out: {numbers=READ} 3 r(numbers) -> USE: in: {} out: {numbers=READ} v(i) INIT: in: {numbers=ID} out: {i=D, numbers=ID} -L3: - jmp?(L2) INIT: in: {i=D, numbers=ID} out: {i=D, numbers=ID} +L3 ['for' loop condition entry point]: + jmp?(L2 ['for' loop exit point]) INIT: in: {i=D, numbers=ID} out: {i=D, numbers=ID} L4 [loop entry point]: L5 [body entry point]: magic[LOOP_RANGE_ITERATION](numbers|) -> @@ -35,23 +35,23 @@ L5 [body entry point]: r(2) -> mark(1 < 2) call(1 < 2, compareTo|, ) -> - jf(L6|) + jf(L6 [else branch]|) 5 mark({ b = false }) r(false) -> USE: in: {b=WRITTEN_AFTER_READ} out: {b=WRITTEN_AFTER_READ} w(b|) INIT: in: {b=D, i=ID, numbers=ID} out: {b=ID, i=ID, numbers=ID} USE: in: {b=READ} out: {b=WRITTEN_AFTER_READ} - 4 jmp(L7) INIT: in: {b=ID, i=ID, numbers=ID} out: {b=ID, i=ID, numbers=ID} USE: in: {b=READ} out: {b=READ} -L6: + 4 jmp(L7 ['if' expression result]) INIT: in: {b=ID, i=ID, numbers=ID} out: {b=ID, i=ID, numbers=ID} USE: in: {b=READ} out: {b=READ} +L6 [else branch]: 5 mark({ b = true }) INIT: in: {b=D, i=ID, numbers=ID} out: {b=D, i=ID, numbers=ID} r(true) -> USE: in: {b=WRITTEN_AFTER_READ} out: {b=WRITTEN_AFTER_READ} w(b|) INIT: in: {b=D, i=ID, numbers=ID} out: {b=ID, i=ID, numbers=ID} USE: in: {b=READ} out: {b=WRITTEN_AFTER_READ} -L7: +L7 ['if' expression result]: 4 merge(if (1 < 2) { b = false } else { b = true }|!, !) -> INIT: in: {b=ID, i=ID, numbers=ID} out: {b=ID, i=ID, numbers=ID} USE: in: {b=READ} out: {b=READ} r(b) -> USE: in: {} out: {b=READ} mark(use(b)) call(use(b), use|) -> jmp(L4 [loop entry point]) USE: in: {} out: {} - 3 jmp?(L4 [loop entry point]) -L2: +L2 ['for' loop exit point]: read (Unit) INIT: in: {i=D, numbers=ID} out: {i=D, numbers=ID} L1: 1 INIT: in: {numbers=ID} out: {numbers=ID} @@ -76,4 +76,4 @@ error: INIT: in: {} out: {} sink: INIT: in: {a=ID} out: {a=ID} USE: in: {} out: {} -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg-variables/lexicalScopes/forScope.instructions b/compiler/testData/cfg-variables/lexicalScopes/forScope.instructions index a3f48f46987..7bdebb3bb11 100644 --- a/compiler/testData/cfg-variables/lexicalScopes/forScope.instructions +++ b/compiler/testData/cfg-variables/lexicalScopes/forScope.instructions @@ -17,8 +17,8 @@ L0: mark(1..10) call(1..10, rangeTo|, ) -> v(i) INIT: in: {} out: {i=D} -L3: - jmp?(L2) INIT: in: {i=D} out: {i=D} +L3 ['for' loop condition entry point]: + jmp?(L2 ['for' loop exit point]) INIT: in: {i=D} out: {i=D} L4 [loop entry point]: L5 [body entry point]: magic[LOOP_RANGE_ITERATION](1..10|) -> @@ -29,7 +29,7 @@ L5 [body entry point]: r(i) -> INIT: in: {a=D, i=ID} out: {a=D, i=ID} w(a|) INIT: in: {a=D, i=ID} out: {a=ID, i=ID} 3 jmp?(L4 [loop entry point]) INIT: in: {i=ID} out: {i=ID} USE: in: {i=READ} out: {i=READ} -L2: +L2 ['for' loop exit point]: read (Unit) INIT: in: {i=D} out: {i=D} 2 mark("after") INIT: in: {} out: {} r("after") -> @@ -39,4 +39,4 @@ error: sink: USE: in: {} out: {} -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg-variables/lexicalScopes/functionLiteralScope.instructions b/compiler/testData/cfg-variables/lexicalScopes/functionLiteralScope.instructions index 3b41689f3d6..6ced0cf95be 100644 --- a/compiler/testData/cfg-variables/lexicalScopes/functionLiteralScope.instructions +++ b/compiler/testData/cfg-variables/lexicalScopes/functionLiteralScope.instructions @@ -18,9 +18,9 @@ L0: w(b|) INIT: in: {b=D} out: {b=ID} v(val f = { (x: Int) -> val a = x + b }) INIT: in: {b=ID} out: {b=ID, f=D} mark({ (x: Int) -> val a = x + b }) INIT: in: {b=ID, f=D} out: {b=ID, f=D} - jmp?(L2) + jmp?(L2 [after local declaration]) d({ (x: Int) -> val a = x + b }) USE: in: {b=READ} out: {b=READ} -L2: +L2 [after local declaration]: r({ (x: Int) -> val a = x + b }) -> w(f|) INIT: in: {b=ID, f=D} out: {b=ID, f=ID} mark("after") INIT: in: {b=ID, f=ID} out: {b=ID, f=ID} @@ -55,4 +55,4 @@ error: INIT: in: {} out: {} sink: INIT: in: {x=ID} out: {x=ID} USE: in: {} out: {} -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg-variables/lexicalScopes/ifScope.instructions b/compiler/testData/cfg-variables/lexicalScopes/ifScope.instructions index 5a83b19d785..6b7aa8e7871 100644 --- a/compiler/testData/cfg-variables/lexicalScopes/ifScope.instructions +++ b/compiler/testData/cfg-variables/lexicalScopes/ifScope.instructions @@ -17,18 +17,18 @@ L0: r("before") -> mark(if (true) { val a = 1 } else { val b = 2 }) r(true) -> - jf(L2|) + jf(L2 [else branch]|) 3 mark({ val a = 1 }) v(val a = 1) INIT: in: {} out: {a=D} r(1) -> INIT: in: {a=D} out: {a=D} w(a|) INIT: in: {a=D} out: {a=ID} - 2 jmp(L3) INIT: in: {} out: {} -L2: + 2 jmp(L3 ['if' expression result]) INIT: in: {} out: {} +L2 [else branch]: 3 mark({ val b = 2 }) v(val b = 2) INIT: in: {} out: {b=D} r(2) -> INIT: in: {b=D} out: {b=D} w(b|) INIT: in: {b=D} out: {b=ID} -L3: +L3 ['if' expression result]: 2 merge(if (true) { val a = 1 } else { val b = 2 }|!, !) -> INIT: in: {} out: {} mark("after") r("after") -> @@ -38,4 +38,4 @@ error: sink: USE: in: {} out: {} -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg-variables/lexicalScopes/localClass.instructions b/compiler/testData/cfg-variables/lexicalScopes/localClass.instructions index bc642bac5a7..feeacd53864 100644 --- a/compiler/testData/cfg-variables/lexicalScopes/localClass.instructions +++ b/compiler/testData/cfg-variables/lexicalScopes/localClass.instructions @@ -25,9 +25,9 @@ L0: magic[IMPLICIT_RECEIVER](x) -> INIT: in: {a=D, x=ID} out: {a=D, x=ID} r(x|) -> w(a|) INIT: in: {a=D, x=ID} out: {a=ID, x=ID} - 2 jmp?(L2) INIT: in: {x=ID} out: {x=ID} + 2 jmp?(L2 [after local declaration]) INIT: in: {x=ID} out: {x=ID} d(fun foo() { val b = x }) USE: in: {x=READ} out: {x=READ} -L2: +L2 [after local declaration]: mark("after") r("after") -> L1: @@ -55,4 +55,4 @@ error: sink: USE: in: {} out: {} -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg-variables/lexicalScopes/localFunctionScope.instructions b/compiler/testData/cfg-variables/lexicalScopes/localFunctionScope.instructions index 8f6d2b3023b..96313534b7e 100644 --- a/compiler/testData/cfg-variables/lexicalScopes/localFunctionScope.instructions +++ b/compiler/testData/cfg-variables/lexicalScopes/localFunctionScope.instructions @@ -16,9 +16,9 @@ L0: v(val b = 1) INIT: in: {} out: {b=D} r(1) -> INIT: in: {b=D} out: {b=D} w(b|) INIT: in: {b=D} out: {b=ID} - jmp?(L2) INIT: in: {b=ID} out: {b=ID} + jmp?(L2 [after local declaration]) INIT: in: {b=ID} out: {b=ID} d(fun local(x: Int) { val a = x + b }) USE: in: {b=READ} out: {b=READ} -L2: +L2 [after local declaration]: mark("after") r("after") -> L1: @@ -51,4 +51,4 @@ error: INIT: in: {} out: {} sink: INIT: in: {x=ID} out: {x=ID} USE: in: {} out: {} -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg-variables/lexicalScopes/localFunctionScopeWithoutBody.instructions b/compiler/testData/cfg-variables/lexicalScopes/localFunctionScopeWithoutBody.instructions index 76d780b9e32..3c738f6b0bc 100644 --- a/compiler/testData/cfg-variables/lexicalScopes/localFunctionScopeWithoutBody.instructions +++ b/compiler/testData/cfg-variables/lexicalScopes/localFunctionScopeWithoutBody.instructions @@ -14,9 +14,9 @@ L0: v(val b = 1) INIT: in: {} out: {b=D} r(1) -> INIT: in: {b=D} out: {b=D} w(b|) INIT: in: {b=D} out: {b=ID} - jmp?(L2) INIT: in: {b=ID} out: {b=ID} + jmp?(L2 [after local declaration]) INIT: in: {b=ID} out: {b=ID} d(fun local(x: Int) = x + b) USE: in: {b=READ} out: {b=READ} -L2: +L2 [after local declaration]: mark("after") r("after") -> L1: @@ -45,4 +45,4 @@ error: INIT: in: {} out: {} sink: INIT: in: {x=ID} out: {x=ID} USE: in: {} out: {} -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg-variables/lexicalScopes/localObject.instructions b/compiler/testData/cfg-variables/lexicalScopes/localObject.instructions index b3aaf4c1bf7..b44fbaa1c29 100644 --- a/compiler/testData/cfg-variables/lexicalScopes/localObject.instructions +++ b/compiler/testData/cfg-variables/lexicalScopes/localObject.instructions @@ -21,9 +21,9 @@ L0: v(val a = 1) INIT: in: {} out: {a=D} r(1) -> INIT: in: {a=D} out: {a=D} w(a|) INIT: in: {a=D} out: {a=ID} - 2 jmp?(L2) INIT: in: {} out: {} + 2 jmp?(L2 [after local declaration]) INIT: in: {} out: {} d(fun foo() { val b = 2 }) -L2: +L2 [after local declaration]: mark("after") r("after") -> L1: @@ -50,4 +50,4 @@ error: sink: USE: in: {} out: {} -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg-variables/lexicalScopes/objectLiteralScope.instructions b/compiler/testData/cfg-variables/lexicalScopes/objectLiteralScope.instructions index 867fa25f70b..150ed53d2aa 100644 --- a/compiler/testData/cfg-variables/lexicalScopes/objectLiteralScope.instructions +++ b/compiler/testData/cfg-variables/lexicalScopes/objectLiteralScope.instructions @@ -23,9 +23,9 @@ L0: v(val x = 1) INIT: in: {bar=D} out: {bar=D, x=D} r(1) -> INIT: in: {bar=D, x=D} out: {bar=D, x=D} w(x|) INIT: in: {bar=D, x=D} out: {bar=D, x=ID} - 2 jmp?(L2) INIT: in: {bar=D} out: {bar=D} + 2 jmp?(L2 [after local declaration]) INIT: in: {bar=D} out: {bar=D} d(fun foo() { val a = 2 }) -L2: +L2 [after local declaration]: r(object { { val x = 1 } fun foo() { val a = 2 } }) -> w(bar|) INIT: in: {bar=D} out: {bar=ID} mark("after") INIT: in: {bar=ID} out: {bar=ID} @@ -54,4 +54,4 @@ error: sink: USE: in: {} out: {} -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.instructions b/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.instructions index 5ad28a27fcd..5925262cce0 100644 --- a/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.instructions +++ b/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.instructions @@ -15,13 +15,13 @@ L0: 1 INIT: in: {} out: {} USE: in: {} out: {} 2 mark({ class A { var a : Int get() { return $a } set(v: Int) { $a = v } } }) v(var a : Int get() { return $a } set(v: Int) { $a = v }) INIT: in: {} out: {a=D} - jmp?(L2) INIT: in: {a=D} out: {a=D} + jmp?(L2 [after local declaration]) INIT: in: {a=D} out: {a=D} d(get() { return $a }) USE: in: {a=READ} out: {a=READ} -L2: - jmp?(L5) +L2 [after local declaration]: + jmp?(L5 [after local declaration]) d(set(v: Int) { $a = v }) USE: in: {a=ONLY_WRITTEN_NEVER_READ} out: {a=ONLY_WRITTEN_NEVER_READ} L1: -L5: +L5 [after local declaration]: 1 INIT: in: {} out: {} error: @@ -66,4 +66,4 @@ error: INIT: in: {} out: {} sink: INIT: in: {a=I, v=ID} out: {a=I, v=ID} USE: in: {} out: {} -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg/basic/Basic.instructions b/compiler/testData/cfg/basic/Basic.instructions index dc16cd31545..62a0ca99cfe 100644 --- a/compiler/testData/cfg/basic/Basic.instructions +++ b/compiler/testData/cfg/basic/Basic.instructions @@ -36,10 +36,10 @@ L0: mark(genfun()) call(genfun(), genfun) -> mark({1}) - jmp?(L2) NEXT:[r({1}) -> , d({1})] + jmp?(L2 [after local declaration]) NEXT:[r({1}) -> , d({1})] d({1}) NEXT:[] -L2: - r({1}) -> PREV:[jmp?(L2)] +L2 [after local declaration]: + r({1}) -> PREV:[jmp?(L2 [after local declaration])] mark(flfun {1}) call(flfun {1}, flfun|) -> mark(3.equals(4)) @@ -56,15 +56,15 @@ L2: mark(1 + 2) call(1 + 2, plus|, ) -> r(a) -> - jf(L5|) NEXT:[magic[AND](a && true|, ) -> , r(true) -> ] + jf(L5 [result of boolean operation]|) NEXT:[magic[AND](a && true|, ) -> , r(true) -> ] r(true) -> -L5: - magic[AND](a && true|, ) -> PREV:[jf(L5|), r(true) -> ] +L5 [result of boolean operation]: + magic[AND](a && true|, ) -> PREV:[jf(L5 [result of boolean operation]|), r(true) -> ] r(a) -> - jt(L6|) NEXT:[r(false) -> , magic[OR](a || false|, ) -> ] + jt(L6 [result of boolean operation]|) NEXT:[r(false) -> , magic[OR](a || false|, ) -> ] r(false) -> -L6: - magic[OR](a || false|, ) -> PREV:[jt(L6|), r(false) -> ] +L6 [result of boolean operation]: + magic[OR](a || false|, ) -> PREV:[jt(L6 [result of boolean operation]|), r(false) -> ] L1: 1 NEXT:[] error: diff --git a/compiler/testData/cfg/bugs/jumpToOuterScope.instructions b/compiler/testData/cfg/bugs/jumpToOuterScope.instructions index b3bed52a215..8a12cd94393 100644 --- a/compiler/testData/cfg/bugs/jumpToOuterScope.instructions +++ b/compiler/testData/cfg/bugs/jumpToOuterScope.instructions @@ -15,22 +15,22 @@ L0: 2 mark({ for (e in c) { { break } } }) 3 r(c) -> v(e) -L3: - jmp?(L2) NEXT:[read (Unit), magic[LOOP_RANGE_ITERATION](c|) -> ] +L3 ['for' loop condition entry point]: + jmp?(L2 ['for' loop exit point]) NEXT:[read (Unit), magic[LOOP_RANGE_ITERATION](c|) -> ] L4 [loop entry point]: L5 [body entry point]: - magic[LOOP_RANGE_ITERATION](c|) -> PREV:[jmp?(L2), jmp?(L4 [loop entry point])] + magic[LOOP_RANGE_ITERATION](c|) -> PREV:[jmp?(L2 ['for' loop exit point]), jmp?(L4 [loop entry point])] w(e|) mark(for (e in c) { { break } }) 4 mark({ { break } }) mark({ break }) - jmp?(L6) NEXT:[r({ break }) -> , d({ break })] + jmp?(L6 [after local declaration]) NEXT:[r({ break }) -> , d({ break })] d({ break }) NEXT:[] -L6: - r({ break }) -> PREV:[jmp?(L6)] +L6 [after local declaration]: + r({ break }) -> PREV:[jmp?(L6 [after local declaration])] 3 jmp?(L4 [loop entry point]) NEXT:[magic[LOOP_RANGE_ITERATION](c|) -> , read (Unit)] -L2: - read (Unit) PREV:[jmp?(L2), jmp(L2), jmp?(L4 [loop entry point])] +L2 ['for' loop exit point]: + read (Unit) PREV:[jmp?(L2 ['for' loop exit point]), jmp(L2 ['for' loop exit point]), jmp?(L4 [loop entry point])] L1: 1 NEXT:[] error: @@ -46,12 +46,12 @@ sink: L7: 5 6 mark(break) - jmp(L2) NEXT:[read (Unit)] -- 5 ret(*|!) L8 PREV:[] + jmp(L2 ['for' loop exit point]) NEXT:[read (Unit)] +- 5 ret(*|!) L8 PREV:[] L8: - NEXT:[] PREV:[] + NEXT:[] PREV:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] -===================== + PREV:[, ] +===================== \ No newline at end of file diff --git a/compiler/testData/cfg/controlStructures/Finally.instructions b/compiler/testData/cfg/controlStructures/Finally.instructions index 171f5c6d1cf..8d78e5a3edc 100644 --- a/compiler/testData/cfg/controlStructures/Finally.instructions +++ b/compiler/testData/cfg/controlStructures/Finally.instructions @@ -56,17 +56,17 @@ L0: r(3) -> mark(2 > 3) call(2 > 3, compareTo|, ) -> - jf(L3|) NEXT:[read (Unit), mark({ return })] + jf(L3 [else branch]|) NEXT:[read (Unit), mark({ return })] 4 mark({ return }) L4 [start finally]: 5 mark({ 2 }) r(2) -> L5 [finish finally]: 4 ret L1 NEXT:[] -- 3 jmp(L6) NEXT:[merge(if (2 > 3) { return }|!) -> ] PREV:[] -L3: - read (Unit) PREV:[jf(L3|)] -L6: +- 3 jmp(L6 ['if' expression result]) NEXT:[merge(if (2 > 3) { return }|!) -> ] PREV:[] +L3 [else branch]: + read (Unit) PREV:[jf(L3 [else branch]|)] +L6 ['if' expression result]: merge(if (2 > 3) { return }|!) -> 2 jmp(L7 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L2 [onExceptionToFinallyBlock]: @@ -107,10 +107,10 @@ L0: r(1) -> mark(@l{ () -> if (2 > 3) { return@l } }) mark({ () -> if (2 > 3) { return@l } }) - jmp?(L3) NEXT:[r({ () -> if (2 > 3) { return@l } }) -> , d({ () -> if (2 > 3) { return@l } })] + jmp?(L3 [after local declaration]) NEXT:[r({ () -> if (2 > 3) { return@l } }) -> , d({ () -> if (2 > 3) { return@l } })] d({ () -> if (2 > 3) { return@l } }) NEXT:[] -L3: - r({ () -> if (2 > 3) { return@l } }) -> PREV:[jmp?(L3)] +L3 [after local declaration]: + r({ () -> if (2 > 3) { return@l } }) -> PREV:[jmp?(L3 [after local declaration])] 2 jmp(L8 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L2 [onExceptionToFinallyBlock]: L9 [start finally]: @@ -144,13 +144,13 @@ L4: r(3) -> mark(2 > 3) call(2 > 3, compareTo|, ) -> - jf(L6|) NEXT:[read (Unit), mark({ return@l })] + jf(L6 [else branch]|) NEXT:[read (Unit), mark({ return@l })] 6 mark({ return@l }) ret L5 NEXT:[] -- 5 jmp(L7) NEXT:[merge(if (2 > 3) { return@l }|!) -> ] PREV:[] -L6: - read (Unit) PREV:[jf(L6|)] -L7: +- 5 jmp(L7 ['if' expression result]) NEXT:[merge(if (2 > 3) { return@l }|!) -> ] PREV:[] +L6 [else branch]: + read (Unit) PREV:[jf(L6 [else branch]|)] +L7 ['if' expression result]: merge(if (2 > 3) { return@l }|!) -> L5: 4 NEXT:[] PREV:[ret L5, merge(if (2 > 3) { return@l }|!) -> ] @@ -178,10 +178,10 @@ L0: 2 mark({ @l{ () -> try { 1 if (2 > 3) { return@l } } finally { 2 } } }) mark(@l{ () -> try { 1 if (2 > 3) { return@l } } finally { 2 } }) mark({ () -> try { 1 if (2 > 3) { return@l } } finally { 2 } }) - jmp?(L2) NEXT:[r({ () -> try { 1 if (2 > 3) { return@l } } finally { 2 } }) -> , d({ () -> try { 1 if (2 > 3) { return@l } } finally { 2 } })] + jmp?(L2 [after local declaration]) NEXT:[r({ () -> try { 1 if (2 > 3) { return@l } } finally { 2 } }) -> , d({ () -> try { 1 if (2 > 3) { return@l } } finally { 2 } })] d({ () -> try { 1 if (2 > 3) { return@l } } finally { 2 } }) NEXT:[] -L2: - r({ () -> try { 1 if (2 > 3) { return@l } } finally { 2 } }) -> PREV:[jmp?(L2)] +L2 [after local declaration]: + r({ () -> try { 1 if (2 > 3) { return@l } } finally { 2 } }) -> PREV:[jmp?(L2 [after local declaration])] L1: 1 NEXT:[] error: @@ -213,17 +213,17 @@ L3: r(3) -> mark(2 > 3) call(2 > 3, compareTo|, ) -> - jf(L6|) NEXT:[read (Unit), mark({ return@l })] + jf(L6 [else branch]|) NEXT:[read (Unit), mark({ return@l })] 6 mark({ return@l }) L7 [start finally]: 7 mark({ 2 }) r(2) -> L8 [finish finally]: 6 ret L4 NEXT:[] -- 5 jmp(L9) NEXT:[merge(if (2 > 3) { return@l }|!) -> ] PREV:[] -L6: - read (Unit) PREV:[jf(L6|)] -L9: +- 5 jmp(L9 ['if' expression result]) NEXT:[merge(if (2 > 3) { return@l }|!) -> ] PREV:[] +L6 [else branch]: + read (Unit) PREV:[jf(L6 [else branch]|)] +L9 ['if' expression result]: merge(if (2 > 3) { return@l }|!) -> 4 jmp(L10 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L5 [onExceptionToFinallyBlock]: @@ -275,17 +275,17 @@ L4 [body entry point]: r(3) -> mark(2 > 3) call(2 > 3, compareTo|, ) -> - jf(L7|) NEXT:[read (Unit), mark({ break @l })] + jf(L7 [else branch]|) NEXT:[read (Unit), mark({ break @l })] 5 mark({ break @l }) L8 [start finally]: 6 mark({ 2 }) r(2) -> L9 [finish finally]: 5 jmp(L3 [loop exit point]) NEXT:[read (Unit)] -- 4 jmp(L10) NEXT:[merge(if (2 > 3) { break @l }|!) -> ] PREV:[] -L7: - read (Unit) PREV:[jf(L7|)] -L10: +- 4 jmp(L10 ['if' expression result]) NEXT:[merge(if (2 > 3) { break @l }|!) -> ] PREV:[] +L7 [else branch]: + read (Unit) PREV:[jf(L7 [else branch]|)] +L10 ['if' expression result]: merge(if (2 > 3) { break @l }|!) -> 3 jmp(L11 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L6 [onExceptionToFinallyBlock]: @@ -341,13 +341,13 @@ L5 [body entry point]: r(3) -> mark(2 > 3) call(2 > 3, compareTo|, ) -> - jf(L7|) NEXT:[read (Unit), mark({ break @l })] + jf(L7 [else branch]|) NEXT:[read (Unit), mark({ break @l })] 5 mark({ break @l }) jmp(L4 [loop exit point]) NEXT:[read (Unit)] -- 4 jmp(L8) NEXT:[merge(if (2 > 3) { break @l }|!) -> ] PREV:[] -L7: - read (Unit) PREV:[jf(L7|)] -L8: +- 4 jmp(L8 ['if' expression result]) NEXT:[merge(if (2 > 3) { break @l }|!) -> ] PREV:[] +L7 [else branch]: + read (Unit) PREV:[jf(L7 [else branch]|)] +L8 ['if' expression result]: merge(if (2 > 3) { break @l }|!) -> 3 jmp(L3 [loop entry point]) NEXT:[r(true) -> ] L4 [loop exit point]: @@ -405,13 +405,13 @@ L5 [body entry point]: r(3) -> mark(2 > 3) call(2 > 3, compareTo|, ) -> - jf(L7|) NEXT:[read (Unit), mark({ break @l })] + jf(L7 [else branch]|) NEXT:[read (Unit), mark({ break @l })] 5 mark({ break @l }) jmp(L4 [loop exit point]) NEXT:[read (Unit)] -- 4 jmp(L8) NEXT:[merge(if (2 > 3) { break @l }|!) -> ] PREV:[] -L7: - read (Unit) PREV:[jf(L7|)] -L8: +- 4 jmp(L8 ['if' expression result]) NEXT:[merge(if (2 > 3) { break @l }|!) -> ] PREV:[] +L7 [else branch]: + read (Unit) PREV:[jf(L7 [else branch]|)] +L8 ['if' expression result]: merge(if (2 > 3) { break @l }|!) -> 3 jmp(L3 [loop entry point]) NEXT:[r(true) -> ] L4 [loop exit point]: @@ -460,11 +460,11 @@ L0: mark(1..a) call(1..a, rangeTo|, ) -> v(i) -L3: - jmp?(L2) NEXT:[read (Unit), magic[LOOP_RANGE_ITERATION](1..a|) -> ] +L3 ['for' loop condition entry point]: + jmp?(L2 ['for' loop exit point]) NEXT:[read (Unit), magic[LOOP_RANGE_ITERATION](1..a|) -> ] L4 [loop entry point]: L5 [body entry point]: - magic[LOOP_RANGE_ITERATION](1..a|) -> PREV:[jmp?(L2), jmp(L4 [loop entry point]), jmp?(L4 [loop entry point])] + magic[LOOP_RANGE_ITERATION](1..a|) -> PREV:[jmp?(L2 ['for' loop exit point]), jmp(L4 [loop entry point]), jmp?(L4 [loop entry point])] w(i|) mark(for (i in 1..a) { try { 1 if (2 > 3) { continue @l } } finally { 2 } }) 4 mark({ try { 1 if (2 > 3) { continue @l } } finally { 2 } }) @@ -477,17 +477,17 @@ L5 [body entry point]: r(3) -> mark(2 > 3) call(2 > 3, compareTo|, ) -> - jf(L7|) NEXT:[read (Unit), mark({ continue @l })] + jf(L7 [else branch]|) NEXT:[read (Unit), mark({ continue @l })] 6 mark({ continue @l }) L8 [start finally]: 7 mark({ 2 }) r(2) -> L9 [finish finally]: 6 jmp(L4 [loop entry point]) NEXT:[magic[LOOP_RANGE_ITERATION](1..a|) -> ] -- 5 jmp(L10) NEXT:[merge(if (2 > 3) { continue @l }|!) -> ] PREV:[] -L7: - read (Unit) PREV:[jf(L7|)] -L10: +- 5 jmp(L10 ['if' expression result]) NEXT:[merge(if (2 > 3) { continue @l }|!) -> ] PREV:[] +L7 [else branch]: + read (Unit) PREV:[jf(L7 [else branch]|)] +L10 ['if' expression result]: merge(if (2 > 3) { continue @l }|!) -> 4 jmp(L11 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L6 [onExceptionToFinallyBlock]: @@ -499,8 +499,8 @@ L11 [skipFinallyToErrorBlock]: r(2) -> 4 merge(try { 1 if (2 > 3) { continue @l } } finally { 2 }|) -> 3 jmp?(L4 [loop entry point]) NEXT:[magic[LOOP_RANGE_ITERATION](1..a|) -> , read (Unit)] -L2: - read (Unit) PREV:[jmp?(L2), jmp?(L4 [loop entry point])] +L2 ['for' loop exit point]: + read (Unit) PREV:[jmp?(L2 ['for' loop exit point]), jmp?(L4 [loop entry point])] L1: 1 NEXT:[] error: @@ -538,11 +538,11 @@ L0: mark(1..a) call(1..a, rangeTo|, ) -> v(i) -L4: - jmp?(L3) NEXT:[read (Unit), magic[LOOP_RANGE_ITERATION](1..a|) -> ] +L4 ['for' loop condition entry point]: + jmp?(L3 ['for' loop exit point]) NEXT:[read (Unit), magic[LOOP_RANGE_ITERATION](1..a|) -> ] L5 [loop entry point]: L6 [body entry point]: - magic[LOOP_RANGE_ITERATION](1..a|) -> PREV:[jmp?(L3), jmp(L5 [loop entry point]), jmp?(L5 [loop entry point])] + magic[LOOP_RANGE_ITERATION](1..a|) -> PREV:[jmp?(L3 ['for' loop exit point]), jmp(L5 [loop entry point]), jmp?(L5 [loop entry point])] w(i|) mark(for (i in 1..a) { 1 if (2 > 3) { continue @l } }) 5 mark({ 1 if (2 > 3) { continue @l } }) @@ -552,17 +552,17 @@ L6 [body entry point]: r(3) -> mark(2 > 3) call(2 > 3, compareTo|, ) -> - jf(L7|) NEXT:[read (Unit), mark({ continue @l })] + jf(L7 [else branch]|) NEXT:[read (Unit), mark({ continue @l })] 6 mark({ continue @l }) jmp(L5 [loop entry point]) NEXT:[magic[LOOP_RANGE_ITERATION](1..a|) -> ] -- 5 jmp(L8) NEXT:[merge(if (2 > 3) { continue @l }|!) -> ] PREV:[] -L7: - read (Unit) PREV:[jf(L7|)] -L8: +- 5 jmp(L8 ['if' expression result]) NEXT:[merge(if (2 > 3) { continue @l }|!) -> ] PREV:[] +L7 [else branch]: + read (Unit) PREV:[jf(L7 [else branch]|)] +L8 ['if' expression result]: merge(if (2 > 3) { continue @l }|!) -> 4 jmp?(L5 [loop entry point]) NEXT:[magic[LOOP_RANGE_ITERATION](1..a|) -> , read (Unit)] -L3: - read (Unit) PREV:[jmp?(L3), jmp?(L5 [loop entry point])] +L3 ['for' loop exit point]: + read (Unit) PREV:[jmp?(L3 ['for' loop exit point]), jmp?(L5 [loop entry point])] 3 r(5) -> 2 jmp(L9 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L2 [onExceptionToFinallyBlock]: @@ -611,11 +611,11 @@ L0: mark(1..a) call(1..a, rangeTo|, ) -> v(i) -L4: - jmp?(L3) NEXT:[read (Unit), magic[LOOP_RANGE_ITERATION](1..a|) -> ] +L4 ['for' loop condition entry point]: + jmp?(L3 ['for' loop exit point]) NEXT:[read (Unit), magic[LOOP_RANGE_ITERATION](1..a|) -> ] L5 [loop entry point]: L6 [body entry point]: - magic[LOOP_RANGE_ITERATION](1..a|) -> PREV:[jmp?(L3), jmp(L5 [loop entry point]), jmp?(L5 [loop entry point])] + magic[LOOP_RANGE_ITERATION](1..a|) -> PREV:[jmp?(L3 ['for' loop exit point]), jmp(L5 [loop entry point]), jmp?(L5 [loop entry point])] w(i|) mark(for (i in 1..a) { 1 if (2 > 3) { continue @l } }) 5 mark({ 1 if (2 > 3) { continue @l } }) @@ -625,17 +625,17 @@ L6 [body entry point]: r(3) -> mark(2 > 3) call(2 > 3, compareTo|, ) -> - jf(L7|) NEXT:[read (Unit), mark({ continue @l })] + jf(L7 [else branch]|) NEXT:[read (Unit), mark({ continue @l })] 6 mark({ continue @l }) jmp(L5 [loop entry point]) NEXT:[magic[LOOP_RANGE_ITERATION](1..a|) -> ] -- 5 jmp(L8) NEXT:[merge(if (2 > 3) { continue @l }|!) -> ] PREV:[] -L7: - read (Unit) PREV:[jf(L7|)] -L8: +- 5 jmp(L8 ['if' expression result]) NEXT:[merge(if (2 > 3) { continue @l }|!) -> ] PREV:[] +L7 [else branch]: + read (Unit) PREV:[jf(L7 [else branch]|)] +L8 ['if' expression result]: merge(if (2 > 3) { continue @l }|!) -> 4 jmp?(L5 [loop entry point]) NEXT:[magic[LOOP_RANGE_ITERATION](1..a|) -> , read (Unit)] -L3: - read (Unit) PREV:[jmp?(L3), jmp?(L5 [loop entry point])] +L3 ['for' loop exit point]: + read (Unit) PREV:[jmp?(L3 ['for' loop exit point]), jmp?(L5 [loop entry point])] 2 jmp(L9 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L2 [onExceptionToFinallyBlock]: L10 [start finally]: @@ -973,4 +973,4 @@ error: PREV:[] sink: PREV:[, ] -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg/controlStructures/FinallyTestCopy.instructions b/compiler/testData/cfg/controlStructures/FinallyTestCopy.instructions index 71ec497f556..989fd004f49 100644 --- a/compiler/testData/cfg/controlStructures/FinallyTestCopy.instructions +++ b/compiler/testData/cfg/controlStructures/FinallyTestCopy.instructions @@ -180,12 +180,12 @@ L11 [start finally]: mark(if (cond()) return else continue) mark(cond()) call(cond(), cond) -> - jf(L12|) NEXT:[jmp(L2 [loop entry point]), ret L1] + jf(L12 [else branch]|) NEXT:[jmp(L2 [loop entry point]), ret L1] ret L1 NEXT:[] -- jmp(L13) NEXT:[merge(if (cond()) return else continue|!, !) -> ] PREV:[] -L12: - jmp(L2 [loop entry point]) NEXT:[mark(cond())] PREV:[jf(L12|)] -L13: +- jmp(L13 ['if' expression result]) NEXT:[merge(if (cond()) return else continue|!, !) -> ] PREV:[] +L12 [else branch]: + jmp(L2 [loop entry point]) NEXT:[mark(cond())] PREV:[jf(L12 [else branch]|)] +L13 ['if' expression result]: - merge(if (cond()) return else continue|!, !) -> PREV:[] L14 [finish finally]: - 3 jmp(error) NEXT:[] PREV:[] @@ -194,10 +194,10 @@ L10 [skipFinallyToErrorBlock]: mark(if (cond()) return else continue) mark(cond()) call(cond(), cond) -> - jf(copy L12|) NEXT:[jmp(L2 [loop entry point]), ret L1] + jf(copy L12 [else branch]|) NEXT:[jmp(L2 [loop entry point]), ret L1] ret L1 NEXT:[] -- jmp(copy L13) NEXT:[merge(if (cond()) return else continue|!, !) -> ] PREV:[] - jmp(L2 [loop entry point]) NEXT:[mark(cond())] PREV:[jf(copy L12|)] +- jmp(copy L13 ['if' expression result]) NEXT:[merge(if (cond()) return else continue|!, !) -> ] PREV:[] + jmp(L2 [loop entry point]) NEXT:[mark(cond())] PREV:[jf(copy L12 [else branch]|)] - merge(if (cond()) return else continue|!, !) -> PREV:[] - 3 merge(try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { if (cond()) return else continue }|, , ) -> PREV:[] - 2 jmp(L2 [loop entry point]) NEXT:[mark(cond())] PREV:[] @@ -317,14 +317,14 @@ L4 [start finally]: r(null) -> mark(list != null) call(list != null, equals|, ) -> - jf(L5|) NEXT:[read (Unit), mark({ })] + jf(L5 [else branch]|) NEXT:[read (Unit), mark({ })] 4 mark({ }) read (Unit) - 3 jmp(L6) NEXT:[merge(if(list != null) { }|!) -> ] -L5: - read (Unit) PREV:[jf(L5|)] -L6: - merge(if(list != null) { }|!) -> PREV:[jmp(L6), read (Unit)] + 3 jmp(L6 ['if' expression result]) NEXT:[merge(if(list != null) { }|!) -> ] +L5 [else branch]: + read (Unit) PREV:[jf(L5 [else branch]|)] +L6 ['if' expression result]: + merge(if(list != null) { }|!) -> PREV:[jmp(L6 ['if' expression result]), read (Unit)] L7 [finish finally]: 2 jmp(error) NEXT:[] L3 [skipFinallyToErrorBlock]: @@ -334,12 +334,12 @@ L3 [skipFinallyToErrorBlock]: r(null) -> mark(list != null) call(list != null, equals|, ) -> - jf(copy L5|) NEXT:[read (Unit), mark({ })] + jf(copy L5 [else branch]|) NEXT:[read (Unit), mark({ })] 4 mark({ }) read (Unit) - 3 jmp(copy L6) NEXT:[merge(if(list != null) { }|!) -> ] - read (Unit) PREV:[jf(copy L5|)] - merge(if(list != null) { }|!) -> PREV:[jmp(copy L6), read (Unit)] + 3 jmp(copy L6 ['if' expression result]) NEXT:[merge(if(list != null) { }|!) -> ] + read (Unit) PREV:[jf(copy L5 [else branch]|)] + merge(if(list != null) { }|!) -> PREV:[jmp(copy L6 ['if' expression result]), read (Unit)] 2 merge(try { doSmth() } finally { if(list != null) { } }|) -> L1: 1 NEXT:[] @@ -347,4 +347,4 @@ error: PREV:[jmp(error)] sink: PREV:[, ] -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg/controlStructures/For.instructions b/compiler/testData/cfg/controlStructures/For.instructions index 1b56e6af276..47df9c8e98c 100644 --- a/compiler/testData/cfg/controlStructures/For.instructions +++ b/compiler/testData/cfg/controlStructures/For.instructions @@ -13,11 +13,11 @@ L0: mark(1..2) call(1..2, rangeTo|, ) -> v(i) -L3: - jmp?(L2) NEXT:[read (Unit), magic[LOOP_RANGE_ITERATION](1..2|) -> ] +L3 ['for' loop condition entry point]: + jmp?(L2 ['for' loop exit point]) NEXT:[read (Unit), magic[LOOP_RANGE_ITERATION](1..2|) -> ] L4 [loop entry point]: L5 [body entry point]: - magic[LOOP_RANGE_ITERATION](1..2|) -> PREV:[jmp?(L2), jmp?(L4 [loop entry point])] + magic[LOOP_RANGE_ITERATION](1..2|) -> PREV:[jmp?(L2 ['for' loop exit point]), jmp?(L4 [loop entry point])] w(i|) mark(for (i in 1..2) { doSmth(i) }) 4 mark({ doSmth(i) }) @@ -25,8 +25,8 @@ L5 [body entry point]: mark(doSmth(i)) call(doSmth(i), doSmth|) -> 3 jmp?(L4 [loop entry point]) NEXT:[magic[LOOP_RANGE_ITERATION](1..2|) -> , read (Unit)] -L2: - read (Unit) PREV:[jmp?(L2), jmp?(L4 [loop entry point])] +L2 ['for' loop exit point]: + read (Unit) PREV:[jmp?(L2 ['for' loop exit point]), jmp?(L4 [loop entry point])] L1: 1 NEXT:[] error: @@ -50,4 +50,4 @@ error: PREV:[] sink: PREV:[, ] -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg/controlStructures/If.instructions b/compiler/testData/cfg/controlStructures/If.instructions index d3b02ff5133..134f834b8fc 100644 --- a/compiler/testData/cfg/controlStructures/If.instructions +++ b/compiler/testData/cfg/controlStructures/If.instructions @@ -25,35 +25,35 @@ L0: v(var u: String) mark(if (b) { u = "s" }) r(b) -> - jf(L2|) NEXT:[read (Unit), mark({ u = "s" })] + jf(L2 [else branch]|) NEXT:[read (Unit), mark({ u = "s" })] 3 mark({ u = "s" }) mark("s") r("s") -> w(u|) - 2 jmp(L3) NEXT:[merge(if (b) { u = "s" }|!) -> ] -L2: - read (Unit) PREV:[jf(L2|)] -L3: - merge(if (b) { u = "s" }|!) -> PREV:[jmp(L3), read (Unit)] + 2 jmp(L3 ['if' expression result]) NEXT:[merge(if (b) { u = "s" }|!) -> ] +L2 [else branch]: + read (Unit) PREV:[jf(L2 [else branch]|)] +L3 ['if' expression result]: + merge(if (b) { u = "s" }|!) -> PREV:[jmp(L3 ['if' expression result]), read (Unit)] r(u) -> mark(doSmth(u)) call(doSmth(u), doSmth|) -> v(var r: String) mark(if (b) { r = "s" } else { r = "t" }) r(b) -> - jf(L4|) NEXT:[mark({ r = "t" }), mark({ r = "s" })] + jf(L4 [else branch]|) NEXT:[mark({ r = "t" }), mark({ r = "s" })] 3 mark({ r = "s" }) mark("s") r("s") -> w(r|) - 2 jmp(L5) NEXT:[merge(if (b) { r = "s" } else { r = "t" }|!, !) -> ] -L4: - 3 mark({ r = "t" }) PREV:[jf(L4|)] + 2 jmp(L5 ['if' expression result]) NEXT:[merge(if (b) { r = "s" } else { r = "t" }|!, !) -> ] +L4 [else branch]: + 3 mark({ r = "t" }) PREV:[jf(L4 [else branch]|)] mark("t") r("t") -> w(r|) -L5: - 2 merge(if (b) { r = "s" } else { r = "t" }|!, !) -> PREV:[jmp(L5), w(r|)] +L5 ['if' expression result]: + 2 merge(if (b) { r = "s" } else { r = "t" }|!, !) -> PREV:[jmp(L5 ['if' expression result]), w(r|)] r(r) -> mark(doSmth(r)) call(doSmth(r), doSmth|) -> @@ -87,13 +87,13 @@ L0: w(i|) mark(if (b) { return; }) r(b) -> - jf(L2|) NEXT:[read (Unit), mark({ return; })] + jf(L2 [else branch]|) NEXT:[read (Unit), mark({ return; })] 3 mark({ return; }) ret L1 NEXT:[] -- 2 jmp(L3) NEXT:[merge(if (b) { return; }|!) -> ] PREV:[] -L2: - read (Unit) PREV:[jf(L2|)] -L3: +- 2 jmp(L3 ['if' expression result]) NEXT:[merge(if (b) { return; }|!) -> ] PREV:[] +L2 [else branch]: + read (Unit) PREV:[jf(L2 [else branch]|)] +L3 ['if' expression result]: merge(if (b) { return; }|!) -> r(i) -> mark(doSmth(i)) @@ -102,13 +102,13 @@ L3: mark(i is Int) r(i) -> magic[IS](i is Int|) -> - jf(L4|) NEXT:[read (Unit), mark({ return; })] + jf(L4 [else branch]|) NEXT:[read (Unit), mark({ return; })] 3 mark({ return; }) ret L1 NEXT:[] -- 2 jmp(L5) NEXT:[merge(if (i is Int) { return; }|!) -> ] PREV:[] -L4: - read (Unit) PREV:[jf(L4|)] -L5: +- 2 jmp(L5 ['if' expression result]) NEXT:[merge(if (i is Int) { return; }|!) -> ] PREV:[] +L4 [else branch]: + read (Unit) PREV:[jf(L4 [else branch]|)] +L5 ['if' expression result]: merge(if (i is Int) { return; }|!) -> L1: 1 NEXT:[] PREV:[ret L1, ret L1, merge(if (i is Int) { return; }|!) -> ] @@ -133,4 +133,4 @@ error: PREV:[] sink: PREV:[, ] -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg/controlStructures/returnsInWhen.instructions b/compiler/testData/cfg/controlStructures/returnsInWhen.instructions index fefa40ce995..3b9cbb1b238 100644 --- a/compiler/testData/cfg/controlStructures/returnsInWhen.instructions +++ b/compiler/testData/cfg/controlStructures/returnsInWhen.instructions @@ -16,18 +16,18 @@ L0: mark(is Int -> return a) mark(is Int) magic[IS](is Int|) -> - jmp?(L4|) NEXT:[merge(when(a) { is Int -> return a }|!) -> , r(a) -> ] -L3: + jmp?(L4 [next 'when' entry]|) NEXT:[merge(when(a) { is Int -> return a }|!) -> , r(a) -> ] +L3 ['when' entry body]: r(a) -> ret(*|) L1 NEXT:[] -- jmp(L2) PREV:[] -L2: -L4: - merge(when(a) { is Int -> return a }|!) -> PREV:[jmp?(L4|)] +- jmp(L2 [after 'when' expression]) PREV:[] +L2 [after 'when' expression]: +L4 [next 'when' entry]: + merge(when(a) { is Int -> return a }|!) -> PREV:[jmp?(L4 [next 'when' entry]|)] L1: 1 NEXT:[] PREV:[ret(*|) L1, merge(when(a) { is Int -> return a }|!) -> ] error: PREV:[] sink: PREV:[, ] -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg/controlStructures/whenConditions.instructions b/compiler/testData/cfg/controlStructures/whenConditions.instructions index f9561bda532..3acb34eef05 100644 --- a/compiler/testData/cfg/controlStructures/whenConditions.instructions +++ b/compiler/testData/cfg/controlStructures/whenConditions.instructions @@ -23,62 +23,62 @@ L0: mark(1) r(1) -> magic[EQUALS_IN_WHEN_CONDITION](1|, ) -> - jmp?(L4|) NEXT:[mark(in Collections.singleton(2) -> "2"), mark("1")] -L3: + jmp?(L4 [next 'when' entry]|) NEXT:[mark(in Collections.singleton(2) -> "2"), mark("1")] +L3 ['when' entry body]: mark("1") r("1") -> - jmp(L2) NEXT:[merge(when (a) { 1 -> "1" in Collections.singleton(2) -> "2" is Int -> "Int" !in Collections.singleton(3) -> "!3" !is Number -> "!Number" else -> null }|, , , , , ) -> ] -L4: - mark(in Collections.singleton(2) -> "2") PREV:[jmp?(L4|)] + jmp(L2 [after 'when' expression]) NEXT:[merge(when (a) { 1 -> "1" in Collections.singleton(2) -> "2" is Int -> "Int" !in Collections.singleton(3) -> "!3" !is Number -> "!Number" else -> null }|, , , , , ) -> ] +L4 [next 'when' entry]: + mark(in Collections.singleton(2) -> "2") PREV:[jmp?(L4 [next 'when' entry]|)] mark(Collections.singleton(2)) r(2) -> mark(singleton(2)) call(singleton(2), singleton|) -> mark(in Collections.singleton(2)) call(in Collections.singleton(2), contains|, ) -> - jmp?(L6|) NEXT:[mark(is Int -> "Int"), mark("2")] -L5: + jmp?(L6 [next 'when' entry]|) NEXT:[mark(is Int -> "Int"), mark("2")] +L5 ['when' entry body]: mark("2") r("2") -> - jmp(L2) NEXT:[merge(when (a) { 1 -> "1" in Collections.singleton(2) -> "2" is Int -> "Int" !in Collections.singleton(3) -> "!3" !is Number -> "!Number" else -> null }|, , , , , ) -> ] -L6: - mark(is Int -> "Int") PREV:[jmp?(L6|)] + jmp(L2 [after 'when' expression]) NEXT:[merge(when (a) { 1 -> "1" in Collections.singleton(2) -> "2" is Int -> "Int" !in Collections.singleton(3) -> "!3" !is Number -> "!Number" else -> null }|, , , , , ) -> ] +L6 [next 'when' entry]: + mark(is Int -> "Int") PREV:[jmp?(L6 [next 'when' entry]|)] mark(is Int) magic[IS](is Int|) -> - jmp?(L8|) NEXT:[mark(!in Collections.singleton(3) -> "!3"), mark("Int")] -L7: + jmp?(L8 [next 'when' entry]|) NEXT:[mark(!in Collections.singleton(3) -> "!3"), mark("Int")] +L7 ['when' entry body]: mark("Int") r("Int") -> - jmp(L2) NEXT:[merge(when (a) { 1 -> "1" in Collections.singleton(2) -> "2" is Int -> "Int" !in Collections.singleton(3) -> "!3" !is Number -> "!Number" else -> null }|, , , , , ) -> ] -L8: - mark(!in Collections.singleton(3) -> "!3") PREV:[jmp?(L8|)] + jmp(L2 [after 'when' expression]) NEXT:[merge(when (a) { 1 -> "1" in Collections.singleton(2) -> "2" is Int -> "Int" !in Collections.singleton(3) -> "!3" !is Number -> "!Number" else -> null }|, , , , , ) -> ] +L8 [next 'when' entry]: + mark(!in Collections.singleton(3) -> "!3") PREV:[jmp?(L8 [next 'when' entry]|)] mark(Collections.singleton(3)) r(3) -> mark(singleton(3)) call(singleton(3), singleton|) -> mark(!in Collections.singleton(3)) call(!in Collections.singleton(3), contains|, ) -> - jmp?(L10|) NEXT:[mark(!is Number -> "!Number"), mark("!3")] -L9: + jmp?(L10 [next 'when' entry]|) NEXT:[mark(!is Number -> "!Number"), mark("!3")] +L9 ['when' entry body]: mark("!3") r("!3") -> - jmp(L2) NEXT:[merge(when (a) { 1 -> "1" in Collections.singleton(2) -> "2" is Int -> "Int" !in Collections.singleton(3) -> "!3" !is Number -> "!Number" else -> null }|, , , , , ) -> ] -L10: - mark(!is Number -> "!Number") PREV:[jmp?(L10|)] + jmp(L2 [after 'when' expression]) NEXT:[merge(when (a) { 1 -> "1" in Collections.singleton(2) -> "2" is Int -> "Int" !in Collections.singleton(3) -> "!3" !is Number -> "!Number" else -> null }|, , , , , ) -> ] +L10 [next 'when' entry]: + mark(!is Number -> "!Number") PREV:[jmp?(L10 [next 'when' entry]|)] mark(!is Number) magic[IS](!is Number|) -> - jmp?(L12|) NEXT:[mark(else -> null), mark("!Number")] -L11: + jmp?(L12 [next 'when' entry]|) NEXT:[mark(else -> null), mark("!Number")] +L11 ['when' entry body]: mark("!Number") r("!Number") -> - jmp(L2) NEXT:[merge(when (a) { 1 -> "1" in Collections.singleton(2) -> "2" is Int -> "Int" !in Collections.singleton(3) -> "!3" !is Number -> "!Number" else -> null }|, , , , , ) -> ] -L12: - mark(else -> null) PREV:[jmp?(L12|)] -L13: + jmp(L2 [after 'when' expression]) NEXT:[merge(when (a) { 1 -> "1" in Collections.singleton(2) -> "2" is Int -> "Int" !in Collections.singleton(3) -> "!3" !is Number -> "!Number" else -> null }|, , , , , ) -> ] +L12 [next 'when' entry]: + mark(else -> null) PREV:[jmp?(L12 [next 'when' entry]|)] +L13 ['when' entry body]: r(null) -> - jmp(L2) -L2: - merge(when (a) { 1 -> "1" in Collections.singleton(2) -> "2" is Int -> "Int" !in Collections.singleton(3) -> "!3" !is Number -> "!Number" else -> null }|, , , , , ) -> PREV:[jmp(L2), jmp(L2), jmp(L2), jmp(L2), jmp(L2), jmp(L2)] + jmp(L2 [after 'when' expression]) +L2 [after 'when' expression]: + merge(when (a) { 1 -> "1" in Collections.singleton(2) -> "2" is Int -> "Int" !in Collections.singleton(3) -> "!3" !is Number -> "!Number" else -> null }|, , , , , ) -> PREV:[jmp(L2 [after 'when' expression]), jmp(L2 [after 'when' expression]), jmp(L2 [after 'when' expression]), jmp(L2 [after 'when' expression]), jmp(L2 [after 'when' expression]), jmp(L2 [after 'when' expression])] w(t|) L1: 1 NEXT:[] @@ -86,4 +86,4 @@ error: PREV:[] sink: PREV:[, ] -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg/conventions/equals.instructions b/compiler/testData/cfg/conventions/equals.instructions index 31762daf553..3c6bdac3e27 100644 --- a/compiler/testData/cfg/conventions/equals.instructions +++ b/compiler/testData/cfg/conventions/equals.instructions @@ -18,18 +18,18 @@ L0: r(b) -> mark(a == b) call(a == b, equals|, ) -> - jf(L2|) NEXT:[read (Unit), mark({ })] + jf(L2 [else branch]|) NEXT:[read (Unit), mark({ })] 3 mark({ }) read (Unit) - 2 jmp(L3) NEXT:[merge(if (a == b) { }|!) -> ] -L2: - read (Unit) PREV:[jf(L2|)] -L3: - merge(if (a == b) { }|!) -> PREV:[jmp(L3), read (Unit)] + 2 jmp(L3 ['if' expression result]) NEXT:[merge(if (a == b) { }|!) -> ] +L2 [else branch]: + read (Unit) PREV:[jf(L2 [else branch]|)] +L3 ['if' expression result]: + merge(if (a == b) { }|!) -> PREV:[jmp(L3 ['if' expression result]), read (Unit)] L1: 1 NEXT:[] error: PREV:[] sink: PREV:[, ] -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg/conventions/notEqual.instructions b/compiler/testData/cfg/conventions/notEqual.instructions index 13a4e1ac251..0c9c39d8c29 100644 --- a/compiler/testData/cfg/conventions/notEqual.instructions +++ b/compiler/testData/cfg/conventions/notEqual.instructions @@ -17,18 +17,18 @@ L0: r(b) -> mark(a != b) call(a != b, equals|, ) -> - jf(L2|) NEXT:[read (Unit), mark({})] + jf(L2 [else branch]|) NEXT:[read (Unit), mark({})] 3 mark({}) read (Unit) - 2 jmp(L3) NEXT:[merge(if (a != b) {}|!) -> ] -L2: - read (Unit) PREV:[jf(L2|)] -L3: - merge(if (a != b) {}|!) -> PREV:[jmp(L3), read (Unit)] + 2 jmp(L3 ['if' expression result]) NEXT:[merge(if (a != b) {}|!) -> ] +L2 [else branch]: + read (Unit) PREV:[jf(L2 [else branch]|)] +L3 ['if' expression result]: + merge(if (a != b) {}|!) -> PREV:[jmp(L3 ['if' expression result]), read (Unit)] L1: 1 NEXT:[] error: PREV:[] sink: PREV:[, ] -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg/deadCode/returnInElvis.instructions b/compiler/testData/cfg/deadCode/returnInElvis.instructions index 718d200f40d..39214e81f6e 100644 --- a/compiler/testData/cfg/deadCode/returnInElvis.instructions +++ b/compiler/testData/cfg/deadCode/returnInElvis.instructions @@ -8,9 +8,9 @@ L0: 2 mark({ return ?: null }) ret L1 NEXT:[] - mark(return ?: null) PREV:[] -- jt(L2) NEXT:[r(null) -> , merge(return ?: null|!, ) -> ] PREV:[] +- jt(L2 [after elvis operator]) NEXT:[r(null) -> , merge(return ?: null|!, ) -> ] PREV:[] - r(null) -> PREV:[] -L2: +L2 [after elvis operator]: - merge(return ?: null|!, ) -> PREV:[] L1: 1 NEXT:[] PREV:[ret L1] diff --git a/compiler/testData/cfg/declarations/functionLiterals/unusedFunctionLiteral.instructions b/compiler/testData/cfg/declarations/functionLiterals/unusedFunctionLiteral.instructions index 20c65a87908..f119f491772 100644 --- a/compiler/testData/cfg/declarations/functionLiterals/unusedFunctionLiteral.instructions +++ b/compiler/testData/cfg/declarations/functionLiterals/unusedFunctionLiteral.instructions @@ -7,16 +7,16 @@ L0: 1 2 mark({ {} }) mark({}) - jmp?(L2) NEXT:[r({}) -> , d({})] - d({}) NEXT:[] -L2: - r({}) -> PREV:[jmp?(L2)] + jmp?(L2 [after local declaration]) NEXT:[r({}) -> , d({})] + d({}) NEXT:[] +L2 [after local declaration]: + r({}) -> PREV:[jmp?(L2 [after local declaration])] L1: - 1 NEXT:[] + 1 NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, , d({})] + PREV:[, , d({})] ===================== == anonymous_0 == {} @@ -31,4 +31,4 @@ error: PREV:[] sink: PREV:[, ] -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg/declarations/local/LocalDeclarations.instructions b/compiler/testData/cfg/declarations/local/LocalDeclarations.instructions index 6a3e4a0b35c..3c1cbd42cd2 100644 --- a/compiler/testData/cfg/declarations/local/LocalDeclarations.instructions +++ b/compiler/testData/cfg/declarations/local/LocalDeclarations.instructions @@ -141,10 +141,10 @@ L0: v(val a = object { val y : Int fun inner_bar() { y = 10 } }) mark(object { val y : Int fun inner_bar() { y = 10 } }) v(val y : Int) - jmp?(L2) NEXT:[r(object { val y : Int fun inner_bar() { y = 10 } }) -> , d(fun inner_bar() { y = 10 })] + jmp?(L2 [after local declaration]) NEXT:[r(object { val y : Int fun inner_bar() { y = 10 } }) -> , d(fun inner_bar() { y = 10 })] d(fun inner_bar() { y = 10 }) NEXT:[] -L2: - r(object { val y : Int fun inner_bar() { y = 10 } }) -> PREV:[jmp?(L2)] +L2 [after local declaration]: + r(object { val y : Int fun inner_bar() { y = 10 } }) -> PREV:[jmp?(L2 [after local declaration])] w(a|) L1: 1 NEXT:[] @@ -196,10 +196,10 @@ L0: magic[IMPLICIT_RECEIVER]($x) -> r(1) -> w($x|, ) - 2 jmp?(L2) NEXT:[r(object { val x : Int val y : Int { $x = 1 } fun ggg() { y = 10 } }) -> , d(fun ggg() { y = 10 })] + 2 jmp?(L2 [after local declaration]) NEXT:[r(object { val x : Int val y : Int { $x = 1 } fun ggg() { y = 10 } }) -> , d(fun ggg() { y = 10 })] d(fun ggg() { y = 10 }) NEXT:[] -L2: - r(object { val x : Int val y : Int { $x = 1 } fun ggg() { y = 10 } }) -> PREV:[jmp?(L2)] +L2 [after local declaration]: + r(object { val x : Int val y : Int { $x = 1 } fun ggg() { y = 10 } }) -> PREV:[jmp?(L2 [after local declaration])] w(a|) L1: 1 NEXT:[] @@ -254,13 +254,13 @@ L0: magic[IMPLICIT_RECEIVER]($x) -> r(2) -> w($x|, ) - 2 jmp?(L2) NEXT:[jmp?(L5), d(fun foo() { x = 3 })] + 2 jmp?(L2 [after local declaration]) NEXT:[jmp?(L5 [after local declaration]), d(fun foo() { x = 3 })] d(fun foo() { x = 3 }) NEXT:[] -L2: - jmp?(L5) NEXT:[r(object { var x = 1 { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) -> , d(fun bar() { x = 4 })] PREV:[jmp?(L2)] +L2 [after local declaration]: + jmp?(L5 [after local declaration]) NEXT:[r(object { var x = 1 { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) -> , d(fun bar() { x = 4 })] PREV:[jmp?(L2 [after local declaration])] d(fun bar() { x = 4 }) NEXT:[] -L5: - r(object { var x = 1 { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) -> PREV:[jmp?(L5)] +L5 [after local declaration]: + r(object { var x = 1 { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) -> PREV:[jmp?(L5 [after local declaration])] w(a|) L1: 1 NEXT:[] @@ -304,4 +304,4 @@ error: PREV:[] sink: PREV:[, ] -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg/declarations/local/localClass.instructions b/compiler/testData/cfg/declarations/local/localClass.instructions index f7de8c9b3cf..d037e0d3a68 100644 --- a/compiler/testData/cfg/declarations/local/localClass.instructions +++ b/compiler/testData/cfg/declarations/local/localClass.instructions @@ -14,11 +14,11 @@ fun f() { L0: 1 2 mark({ class LocalClass() { fun f() { val x = "" fun loc() { val x3 = "" } } } }) - jmp?(L2) NEXT:[, d(fun f() { val x = "" fun loc() { val x3 = "" } })] + jmp?(L2 [after local declaration]) NEXT:[, d(fun f() { val x = "" fun loc() { val x3 = "" } })] d(fun f() { val x = "" fun loc() { val x3 = "" } }) NEXT:[] L1: -L2: - 1 NEXT:[] PREV:[jmp?(L2)] +L2 [after local declaration]: + 1 NEXT:[] PREV:[jmp?(L2 [after local declaration])] error: PREV:[] sink: @@ -40,11 +40,11 @@ L3: mark("") r("") -> w(x|) - jmp?(L5) NEXT:[, d(fun loc() { val x3 = "" })] + jmp?(L5 [after local declaration]) NEXT:[, d(fun loc() { val x3 = "" })] d(fun loc() { val x3 = "" }) NEXT:[] L4: -L5: - 3 NEXT:[] PREV:[jmp?(L5)] +L5 [after local declaration]: + 3 NEXT:[] PREV:[jmp?(L5 [after local declaration])] error: PREV:[] sink: @@ -68,4 +68,4 @@ error: PREV:[] sink: PREV:[, ] -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg/declarations/local/localProperty.instructions b/compiler/testData/cfg/declarations/local/localProperty.instructions index 3ef3629b35c..97e4308a411 100644 --- a/compiler/testData/cfg/declarations/local/localProperty.instructions +++ b/compiler/testData/cfg/declarations/local/localProperty.instructions @@ -13,11 +13,11 @@ L0: 1 2 mark({ class B { val a: Int get() { val b: Int return b } } }) v(val a: Int get() { val b: Int return b }) - jmp?(L2) NEXT:[, d(get() { val b: Int return b })] + jmp?(L2 [after local declaration]) NEXT:[, d(get() { val b: Int return b })] d(get() { val b: Int return b }) NEXT:[] L1: -L2: - 1 NEXT:[] PREV:[jmp?(L2)] +L2 [after local declaration]: + 1 NEXT:[] PREV:[jmp?(L2 [after local declaration])] error: PREV:[] sink: @@ -41,4 +41,4 @@ error: PREV:[] sink: PREV:[, ] -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg/expressions/Assignments.instructions b/compiler/testData/cfg/expressions/Assignments.instructions index 2635c2471d4..c70a8cbf74e 100644 --- a/compiler/testData/cfg/expressions/Assignments.instructions +++ b/compiler/testData/cfg/expressions/Assignments.instructions @@ -44,27 +44,27 @@ L0: w(x|) mark(if (true) 1 else 2) r(true) -> - jf(L2|) NEXT:[r(2) -> , r(1) -> ] + jf(L2 [else branch]|) NEXT:[r(2) -> , r(1) -> ] r(1) -> - jmp(L3) NEXT:[merge(if (true) 1 else 2|, ) -> ] -L2: - r(2) -> PREV:[jf(L2|)] -L3: - merge(if (true) 1 else 2|, ) -> PREV:[jmp(L3), r(2) -> ] + jmp(L3 ['if' expression result]) NEXT:[merge(if (true) 1 else 2|, ) -> ] +L2 [else branch]: + r(2) -> PREV:[jf(L2 [else branch]|)] +L3 ['if' expression result]: + merge(if (true) 1 else 2|, ) -> PREV:[jmp(L3 ['if' expression result]), r(2) -> ] w(x|) v(val y = true && false) r(true) -> - jf(L4|) NEXT:[magic[AND](true && false|, ) -> , r(false) -> ] + jf(L4 [result of boolean operation]|) NEXT:[magic[AND](true && false|, ) -> , r(false) -> ] r(false) -> -L4: - magic[AND](true && false|, ) -> PREV:[jf(L4|), r(false) -> ] +L4 [result of boolean operation]: + magic[AND](true && false|, ) -> PREV:[jf(L4 [result of boolean operation]|), r(false) -> ] w(y|) v(val z = false && true) r(false) -> - jf(L5|) NEXT:[magic[AND](false && true|, ) -> , r(true) -> ] + jf(L5 [result of boolean operation]|) NEXT:[magic[AND](false && true|, ) -> , r(true) -> ] r(true) -> -L5: - magic[AND](false && true|, ) -> PREV:[jf(L5|), r(true) -> ] +L5 [result of boolean operation]: + magic[AND](false && true|, ) -> PREV:[jf(L5 [result of boolean operation]|), r(true) -> ] w(z|) v(val t = Test()) mark(Test()) @@ -86,4 +86,4 @@ error: PREV:[] sink: PREV:[, ] -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg/expressions/LazyBooleans.instructions b/compiler/testData/cfg/expressions/LazyBooleans.instructions index 07e08b4c2d0..611e3155be9 100644 --- a/compiler/testData/cfg/expressions/LazyBooleans.instructions +++ b/compiler/testData/cfg/expressions/LazyBooleans.instructions @@ -28,63 +28,63 @@ L0: 2 mark({ if (a) { 1 } else { 2 } 3 if (a && b) 5 else 6 7 if (a || b) 8 else 9 10 if (a) 11 12 if (a) else 13 14 }) mark(if (a) { 1 } else { 2 }) r(a) -> - jf(L2|) NEXT:[mark({ 2 }), mark({ 1 })] + jf(L2 [else branch]|) NEXT:[mark({ 2 }), mark({ 1 })] 3 mark({ 1 }) r(1) -> - 2 jmp(L3) NEXT:[merge(if (a) { 1 } else { 2 }|, ) -> ] -L2: - 3 mark({ 2 }) PREV:[jf(L2|)] + 2 jmp(L3 ['if' expression result]) NEXT:[merge(if (a) { 1 } else { 2 }|, ) -> ] +L2 [else branch]: + 3 mark({ 2 }) PREV:[jf(L2 [else branch]|)] r(2) -> -L3: - 2 merge(if (a) { 1 } else { 2 }|, ) -> PREV:[jmp(L3), r(2) -> ] +L3 ['if' expression result]: + 2 merge(if (a) { 1 } else { 2 }|, ) -> PREV:[jmp(L3 ['if' expression result]), r(2) -> ] r(3) -> mark(if (a && b) 5 else 6) r(a) -> - jf(L4|) NEXT:[magic[AND](a && b|, ) -> , r(b) -> ] + jf(L4 [result of boolean operation]|) NEXT:[magic[AND](a && b|, ) -> , r(b) -> ] r(b) -> -L4: - magic[AND](a && b|, ) -> PREV:[jf(L4|), r(b) -> ] - jf(L5|) NEXT:[r(6) -> , r(5) -> ] +L4 [result of boolean operation]: + magic[AND](a && b|, ) -> PREV:[jf(L4 [result of boolean operation]|), r(b) -> ] + jf(L5 [else branch]|) NEXT:[r(6) -> , r(5) -> ] r(5) -> - jmp(L6) NEXT:[merge(if (a && b) 5 else 6|, ) -> ] -L5: - r(6) -> PREV:[jf(L5|)] -L6: - merge(if (a && b) 5 else 6|, ) -> PREV:[jmp(L6), r(6) -> ] + jmp(L6 ['if' expression result]) NEXT:[merge(if (a && b) 5 else 6|, ) -> ] +L5 [else branch]: + r(6) -> PREV:[jf(L5 [else branch]|)] +L6 ['if' expression result]: + merge(if (a && b) 5 else 6|, ) -> PREV:[jmp(L6 ['if' expression result]), r(6) -> ] r(7) -> mark(if (a || b) 8 else 9) r(a) -> - jt(L7|) NEXT:[r(b) -> , magic[OR](a || b|, ) -> ] + jt(L7 [result of boolean operation]|) NEXT:[r(b) -> , magic[OR](a || b|, ) -> ] r(b) -> -L7: - magic[OR](a || b|, ) -> PREV:[jt(L7|), r(b) -> ] - jf(L8|) NEXT:[r(9) -> , r(8) -> ] +L7 [result of boolean operation]: + magic[OR](a || b|, ) -> PREV:[jt(L7 [result of boolean operation]|), r(b) -> ] + jf(L8 [else branch]|) NEXT:[r(9) -> , r(8) -> ] r(8) -> - jmp(L9) NEXT:[merge(if (a || b) 8 else 9|, ) -> ] -L8: - r(9) -> PREV:[jf(L8|)] -L9: - merge(if (a || b) 8 else 9|, ) -> PREV:[jmp(L9), r(9) -> ] + jmp(L9 ['if' expression result]) NEXT:[merge(if (a || b) 8 else 9|, ) -> ] +L8 [else branch]: + r(9) -> PREV:[jf(L8 [else branch]|)] +L9 ['if' expression result]: + merge(if (a || b) 8 else 9|, ) -> PREV:[jmp(L9 ['if' expression result]), r(9) -> ] r(10) -> mark(if (a) 11) r(a) -> - jf(L10|) NEXT:[read (Unit), r(11) -> ] + jf(L10 [else branch]|) NEXT:[read (Unit), r(11) -> ] r(11) -> - jmp(L11) NEXT:[merge(if (a) 11|) -> ] -L10: - read (Unit) PREV:[jf(L10|)] -L11: - merge(if (a) 11|) -> PREV:[jmp(L11), read (Unit)] + jmp(L11 ['if' expression result]) NEXT:[merge(if (a) 11|) -> ] +L10 [else branch]: + read (Unit) PREV:[jf(L10 [else branch]|)] +L11 ['if' expression result]: + merge(if (a) 11|) -> PREV:[jmp(L11 ['if' expression result]), read (Unit)] r(12) -> mark(if (a) else 13) r(a) -> - jf(L12|) NEXT:[r(13) -> , read (Unit)] + jf(L12 [else branch]|) NEXT:[r(13) -> , read (Unit)] read (Unit) - jmp(L13) NEXT:[merge(if (a) else 13|) -> ] -L12: - r(13) -> PREV:[jf(L12|)] -L13: - merge(if (a) else 13|) -> PREV:[jmp(L13), r(13) -> ] + jmp(L13 ['if' expression result]) NEXT:[merge(if (a) else 13|) -> ] +L12 [else branch]: + r(13) -> PREV:[jf(L12 [else branch]|)] +L13 ['if' expression result]: + merge(if (a) else 13|) -> PREV:[jmp(L13 ['if' expression result]), r(13) -> ] r(14) -> L1: 1 NEXT:[] @@ -92,4 +92,4 @@ error: PREV:[] sink: PREV:[, ] -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg/expressions/ReturnFromExpression.instructions b/compiler/testData/cfg/expressions/ReturnFromExpression.instructions index 7159e92e1e3..9404f720979 100644 --- a/compiler/testData/cfg/expressions/ReturnFromExpression.instructions +++ b/compiler/testData/cfg/expressions/ReturnFromExpression.instructions @@ -7,16 +7,16 @@ L0: 1 2 mark({ false || (return false) }) r(false) -> - jt(L2|) NEXT:[mark((return false)), magic[OR](false || (return false)|, !) -> ] + jt(L2 [result of boolean operation]|) NEXT:[mark((return false)), magic[OR](false || (return false)|, !) -> ] mark((return false)) r(false) -> ret(*|) L1 NEXT:[] -L2: - magic[OR](false || (return false)|, !) -> PREV:[jt(L2|)] +L2 [result of boolean operation]: + magic[OR](false || (return false)|, !) -> PREV:[jt(L2 [result of boolean operation]|)] L1: 1 NEXT:[] PREV:[ret(*|) L1, magic[OR](false || (return false)|, !) -> ] error: PREV:[] sink: PREV:[, ] -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg/expressions/parenthesizedSelector.instructions b/compiler/testData/cfg/expressions/parenthesizedSelector.instructions index 156ec1dc1fc..235a4589c47 100644 --- a/compiler/testData/cfg/expressions/parenthesizedSelector.instructions +++ b/compiler/testData/cfg/expressions/parenthesizedSelector.instructions @@ -49,10 +49,10 @@ L0: 2 mark({ with(1) { "".(foo)() } }) r(1) -> mark({ "".(foo)() }) - jmp?(L2) NEXT:[r({ "".(foo)() }) -> , d({ "".(foo)() })] + jmp?(L2 [after local declaration]) NEXT:[r({ "".(foo)() }) -> , d({ "".(foo)() })] d({ "".(foo)() }) NEXT:[] -L2: - r({ "".(foo)() }) -> PREV:[jmp?(L2)] +L2 [after local declaration]: + r({ "".(foo)() }) -> PREV:[jmp?(L2 [after local declaration])] mark(with(1) { "".(foo)() }) call(with(1) { "".(foo)() }, with|, ) -> L1: @@ -84,4 +84,4 @@ error: PREV:[] sink: PREV:[, ] -===================== +===================== \ No newline at end of file diff --git a/compiler/testData/cfg/tailCalls/sum.instructions b/compiler/testData/cfg/tailCalls/sum.instructions index 4db0ec339a9..956392f5985 100644 --- a/compiler/testData/cfg/tailCalls/sum.instructions +++ b/compiler/testData/cfg/tailCalls/sum.instructions @@ -21,13 +21,13 @@ L0: call(toLong(), toLong|) -> mark(x == 0.toLong()) call(x == 0.toLong(), equals|, ) -> - jf(L2|) NEXT:[read (Unit), r(sum) -> ] + jf(L2 [else branch]|) NEXT:[read (Unit), r(sum) -> ] r(sum) -> ret(*|) L1 NEXT:[] -- jmp(L3) NEXT:[merge(if (x == 0.toLong()) return sum|!) -> ] PREV:[] -L2: - read (Unit) PREV:[jf(L2|)] -L3: +- jmp(L3 ['if' expression result]) NEXT:[merge(if (x == 0.toLong()) return sum|!) -> ] PREV:[] +L2 [else branch]: + read (Unit) PREV:[jf(L2 [else branch]|)] +L3 ['if' expression result]: merge(if (x == 0.toLong()) return sum|!) -> r(x) -> r(1) -> @@ -46,4 +46,4 @@ error: PREV:[] sink: PREV:[, ] -===================== +===================== \ No newline at end of file