From 006f3ccbe985b084e763431250fac20c7a876b6b Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Wed, 5 Mar 2014 19:32:10 +0400 Subject: [PATCH] Added/updated tests for LexicalScope. --- .../basic/IfWithUninitialized.instructions | 14 +- .../basic/InitializedNotDeclared.instructions | 6 +- .../basic/UsageInFunctionLiteral.instructions | 14 +- .../VariablesInitialization.instructions | 14 +- .../basic/VariablesUsage.instructions | 14 +- .../lexicalScopes/doWhileScope.instructions | 38 ++ .../lexicalScopes/doWhileScope.kt | 7 + .../lexicalScopes/forScope.instructions | 41 ++ .../cfg-variables/lexicalScopes/forScope.kt | 7 + .../functionLiteralScope.instructions | 57 +++ .../lexicalScopes/functionLiteralScope.kt | 8 + .../lexicalScopes/ifScope.instructions | 40 ++ .../cfg-variables/lexicalScopes/ifScope.kt | 10 + .../lexicalScopes/localClass.instructions | 55 +++ .../cfg-variables/lexicalScopes/localClass.kt | 12 + .../localFunctionScope.instructions | 53 +++ .../lexicalScopes/localFunctionScope.kt | 8 + ...localFunctionScopeWithoutBody.instructions | 46 ++ .../localFunctionScopeWithoutBody.kt | 6 + .../lexicalScopes/localObject.instructions | 53 +++ .../lexicalScopes/localObject.kt | 12 + .../objectLiteralScope.instructions | 57 +++ .../lexicalScopes/objectLiteralScope.kt | 12 + .../propertyAccessorScope.instructions | 66 +++ .../lexicalScopes/propertyAccessorScope.kt | 11 + .../lexicalScopes/tryScope.instructions | 59 +++ .../cfg-variables/lexicalScopes/tryScope.kt | 13 + .../lexicalScopes/whileScope.instructions | 33 ++ .../cfg-variables/lexicalScopes/whileScope.kt | 7 + .../cfg/arrays/ArrayAccess.instructions | 6 +- .../cfg/arrays/ArrayOfFunctions.instructions | 6 +- .../arrays/arrayAccessExpression.instructions | 10 +- .../testData/cfg/arrays/arraySet.instructions | 6 +- .../arrays/arraySetPlusAssign.instructions | 6 +- .../testData/cfg/basic/Basic.instructions | 30 +- .../cfg/basic/EmptyFunction.instructions | 6 +- .../cfg/basic/ShortFunction.instructions | 2 +- .../controlStructures/Finally.instructions | 402 +++++++++--------- .../FinallyTestCopy.instructions | 136 +++--- .../cfg/controlStructures/For.instructions | 18 +- .../cfg/controlStructures/If.instructions | 38 +- .../OnlyWhileInFunctionBody.instructions | 18 +- .../returnsInWhen.instructions | 6 +- .../cfg/conventions/equals.instructions | 10 +- .../incrementAtTheEnd.instructions | 6 +- .../cfg/conventions/invoke.instructions | 6 +- .../cfg/conventions/notEqual.instructions | 10 +- .../cfg/deadCode/DeadCode.instructions | 6 +- .../cfg/deadCode/returnInElvis.instructions | 6 +- .../cfg/deadCode/stringTemplate.instructions | 6 +- .../AnonymousInitializers.instructions | 10 +- .../unusedFunctionLiteral.instructions | 12 +- .../functions/FailFunction.instructions | 6 +- .../functions/typeParameter.instructions | 6 +- .../local/LocalDeclarations.instructions | 80 ++-- .../local/ObjectExpression.instructions | 14 +- .../local/localClass.instructions | 18 +- .../local/localProperty.instructions | 12 +- .../multiDeclaration/MultiDecl.instructions | 12 +- .../multiDeclarationWithError.instructions | 6 +- .../properties/DelegatedProperty.instructions | 8 +- .../backingFieldAccess.instructions | 6 +- ...backingFieldQualifiedWithThis.instructions | 4 +- .../cfg/expressions/Assignments.instructions | 8 +- .../cfg/expressions/LazyBooleans.instructions | 14 +- .../ReturnFromExpression.instructions | 6 +- .../expressions/assignmentToThis.instructions | 6 +- .../chainedQualifiedExpression.instructions | 52 +-- .../expressionAsFunction.instructions | 6 +- .../expressions/propertySafeCall.instructions | 6 +- ...fiedExpressionWithoutSelector.instructions | 6 +- .../expressions/thisExpression.instructions | 6 +- .../cfg/expressions/unresolved.instructions | 6 +- .../unusedExpressionSimpleName.instructions | 6 +- .../cfg/tailCalls/finally.instructions | 16 +- .../tailCalls/finallyWithReturn.instructions | 16 +- .../testData/cfg/tailCalls/sum.instructions | 6 +- .../testData/cfg/tailCalls/try.instructions | 16 +- .../tailCalls/tryCatchFinally.instructions | 24 +- .../jet/cfg/AbstractPseudocodeTest.java | 30 +- .../jet/cfg/DataFlowTestGenerated.java | 71 +++- 81 files changed, 1404 insertions(+), 604 deletions(-) create mode 100644 compiler/testData/cfg-variables/lexicalScopes/doWhileScope.instructions create mode 100644 compiler/testData/cfg-variables/lexicalScopes/doWhileScope.kt create mode 100644 compiler/testData/cfg-variables/lexicalScopes/forScope.instructions create mode 100644 compiler/testData/cfg-variables/lexicalScopes/forScope.kt create mode 100644 compiler/testData/cfg-variables/lexicalScopes/functionLiteralScope.instructions create mode 100644 compiler/testData/cfg-variables/lexicalScopes/functionLiteralScope.kt create mode 100644 compiler/testData/cfg-variables/lexicalScopes/ifScope.instructions create mode 100644 compiler/testData/cfg-variables/lexicalScopes/ifScope.kt create mode 100644 compiler/testData/cfg-variables/lexicalScopes/localClass.instructions create mode 100644 compiler/testData/cfg-variables/lexicalScopes/localClass.kt create mode 100644 compiler/testData/cfg-variables/lexicalScopes/localFunctionScope.instructions create mode 100644 compiler/testData/cfg-variables/lexicalScopes/localFunctionScope.kt create mode 100644 compiler/testData/cfg-variables/lexicalScopes/localFunctionScopeWithoutBody.instructions create mode 100644 compiler/testData/cfg-variables/lexicalScopes/localFunctionScopeWithoutBody.kt create mode 100644 compiler/testData/cfg-variables/lexicalScopes/localObject.instructions create mode 100644 compiler/testData/cfg-variables/lexicalScopes/localObject.kt create mode 100644 compiler/testData/cfg-variables/lexicalScopes/objectLiteralScope.instructions create mode 100644 compiler/testData/cfg-variables/lexicalScopes/objectLiteralScope.kt create mode 100644 compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.instructions create mode 100644 compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.kt create mode 100644 compiler/testData/cfg-variables/lexicalScopes/tryScope.instructions create mode 100644 compiler/testData/cfg-variables/lexicalScopes/tryScope.kt create mode 100644 compiler/testData/cfg-variables/lexicalScopes/whileScope.instructions create mode 100644 compiler/testData/cfg-variables/lexicalScopes/whileScope.kt diff --git a/compiler/testData/cfg-variables/basic/IfWithUninitialized.instructions b/compiler/testData/cfg-variables/basic/IfWithUninitialized.instructions index 409fa783f68..a294760d9b9 100644 --- a/compiler/testData/cfg-variables/basic/IfWithUninitialized.instructions +++ b/compiler/testData/cfg-variables/basic/IfWithUninitialized.instructions @@ -10,8 +10,8 @@ fun foo() { } --------------------- L0: - INIT: in: {} out: {} - mark({ val b: Boolean if (1 < 2) { use(b) } else { b = true } }) + 1 INIT: in: {} out: {} + 2 mark({ val b: Boolean if (1 < 2) { use(b) } else { b = true } }) v(val b: Boolean) INIT: in: {} out: {b=D} mark(if (1 < 2) { use(b) } else { b = true }) INIT: in: {b=D} out: {b=D} mark(1 < 2) @@ -19,18 +19,18 @@ L0: r(2) call(<, compareTo) jf(L2) - mark({ use(b) }) + 3 mark({ use(b) }) mark(use(b)) USE: in: {b=READ} out: {b=READ} r(b) USE: in: {} out: {b=READ} call(use, use) - jmp(L3) USE: in: {} out: {} + 2 jmp(L3) USE: in: {} out: {} L2: - mark({ b = true }) + 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} L1: L3: - INIT: in: {b=D} out: {b=D} + 1 INIT: in: {b=D} out: {b=D} error: INIT: in: {} out: {} sink: @@ -40,7 +40,7 @@ sink: fun use(vararg a: Any?) = a --------------------- L0: - INIT: in: {} out: {} + 1 INIT: in: {} out: {} v(vararg a: Any?) INIT: in: {} out: {a=D} w(a) INIT: in: {a=D} out: {a=ID} USE: in: {a=READ} out: {a=READ} r(a) INIT: in: {a=ID} out: {a=ID} USE: in: {} out: {a=READ} diff --git a/compiler/testData/cfg-variables/basic/InitializedNotDeclared.instructions b/compiler/testData/cfg-variables/basic/InitializedNotDeclared.instructions index bf2cfbe26d7..23fa25d2b57 100644 --- a/compiler/testData/cfg-variables/basic/InitializedNotDeclared.instructions +++ b/compiler/testData/cfg-variables/basic/InitializedNotDeclared.instructions @@ -7,11 +7,11 @@ class A { } --------------------- L0: - INIT: in: {} out: {} - mark({ x = 1 }) + 1 INIT: in: {} out: {} + 2 mark({ x = 1 }) r(1) USE: in: {x=ONLY_WRITTEN_NEVER_READ} out: {x=ONLY_WRITTEN_NEVER_READ} w(x) INIT: in: {} out: {x=I} USE: in: {} out: {x=ONLY_WRITTEN_NEVER_READ} - v(val x: Int) INIT: in: {x=I} out: {x=ID} + 1 v(val x: Int) INIT: in: {x=I} out: {x=ID} L1: INIT: in: {x=ID} out: {x=ID} error: diff --git a/compiler/testData/cfg-variables/basic/UsageInFunctionLiteral.instructions b/compiler/testData/cfg-variables/basic/UsageInFunctionLiteral.instructions index b4cb6c42657..456697979a0 100644 --- a/compiler/testData/cfg-variables/basic/UsageInFunctionLiteral.instructions +++ b/compiler/testData/cfg-variables/basic/UsageInFunctionLiteral.instructions @@ -8,8 +8,8 @@ fun foo() { } --------------------- L0: - INIT: in: {} out: {} - mark({ val a = 1 val f = { (x: Int) -> val y = x + a use(a) } }) + 1 INIT: in: {} out: {} + 2 mark({ val a = 1 val f = { (x: Int) -> val y = x + a use(a) } }) 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} @@ -21,7 +21,7 @@ L2: r({ (x: Int) -> val y = x + a use(a) }) INIT: in: {a=ID, f=D} out: {a=ID, f=D} w(f) INIT: in: {a=ID, f=D} out: {a=ID, f=ID} L1: - INIT: in: {a=ID, f=ID} out: {a=ID, f=ID} + 1 INIT: in: {a=ID, f=ID} out: {a=ID, f=ID} error: INIT: in: {} out: {} sink: @@ -34,10 +34,10 @@ sink: } --------------------- L3: - INIT: in: {a=ID, f=D} out: {a=ID, f=D} + 3 INIT: in: {a=ID, f=D} out: {a=ID, f=D} v(x: Int) INIT: in: {a=ID, f=D} out: {a=ID, f=D, x=D} w(x) INIT: in: {a=ID, f=D, x=D} out: {a=ID, f=D, x=ID} - mark(val y = x + a use(a)) INIT: in: {a=ID, f=D, x=ID} out: {a=ID, f=D, x=ID} + 4 mark(val y = x + a use(a)) INIT: in: {a=ID, f=D, x=ID} out: {a=ID, f=D, x=ID} v(val y = x + a) INIT: in: {a=ID, f=D, x=ID} out: {a=ID, f=D, x=ID, y=D} mark(x + a) INIT: in: {a=ID, f=D, x=ID, y=D} out: {a=ID, f=D, x=ID, y=D} USE: in: {a=READ, x=READ} out: {a=READ, x=READ} r(x) USE: in: {a=READ} out: {a=READ, x=READ} @@ -48,7 +48,7 @@ L3: r(a) USE: in: {} out: {a=READ} call(use, use) L4: - + 3 error: INIT: in: {} out: {} sink: @@ -58,7 +58,7 @@ sink: fun use(vararg a: Any?) = a --------------------- L0: - INIT: in: {} out: {} + 1 INIT: in: {} out: {} v(vararg a: Any?) INIT: in: {} out: {a=D} w(a) INIT: in: {a=D} out: {a=ID} USE: in: {a=READ} out: {a=READ} r(a) INIT: in: {a=ID} out: {a=ID} USE: in: {} out: {a=READ} diff --git a/compiler/testData/cfg-variables/basic/VariablesInitialization.instructions b/compiler/testData/cfg-variables/basic/VariablesInitialization.instructions index 088e88a134a..c064769b6f9 100644 --- a/compiler/testData/cfg-variables/basic/VariablesInitialization.instructions +++ b/compiler/testData/cfg-variables/basic/VariablesInitialization.instructions @@ -7,8 +7,8 @@ fun foo() { } --------------------- L0: - INIT: in: {} out: {} - mark({ val a = 1 val b: Int b = 2 42 }) + 1 INIT: in: {} out: {} + 2 mark({ val a = 1 val b: Int b = 2 42 }) 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} @@ -17,7 +17,7 @@ L0: w(b) INIT: in: {a=ID, b=D} out: {a=ID, b=ID} USE: in: {} out: {b=ONLY_WRITTEN_NEVER_READ} r(42) INIT: in: {a=ID, b=ID} out: {a=ID, b=ID} L1: - + 1 error: INIT: in: {} out: {} sink: @@ -31,10 +31,10 @@ fun bar(foo: Foo) { } --------------------- L0: - INIT: in: {} out: {} + 1 INIT: in: {} out: {} v(foo: Foo) INIT: in: {} out: {foo=D} w(foo) INIT: in: {foo=D} out: {foo=ID} - mark({ foo.c foo.c = 2 42 }) INIT: in: {foo=ID} out: {foo=ID} + 2 mark({ foo.c foo.c = 2 42 }) INIT: in: {foo=ID} out: {foo=ID} mark(foo.c) r(foo) USE: in: {c=READ, foo=READ} out: {c=READ, foo=READ} r(c) USE: in: {c=ONLY_WRITTEN_NEVER_READ, foo=READ} out: {c=READ, foo=READ} @@ -43,7 +43,7 @@ L0: w(foo.c) INIT: in: {foo=ID} out: {c=I, foo=ID} USE: in: {} out: {c=ONLY_WRITTEN_NEVER_READ} r(42) INIT: in: {c=I, foo=ID} out: {c=I, foo=ID} L1: - + 1 error: INIT: in: {} out: {} sink: @@ -55,7 +55,7 @@ trait Foo { } --------------------- L0: - INIT: in: {} out: {} + 1 INIT: in: {} out: {} v(var c: Int) INIT: in: {} out: {c=D} L1: INIT: in: {c=D} out: {c=D} diff --git a/compiler/testData/cfg-variables/basic/VariablesUsage.instructions b/compiler/testData/cfg-variables/basic/VariablesUsage.instructions index d4c3fb9c635..ec39747c79b 100644 --- a/compiler/testData/cfg-variables/basic/VariablesUsage.instructions +++ b/compiler/testData/cfg-variables/basic/VariablesUsage.instructions @@ -7,8 +7,8 @@ fun foo() { } --------------------- L0: - INIT: in: {} out: {} - mark({ var a = 1 use(a) a = 2 use(a) }) + 1 INIT: in: {} out: {} + 2 mark({ var a = 1 use(a) a = 2 use(a) }) v(var 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} @@ -21,7 +21,7 @@ L0: r(a) USE: in: {} out: {a=READ} call(use, use) L1: - + 1 error: INIT: in: {} out: {} sink: @@ -34,13 +34,13 @@ fun bar() { } --------------------- L0: - INIT: in: {} out: {} - mark({ val b: Int b = 3 }) + 1 INIT: in: {} out: {} + 2 mark({ val b: Int b = 3 }) v(val b: Int) INIT: in: {} out: {b=D} r(3) INIT: in: {b=D} out: {b=D} 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} L1: - INIT: in: {b=ID} out: {b=ID} + 1 INIT: in: {b=ID} out: {b=ID} error: INIT: in: {} out: {} sink: @@ -50,7 +50,7 @@ sink: fun use(a: Int) = a --------------------- L0: - INIT: in: {} out: {} + 1 INIT: in: {} out: {} v(a: Int) INIT: in: {} out: {a=D} w(a) INIT: in: {a=D} out: {a=ID} USE: in: {a=READ} out: {a=READ} r(a) INIT: in: {a=ID} out: {a=ID} USE: in: {} out: {a=READ} diff --git a/compiler/testData/cfg-variables/lexicalScopes/doWhileScope.instructions b/compiler/testData/cfg-variables/lexicalScopes/doWhileScope.instructions new file mode 100644 index 00000000000..891117eae2e --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/doWhileScope.instructions @@ -0,0 +1,38 @@ +== foo == +fun foo() { + "before" + do { + var a = 2 + } while (a > 0) + "after" +} +--------------------- +L0: + 1 INIT: in: {} out: {} + 2 mark({ "before" do { var a = 2 } while (a > 0) "after" }) + mark("before") + r("before") + 3 mark(do { var a = 2 } while (a > 0)) +L2 [loop entry point]: +L4 [body entry point]: + mark({ var a = 2 }) INIT: in: {a=ID} out: {a=ID} + v(var a = 2) + r(2) + w(a) +L5 [condition entry point]: + mark(a > 0) + r(a) + r(0) + call(>, compareTo) + jt(L2 [loop entry point]) USE: in: {a=READ} out: {a=READ} +L3 [loop exit point]: + read (Unit) + 2 mark("after") + r("after") +L1: + 1 +error: + INIT: in: {} out: {} +sink: + INIT: in: {a=ID} out: {a=ID} USE: in: {} out: {} +===================== diff --git a/compiler/testData/cfg-variables/lexicalScopes/doWhileScope.kt b/compiler/testData/cfg-variables/lexicalScopes/doWhileScope.kt new file mode 100644 index 00000000000..6525f3b387d --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/doWhileScope.kt @@ -0,0 +1,7 @@ +fun foo() { + "before" + do { + var a = 2 + } while (a > 0) + "after" +} \ No newline at end of file diff --git a/compiler/testData/cfg-variables/lexicalScopes/forScope.instructions b/compiler/testData/cfg-variables/lexicalScopes/forScope.instructions new file mode 100644 index 00000000000..aeb4c2bb01c --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/forScope.instructions @@ -0,0 +1,41 @@ +== foo == +fun foo() { + "before" + for (i in 1..10) { + val a = i + } + "after" +} +--------------------- +L0: + 1 INIT: in: {} out: {} + 2 mark({ "before" for (i in 1..10) { val a = i } "after" }) + mark("before") + r("before") + 3 mark(for (i in 1..10) { val a = i }) + mark(1..10) + r(1) + r(10) + call(.., rangeTo) + v(i) INIT: in: {} out: {i=D} + w(i) INIT: in: {i=D} out: {i=ID} +L3: + jmp?(L2) INIT: in: {i=ID} out: {i=ID} +L4 [loop entry point]: +L5 [body entry point]: + 4 mark({ val a = i }) INIT: in: {a=ID, i=ID} out: {a=ID, i=ID} + v(val a = i) + r(i) + w(a) + 3 jmp?(L4 [loop entry point]) USE: in: {i=READ} out: {i=READ} +L2: + read (Unit) + 2 mark("after") + r("after") +L1: + 1 +error: + INIT: in: {} out: {} +sink: + INIT: in: {a=ID, i=ID} out: {a=ID, i=ID} USE: in: {} out: {} +===================== diff --git a/compiler/testData/cfg-variables/lexicalScopes/forScope.kt b/compiler/testData/cfg-variables/lexicalScopes/forScope.kt new file mode 100644 index 00000000000..f4cab995f4e --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/forScope.kt @@ -0,0 +1,7 @@ +fun foo() { + "before" + for (i in 1..10) { + val a = i + } + "after" +} \ No newline at end of file diff --git a/compiler/testData/cfg-variables/lexicalScopes/functionLiteralScope.instructions b/compiler/testData/cfg-variables/lexicalScopes/functionLiteralScope.instructions new file mode 100644 index 00000000000..0d78c540acc --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/functionLiteralScope.instructions @@ -0,0 +1,57 @@ +== foo == +fun foo() { + "before" + val b = 1 + val f = { (x: Int) -> + val a = x + b + } + "after" +} +--------------------- +L0: + 1 INIT: in: {} out: {} + 2 mark({ "before" val b = 1 val f = { (x: Int) -> val a = x + b } "after" }) + mark("before") + r("before") + 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} + 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) + d({ (x: Int) -> val a = x + b }) INIT: in: {a=ID, b=ID, f=D, x=ID} out: {a=ID, b=ID, f=D, x=ID} USE: in: {b=READ, x=READ} out: {b=READ, x=READ} +L2: + r({ (x: Int) -> val a = x + b }) INIT: in: {b=ID, f=D} out: {b=ID, f=D} + 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} + r("after") +L1: + 1 +error: + INIT: in: {} out: {} +sink: + INIT: in: {a=ID, b=ID, f=D, x=ID} out: {a=ID, b=ID, f=D, x=ID} USE: in: {} out: {} +===================== +== anonymous_0 == +{ (x: Int) -> + val a = x + b + } +--------------------- +L3: + 3 INIT: in: {b=ID, f=D} out: {b=ID, f=D} + v(x: Int) INIT: in: {b=ID, f=D} out: {b=ID, f=D, x=D} + w(x) INIT: in: {b=ID, f=D, x=D} out: {b=ID, f=D, x=ID} + 4 mark(val a = x + b) INIT: in: {b=ID, f=D, x=ID} out: {b=ID, f=D, x=ID} + v(val a = x + b) INIT: in: {b=ID, f=D, x=ID} out: {a=D, b=ID, f=D, x=ID} + mark(x + b) INIT: in: {a=D, b=ID, f=D, x=ID} out: {a=D, b=ID, f=D, x=ID} USE: in: {b=READ, x=READ} out: {b=READ, x=READ} + r(x) USE: in: {b=READ} out: {b=READ, x=READ} + r(b) USE: in: {} out: {b=READ} + call(+, plus) + w(a) INIT: in: {a=D, b=ID, f=D, x=ID} out: {a=ID, b=ID, f=D, x=ID} +L4: + 3 INIT: in: {a=ID, b=ID, f=D, x=ID} out: {a=ID, b=ID, f=D, x=ID} +error: + INIT: in: {} out: {} +sink: + INIT: in: {a=ID, b=ID, f=D, x=ID} out: {a=ID, b=ID, f=D, x=ID} USE: in: {} out: {} +===================== diff --git a/compiler/testData/cfg-variables/lexicalScopes/functionLiteralScope.kt b/compiler/testData/cfg-variables/lexicalScopes/functionLiteralScope.kt new file mode 100644 index 00000000000..12b2fde1678 --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/functionLiteralScope.kt @@ -0,0 +1,8 @@ +fun foo() { + "before" + val b = 1 + val f = { (x: Int) -> + val a = x + b + } + "after" +} \ No newline at end of file diff --git a/compiler/testData/cfg-variables/lexicalScopes/ifScope.instructions b/compiler/testData/cfg-variables/lexicalScopes/ifScope.instructions new file mode 100644 index 00000000000..bb9c40c699d --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/ifScope.instructions @@ -0,0 +1,40 @@ +== foo == +fun foo() { + "before" + if (true) { + val a = 1 + } + else { + val b = 2 + } + "after" +} +--------------------- +L0: + 1 INIT: in: {} out: {} + 2 mark({ "before" if (true) { val a = 1 } else { val b = 2 } "after" }) + mark("before") + r("before") + mark(if (true) { val a = 1 } else { val b = 2 }) + r(true) + jf(L2) + 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: {a=ID} out: {a=ID} +L2: + 3 mark({ val b = 2 }) INIT: in: {} out: {} + 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: + 2 mark("after") INIT: in: {a=ID, b=ID} out: {a=ID, b=ID} + r("after") +L1: + 1 +error: + INIT: in: {} out: {} +sink: + INIT: in: {a=ID, b=ID} out: {a=ID, b=ID} USE: in: {} out: {} +===================== diff --git a/compiler/testData/cfg-variables/lexicalScopes/ifScope.kt b/compiler/testData/cfg-variables/lexicalScopes/ifScope.kt new file mode 100644 index 00000000000..1905d7f0604 --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/ifScope.kt @@ -0,0 +1,10 @@ +fun foo() { + "before" + if (true) { + val a = 1 + } + else { + val b = 2 + } + "after" +} \ No newline at end of file diff --git a/compiler/testData/cfg-variables/lexicalScopes/localClass.instructions b/compiler/testData/cfg-variables/lexicalScopes/localClass.instructions new file mode 100644 index 00000000000..1cfe2b00aa4 --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/localClass.instructions @@ -0,0 +1,55 @@ +== foo == +fun foo() { + "before" + class A(val x: Int) { + { + val a = x + } + fun foo() { + val b = x + } + } + "after" +} +--------------------- +L0: + 1 INIT: in: {} out: {} + 2 mark({ "before" class A(val x: Int) { { val a = x } fun foo() { val b = x } } "after" }) + mark("before") + r("before") + v(val x: Int) INIT: in: {} out: {x=D} + w(x) INIT: in: {x=D} out: {x=ID} + 3 mark({ val a = x }) INIT: in: {x=ID} out: {x=ID} + v(val a = x) INIT: in: {x=ID} out: {a=D, x=ID} + r(x) INIT: in: {a=D, x=ID} out: {a=D, x=ID} + w(a) INIT: in: {a=D, x=ID} out: {a=ID, x=ID} + 2 jmp?(L2) INIT: in: {a=ID, x=ID} out: {a=ID, x=ID} + d(fun foo() { val b = x }) INIT: in: {a=ID, b=ID, x=ID} out: {a=ID, b=ID, x=ID} USE: in: {x=READ} out: {x=READ} +L2: + mark("after") INIT: in: {a=ID, x=ID} out: {a=ID, x=ID} + r("after") +L1: + 1 +error: + INIT: in: {} out: {} +sink: + INIT: in: {a=ID, b=ID, x=ID} out: {a=ID, b=ID, x=ID} USE: in: {} out: {} +===================== +== foo == +fun foo() { + val b = x + } +--------------------- +L3: + 3 INIT: in: {a=ID, x=ID} out: {a=ID, x=ID} + 4 mark({ val b = x }) + v(val b = x) INIT: in: {a=ID, x=ID} out: {a=ID, b=D, x=ID} USE: in: {x=READ} out: {x=READ} + r(x) INIT: in: {a=ID, b=D, x=ID} out: {a=ID, b=D, x=ID} USE: in: {} out: {x=READ} + w(b) INIT: in: {a=ID, b=D, x=ID} out: {a=ID, b=ID, x=ID} +L4: + 3 INIT: in: {a=ID, b=ID, x=ID} out: {a=ID, b=ID, x=ID} +error: + INIT: in: {} out: {} +sink: + INIT: in: {a=ID, b=ID, x=ID} out: {a=ID, b=ID, x=ID} USE: in: {} out: {} +===================== diff --git a/compiler/testData/cfg-variables/lexicalScopes/localClass.kt b/compiler/testData/cfg-variables/lexicalScopes/localClass.kt new file mode 100644 index 00000000000..fa933c2c7e1 --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/localClass.kt @@ -0,0 +1,12 @@ +fun foo() { + "before" + class A(val x: Int) { + { + val a = x + } + fun foo() { + val b = x + } + } + "after" +} \ No newline at end of file diff --git a/compiler/testData/cfg-variables/lexicalScopes/localFunctionScope.instructions b/compiler/testData/cfg-variables/lexicalScopes/localFunctionScope.instructions new file mode 100644 index 00000000000..3f68ef0d30b --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/localFunctionScope.instructions @@ -0,0 +1,53 @@ +== foo == +fun foo() { + "before" + val b = 1 + fun local(x: Int) { + val a = x + b + } + "after" +} +--------------------- +L0: + 1 INIT: in: {} out: {} + 2 mark({ "before" val b = 1 fun local(x: Int) { val a = x + b } "after" }) + mark("before") + r("before") + 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} + d(fun local(x: Int) { val a = x + b }) INIT: in: {a=ID, b=ID, x=ID} out: {a=ID, b=ID, x=ID} USE: in: {b=READ, x=READ} out: {b=READ, x=READ} +L2: + mark("after") INIT: in: {b=ID} out: {b=ID} + r("after") +L1: + 1 +error: + INIT: in: {} out: {} +sink: + INIT: in: {a=ID, b=ID, x=ID} out: {a=ID, b=ID, x=ID} USE: in: {} out: {} +===================== +== local == +fun local(x: Int) { + val a = x + b + } +--------------------- +L3: + 3 INIT: in: {b=ID} out: {b=ID} + v(x: Int) INIT: in: {b=ID} out: {b=ID, x=D} + w(x) INIT: in: {b=ID, x=D} out: {b=ID, x=ID} + 4 mark({ val a = x + b }) INIT: in: {b=ID, x=ID} out: {b=ID, x=ID} + v(val a = x + b) INIT: in: {b=ID, x=ID} out: {a=D, b=ID, x=ID} + mark(x + b) INIT: in: {a=D, b=ID, x=ID} out: {a=D, b=ID, x=ID} USE: in: {b=READ, x=READ} out: {b=READ, x=READ} + r(x) USE: in: {b=READ} out: {b=READ, x=READ} + r(b) USE: in: {} out: {b=READ} + call(+, plus) + w(a) INIT: in: {a=D, b=ID, x=ID} out: {a=ID, b=ID, x=ID} +L4: + 3 INIT: in: {a=ID, b=ID, x=ID} out: {a=ID, b=ID, x=ID} +error: + INIT: in: {} out: {} +sink: + INIT: in: {a=ID, b=ID, x=ID} out: {a=ID, b=ID, x=ID} USE: in: {} out: {} +===================== diff --git a/compiler/testData/cfg-variables/lexicalScopes/localFunctionScope.kt b/compiler/testData/cfg-variables/lexicalScopes/localFunctionScope.kt new file mode 100644 index 00000000000..3b3935a7b72 --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/localFunctionScope.kt @@ -0,0 +1,8 @@ +fun foo() { + "before" + val b = 1 + fun local(x: Int) { + val a = x + b + } + "after" +} \ No newline at end of file diff --git a/compiler/testData/cfg-variables/lexicalScopes/localFunctionScopeWithoutBody.instructions b/compiler/testData/cfg-variables/lexicalScopes/localFunctionScopeWithoutBody.instructions new file mode 100644 index 00000000000..7e61e8f59ec --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/localFunctionScopeWithoutBody.instructions @@ -0,0 +1,46 @@ +== foo == +fun foo() { + "before" + val b = 1 + fun local(x: Int) = x + b + "after" +} +--------------------- +L0: + 1 INIT: in: {} out: {} USE: in: {} out: {} + 2 mark({ "before" val b = 1 fun local(x: Int) = x + b "after" }) + mark("before") + r("before") + 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} + d(fun local(x: Int) = x + b) USE: in: {b=READ} out: {b=READ} +L2: + mark("after") + r("after") +L1: + 1 INIT: in: {} out: {} +error: + +sink: + USE: in: {} out: {} +===================== +== local == +fun local(x: Int) = x + b +--------------------- +L3: + 3 INIT: in: {} out: {} + v(x: Int) INIT: in: {} out: {x=D} + w(x) INIT: in: {x=D} out: {x=ID} + mark(x + b) INIT: in: {x=ID} out: {x=ID} USE: in: {b=READ, x=READ} out: {b=READ, x=READ} + r(x) USE: in: {b=READ} out: {b=READ, x=READ} + r(b) USE: in: {} out: {b=READ} + call(+, plus) +L4: + +error: + INIT: in: {} out: {} +sink: + INIT: in: {x=ID} out: {x=ID} USE: in: {} out: {} +===================== diff --git a/compiler/testData/cfg-variables/lexicalScopes/localFunctionScopeWithoutBody.kt b/compiler/testData/cfg-variables/lexicalScopes/localFunctionScopeWithoutBody.kt new file mode 100644 index 00000000000..cbf49ec202d --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/localFunctionScopeWithoutBody.kt @@ -0,0 +1,6 @@ +fun foo() { + "before" + val b = 1 + fun local(x: Int) = x + b + "after" +} \ No newline at end of file diff --git a/compiler/testData/cfg-variables/lexicalScopes/localObject.instructions b/compiler/testData/cfg-variables/lexicalScopes/localObject.instructions new file mode 100644 index 00000000000..433d51bd04b --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/localObject.instructions @@ -0,0 +1,53 @@ +== foo == +fun foo() { + "before" + object A { + { + val a = 1 + } + fun foo() { + val b = 2 + } + } + "after" +} +--------------------- +L0: + 1 INIT: in: {} out: {} + 2 mark({ "before" object A { { val a = 1 } fun foo() { val b = 2 } } "after" }) + mark("before") + r("before") + 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?(L2) INIT: in: {a=ID} out: {a=ID} + d(fun foo() { val b = 2 }) INIT: in: {a=ID, b=ID} out: {a=ID, b=ID} +L2: + mark("after") INIT: in: {a=ID} out: {a=ID} + r("after") +L1: + 1 +error: + INIT: in: {} out: {} +sink: + INIT: in: {a=ID, b=ID} out: {a=ID, b=ID} USE: in: {} out: {} +===================== +== foo == +fun foo() { + val b = 2 + } +--------------------- +L3: + 3 INIT: in: {a=ID} out: {a=ID} + 4 mark({ val b = 2 }) + v(val b = 2) INIT: in: {a=ID} out: {a=ID, b=D} + r(2) INIT: in: {a=ID, b=D} out: {a=ID, b=D} + w(b) INIT: in: {a=ID, b=D} out: {a=ID, b=ID} +L4: + 3 INIT: in: {a=ID, b=ID} out: {a=ID, b=ID} +error: + INIT: in: {} out: {} +sink: + INIT: in: {a=ID, b=ID} out: {a=ID, b=ID} USE: in: {} out: {} +===================== diff --git a/compiler/testData/cfg-variables/lexicalScopes/localObject.kt b/compiler/testData/cfg-variables/lexicalScopes/localObject.kt new file mode 100644 index 00000000000..5e7152e2ac7 --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/localObject.kt @@ -0,0 +1,12 @@ +fun foo() { + "before" + object A { + { + val a = 1 + } + fun foo() { + val b = 2 + } + } + "after" +} \ No newline at end of file diff --git a/compiler/testData/cfg-variables/lexicalScopes/objectLiteralScope.instructions b/compiler/testData/cfg-variables/lexicalScopes/objectLiteralScope.instructions new file mode 100644 index 00000000000..8ca2a2d055b --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/objectLiteralScope.instructions @@ -0,0 +1,57 @@ +== foo == +fun foo() { + "before" + val bar = object { + { + val x = 1 + } + fun foo() { + val a = 2 + } + } + "after" +} +--------------------- +L0: + 1 INIT: in: {} out: {} + 2 mark({ "before" val bar = object { { val x = 1 } fun foo() { val a = 2 } } "after" }) + mark("before") + r("before") + v(val bar = object { { val x = 1 } fun foo() { val a = 2 } }) INIT: in: {} out: {bar=D} + mark(object { { val x = 1 } fun foo() { val a = 2 } }) INIT: in: {bar=D} out: {bar=D} + 3 mark({ val x = 1 }) + 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, x=ID} out: {bar=D, x=ID} + d(fun foo() { val a = 2 }) INIT: in: {a=ID, bar=D, x=ID} out: {a=ID, bar=D, x=ID} +L2: + r(object { { val x = 1 } fun foo() { val a = 2 } }) INIT: in: {bar=D, x=ID} out: {bar=D, x=ID} + w(bar) INIT: in: {bar=D, x=ID} out: {bar=ID, x=ID} + mark("after") INIT: in: {bar=ID, x=ID} out: {bar=ID, x=ID} + r("after") +L1: + 1 +error: + INIT: in: {} out: {} +sink: + INIT: in: {a=ID, bar=D, x=ID} out: {a=ID, bar=D, x=ID} USE: in: {} out: {} +===================== +== foo == +fun foo() { + val a = 2 + } +--------------------- +L3: + 3 INIT: in: {bar=D, x=ID} out: {bar=D, x=ID} + 4 mark({ val a = 2 }) + v(val a = 2) INIT: in: {bar=D, x=ID} out: {a=D, bar=D, x=ID} + r(2) INIT: in: {a=D, bar=D, x=ID} out: {a=D, bar=D, x=ID} + w(a) INIT: in: {a=D, bar=D, x=ID} out: {a=ID, bar=D, x=ID} +L4: + 3 INIT: in: {a=ID, bar=D, x=ID} out: {a=ID, bar=D, x=ID} +error: + INIT: in: {} out: {} +sink: + INIT: in: {a=ID, bar=D, x=ID} out: {a=ID, bar=D, x=ID} USE: in: {} out: {} +===================== diff --git a/compiler/testData/cfg-variables/lexicalScopes/objectLiteralScope.kt b/compiler/testData/cfg-variables/lexicalScopes/objectLiteralScope.kt new file mode 100644 index 00000000000..b1cb19aa815 --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/objectLiteralScope.kt @@ -0,0 +1,12 @@ +fun foo() { + "before" + val bar = object { + { + val x = 1 + } + fun foo() { + val a = 2 + } + } + "after" +} \ No newline at end of file diff --git a/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.instructions b/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.instructions new file mode 100644 index 00000000000..6a6f3d7b1b8 --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.instructions @@ -0,0 +1,66 @@ +== foo == +fun foo() { + class A { + var a : Int + get() { + return $a + } + set(v: Int) { + $a = v + } + } +} +--------------------- +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} + d(get() { return $a }) USE: in: {a=READ} out: {a=READ} +L2: + jmp?(L5) + d(set(v: Int) { $a = v }) USE: in: {a=ONLY_WRITTEN_NEVER_READ} out: {a=ONLY_WRITTEN_NEVER_READ} +L1: +L5: + 1 INIT: in: {} out: {} +error: + +sink: + USE: in: {} out: {} +===================== +== get_a == +get() { + return $a + } +--------------------- +L3: + 3 INIT: in: {} out: {} + 4 mark({ return $a }) USE: in: {a=READ} out: {a=READ} + r($a) USE: in: {} out: {a=READ} + ret(*) L4 +L4: + 3 +error: + +sink: + USE: in: {} out: {} +===================== +== set_a == +set(v: Int) { + $a = v + } +--------------------- +L6: + 3 INIT: in: {} out: {} + v(v: Int) INIT: in: {} out: {v=D} + w(v) INIT: in: {v=D} out: {v=ID} + 4 mark({ $a = v }) INIT: in: {v=ID} out: {v=ID} USE: in: {a=ONLY_WRITTEN_NEVER_READ, v=READ} out: {a=ONLY_WRITTEN_NEVER_READ, v=READ} + r(v) USE: in: {a=ONLY_WRITTEN_NEVER_READ} out: {a=ONLY_WRITTEN_NEVER_READ, v=READ} + w($a) INIT: in: {v=ID} out: {a=I, v=ID} USE: in: {} out: {a=ONLY_WRITTEN_NEVER_READ} +L7: + 3 INIT: in: {a=I, v=ID} out: {a=I, v=ID} +error: + INIT: in: {} out: {} +sink: + INIT: in: {a=I, v=ID} out: {a=I, v=ID} USE: in: {} out: {} +===================== diff --git a/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.kt b/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.kt new file mode 100644 index 00000000000..c8166ade61c --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.kt @@ -0,0 +1,11 @@ +fun foo() { + class A { + var a : Int + get() { + return $a + } + set(v: Int) { + $a = v + } + } +} diff --git a/compiler/testData/cfg-variables/lexicalScopes/tryScope.instructions b/compiler/testData/cfg-variables/lexicalScopes/tryScope.instructions new file mode 100644 index 00000000000..fb5130f8f01 --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/tryScope.instructions @@ -0,0 +1,59 @@ +== foo == +fun foo() { + "before" + try { + foo() + } + catch (e: Exception) { + val a = e + } + finally { + val a = 1 + } + "after" +} +--------------------- +L0: + 1 INIT: in: {} out: {} + 2 mark({ "before" try { foo() } catch (e: Exception) { val a = e } finally { val a = 1 } "after" }) + mark("before") + r("before") + mark(try { foo() } catch (e: Exception) { val a = e } finally { val a = 1 }) + jmp?(L2 [onException]) USE: in: {e=READ} out: {e=READ} + jmp?(L3 [onExceptionToFinallyBlock]) + 3 mark({ foo() }) + mark(foo()) + call(foo, foo) + 2 jmp(L4 [afterCatches]) USE: in: {} out: {} +L2 [onException]: + 3 v(e: Exception) INIT: in: {} out: {e=D} + w(e) INIT: in: {e=D} out: {e=ID} + 4 mark({ val a = e }) INIT: in: {e=ID} out: {e=ID} + v(val a = e) INIT: in: {e=ID} out: {a=D, e=ID} USE: in: {e=READ} out: {e=READ} + r(e) INIT: in: {a=D, e=ID} out: {a=D, e=ID} USE: in: {} out: {e=READ} + w(a) INIT: in: {a=D, e=ID} out: {a=ID, e=ID} + 3 jmp(L4 [afterCatches]) INIT: in: {a=ID, e=ID} out: {a=ID, e=ID} +L4 [afterCatches]: + 2 jmp(L5 [skipFinallyToErrorBlock]) +L3 [onExceptionToFinallyBlock]: +L6 [start finally]: + 3 mark({ val a = 1 }) INIT: in: {} out: {} + 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} +L7 [finish finally]: + 2 jmp(error) INIT: in: {a=ID} out: {a=ID} +L5 [skipFinallyToErrorBlock]: + 3 mark({ val a = 1 }) INIT: in: {a=ID, e=ID} out: {a=ID, e=ID} + v(val a = 1) INIT: in: {a=ID, e=ID} out: {a=D, a=ID, e=ID} + r(1) INIT: in: {a=D, a=ID, e=ID} out: {a=D, a=ID, e=ID} + w(a) INIT: in: {a=D, a=ID, e=ID} out: {a=ID, a=ID, e=ID} + 2 mark("after") INIT: in: {a=ID, a=ID, e=ID} out: {a=ID, a=ID, e=ID} + r("after") +L1: + 1 +error: + INIT: in: {a=ID} out: {a=ID} +sink: + INIT: in: {a=ID, a=ID, e=ID} out: {a=ID, a=ID, e=ID} USE: in: {} out: {} +===================== diff --git a/compiler/testData/cfg-variables/lexicalScopes/tryScope.kt b/compiler/testData/cfg-variables/lexicalScopes/tryScope.kt new file mode 100644 index 00000000000..c30275aa0df --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/tryScope.kt @@ -0,0 +1,13 @@ +fun foo() { + "before" + try { + foo() + } + catch (e: Exception) { + val a = e + } + finally { + val a = 1 + } + "after" +} \ No newline at end of file diff --git a/compiler/testData/cfg-variables/lexicalScopes/whileScope.instructions b/compiler/testData/cfg-variables/lexicalScopes/whileScope.instructions new file mode 100644 index 00000000000..0bdcfb43dfb --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/whileScope.instructions @@ -0,0 +1,33 @@ +== foo == +fun foo() { + "before" + while (true) { + val a: Int + } + "after" +} +--------------------- +L0: + 1 INIT: in: {} out: {} + 2 mark({ "before" while (true) { val a: Int } "after" }) + mark("before") + r("before") + mark(while (true) { val a: Int }) +L2 [loop entry point]: +L5 [condition entry point]: + r(true) INIT: in: {a=D} out: {a=D} +L4 [body entry point]: + 3 mark({ val a: Int }) + v(val a: Int) + 2 jmp(L2 [loop entry point]) USE: in: {} out: {} +L3 [loop exit point]: +- read (Unit) +- mark("after") +- r("after") +L1: + 1 INIT: in: {} out: {} +error: + +sink: + USE: in: {} out: {} +===================== diff --git a/compiler/testData/cfg-variables/lexicalScopes/whileScope.kt b/compiler/testData/cfg-variables/lexicalScopes/whileScope.kt new file mode 100644 index 00000000000..1490d560464 --- /dev/null +++ b/compiler/testData/cfg-variables/lexicalScopes/whileScope.kt @@ -0,0 +1,7 @@ +fun foo() { + "before" + while (true) { + val a: Int + } + "after" +} \ No newline at end of file diff --git a/compiler/testData/cfg/arrays/ArrayAccess.instructions b/compiler/testData/cfg/arrays/ArrayAccess.instructions index 6e78e9886af..b10110497a7 100644 --- a/compiler/testData/cfg/arrays/ArrayAccess.instructions +++ b/compiler/testData/cfg/arrays/ArrayAccess.instructions @@ -10,8 +10,8 @@ fun foo() { } --------------------- L0: - - mark({ val a = Array 3 a[10] = 4 2 a[10] 100 a[10] += 1 }) + 1 + 2 mark({ val a = Array 3 a[10] = 4 2 a[10] 100 a[10] += 1 }) v(val a = Array) mark(Array) call(Array, ) @@ -41,7 +41,7 @@ L0: r(1) call(a[10], set) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/arrays/ArrayOfFunctions.instructions b/compiler/testData/cfg/arrays/ArrayOfFunctions.instructions index 0b58bf71437..dc2395e4dc0 100644 --- a/compiler/testData/cfg/arrays/ArrayOfFunctions.instructions +++ b/compiler/testData/cfg/arrays/ArrayOfFunctions.instructions @@ -4,10 +4,10 @@ fun test(array: Array<(Int)->Unit>) { } --------------------- L0: - + 1 v(array: Array<(Int)->Unit>) w(array) - mark({ array[11](3) }) + 2 mark({ array[11](3) }) mark(array[11](3)) mark(array[11]) r(array) @@ -16,7 +16,7 @@ L0: r(3) call(array[11], ) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/arrays/arrayAccessExpression.instructions b/compiler/testData/cfg/arrays/arrayAccessExpression.instructions index 3f5bc439770..09ca96e2868 100644 --- a/compiler/testData/cfg/arrays/arrayAccessExpression.instructions +++ b/compiler/testData/cfg/arrays/arrayAccessExpression.instructions @@ -4,7 +4,7 @@ abstract class Ab { } --------------------- L0: - + 1 L1: NEXT:[] error: @@ -16,7 +16,7 @@ sink: abstract fun getArray() : Array --------------------- L0: - + 1 L1: NEXT:[] error: @@ -30,10 +30,10 @@ fun test(ab: Ab) { } --------------------- L0: - + 1 v(ab: Ab) w(ab) - mark({ ab.getArray()[1] }) + 2 mark({ ab.getArray()[1] }) mark(ab.getArray()[1]) mark(ab.getArray()) mark(getArray()) @@ -42,7 +42,7 @@ L0: r(1) call(ab.getArray()[1], get) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/arrays/arraySet.instructions b/compiler/testData/cfg/arrays/arraySet.instructions index 9c193ed88d4..fabd1a5353f 100644 --- a/compiler/testData/cfg/arrays/arraySet.instructions +++ b/compiler/testData/cfg/arrays/arraySet.instructions @@ -4,17 +4,17 @@ fun foo(a: Array) { } --------------------- L0: - + 1 v(a: Array) w(a) - mark({ a[1] = 2 }) + 2 mark({ a[1] = 2 }) mark(a[1]) r(a) r(1) r(2) call(a[1], set) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/arrays/arraySetPlusAssign.instructions b/compiler/testData/cfg/arrays/arraySetPlusAssign.instructions index 180a9ab35ce..b6b909db454 100644 --- a/compiler/testData/cfg/arrays/arraySetPlusAssign.instructions +++ b/compiler/testData/cfg/arrays/arraySetPlusAssign.instructions @@ -4,10 +4,10 @@ fun foo(a: Array) { } --------------------- L0: - + 1 v(a: Array) w(a) - mark({ a[0] += 1 }) + 2 mark({ a[0] += 1 }) mark(a[0] += 1) mark(a[0]) r(a) @@ -21,7 +21,7 @@ L0: r(1) call(a[0], set) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/basic/Basic.instructions b/compiler/testData/cfg/basic/Basic.instructions index 78c33ef25b7..5f67323e0c7 100644 --- a/compiler/testData/cfg/basic/Basic.instructions +++ b/compiler/testData/cfg/basic/Basic.instructions @@ -18,10 +18,10 @@ fun f(a : Boolean) : Unit { } --------------------- L0: - + 1 v(a : Boolean) w(a) - mark({ 1 a 2.toLong() foo(a, 3) genfun() flfun {1} 3.equals(4) 3 equals 4 1 + 2 a && true a || false }) + 2 mark({ 1 a 2.toLong() foo(a, 3) genfun() flfun {1} 3.equals(4) 3 equals 4 1 + 2 a && true a || false }) r(1) r(a) mark(2.toLong()) @@ -65,7 +65,7 @@ L5: L6: r(a || false) PREV:[jt(L6), r(false)] L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: @@ -75,11 +75,11 @@ sink: {1} --------------------- L3: - - mark(1) + 3 + 4 mark(1) r(1) L4: - NEXT:[] + 3 NEXT:[] error: PREV:[] sink: @@ -89,15 +89,15 @@ sink: fun foo(a : Boolean, b : Int) : Unit {} --------------------- L0: - + 1 v(a : Boolean) w(a) v(b : Int) w(b) - mark({}) + 2 mark({}) read (Unit) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: @@ -107,11 +107,11 @@ sink: fun genfun() : Unit {} --------------------- L0: - - mark({}) + 1 + 2 mark({}) read (Unit) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: @@ -121,13 +121,13 @@ sink: fun flfun(f : () -> Any) : Unit {} --------------------- L0: - + 1 v(f : () -> Any) w(f) - mark({}) + 2 mark({}) read (Unit) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/basic/EmptyFunction.instructions b/compiler/testData/cfg/basic/EmptyFunction.instructions index 1f16dc425cb..5e36cf614ed 100644 --- a/compiler/testData/cfg/basic/EmptyFunction.instructions +++ b/compiler/testData/cfg/basic/EmptyFunction.instructions @@ -2,11 +2,11 @@ fun empty() {} --------------------- L0: - - mark({}) + 1 + 2 mark({}) read (Unit) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/basic/ShortFunction.instructions b/compiler/testData/cfg/basic/ShortFunction.instructions index e820bfccfa2..b182b87e41b 100644 --- a/compiler/testData/cfg/basic/ShortFunction.instructions +++ b/compiler/testData/cfg/basic/ShortFunction.instructions @@ -2,7 +2,7 @@ fun short() = 1 --------------------- L0: - + 1 r(1) L1: NEXT:[] diff --git a/compiler/testData/cfg/controlStructures/Finally.instructions b/compiler/testData/cfg/controlStructures/Finally.instructions index d77ef767b47..2c084c57410 100644 --- a/compiler/testData/cfg/controlStructures/Finally.instructions +++ b/compiler/testData/cfg/controlStructures/Finally.instructions @@ -8,24 +8,24 @@ fun t1() { } --------------------- L0: - - mark({ try { 1 } finally { 2 } }) + 1 + 2 mark({ try { 1 } finally { 2 } }) mark(try { 1 } finally { 2 }) jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[mark({ 2 }), mark({ 1 })] - mark({ 1 }) + 3 mark({ 1 }) r(1) - jmp(L3 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] + 2 jmp(L3 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L2 [onExceptionToFinallyBlock]: L4 [start finally]: - mark({ 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + 3 mark({ 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] r(2) L5 [finish finally]: - jmp(error) NEXT:[] + 2 jmp(error) NEXT:[] L3 [skipFinallyToErrorBlock]: - mark({ 2 }) PREV:[jmp(L3 [skipFinallyToErrorBlock])] + 3 mark({ 2 }) PREV:[jmp(L3 [skipFinallyToErrorBlock])] r(2) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[jmp(error)] sink: @@ -44,11 +44,11 @@ fun t2() { } --------------------- L0: - - mark({ try { 1 if (2 > 3) { return } } finally { 2 } }) + 1 + 2 mark({ try { 1 if (2 > 3) { return } } finally { 2 } }) mark(try { 1 if (2 > 3) { return } } finally { 2 }) jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[mark({ 2 }), mark({ 1 if (2 > 3) { return } })] - mark({ 1 if (2 > 3) { return } }) + 3 mark({ 1 if (2 > 3) { return } }) r(1) mark(if (2 > 3) { return }) mark(2 > 3) @@ -56,26 +56,26 @@ L0: r(3) call(>, compareTo) jf(L3) NEXT:[read (Unit), mark({ return })] - mark({ return }) + 4 mark({ return }) L4 [start finally]: - mark({ 2 }) + 5 mark({ 2 }) r(2) L5 [finish finally]: - ret L1 NEXT:[] -- jmp(L6) NEXT:[jmp(L7 [skipFinallyToErrorBlock])] PREV:[] + 4 ret L1 NEXT:[] +- 3 jmp(L6) NEXT:[jmp(L7 [skipFinallyToErrorBlock])] PREV:[] L3: read (Unit) PREV:[jf(L3)] L6: - jmp(L7 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] + 2 jmp(L7 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L2 [onExceptionToFinallyBlock]: - mark({ 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + 5 mark({ 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] r(2) - jmp(error) NEXT:[] + 2 jmp(error) NEXT:[] L7 [skipFinallyToErrorBlock]: - mark({ 2 }) PREV:[jmp(L7 [skipFinallyToErrorBlock])] + 5 mark({ 2 }) PREV:[jmp(L7 [skipFinallyToErrorBlock])] r(2) L1: - NEXT:[] PREV:[ret L1, r(2)] + 1 NEXT:[] PREV:[ret L1, r(2)] error: PREV:[jmp(error)] sink: @@ -96,11 +96,11 @@ fun t3() { } --------------------- L0: - - mark({ try { 1 @{ () -> if (2 > 3) { return@ } } } finally { 2 } }) + 1 + 2 mark({ try { 1 @{ () -> if (2 > 3) { return@ } } } finally { 2 } }) mark(try { 1 @{ () -> if (2 > 3) { return@ } } } finally { 2 }) jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[mark({ 2 }), mark({ 1 @{ () -> if (2 > 3) { return@ } } })] - mark({ 1 @{ () -> if (2 > 3) { return@ } } }) + 3 mark({ 1 @{ () -> if (2 > 3) { return@ } } }) r(1) mark(@{ () -> if (2 > 3) { return@ } }) mark({ () -> if (2 > 3) { return@ } }) @@ -108,18 +108,18 @@ L0: d({ () -> if (2 > 3) { return@ } }) NEXT:[] L3: r({ () -> if (2 > 3) { return@ } }) PREV:[jmp?(L3)] - jmp(L8 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] + 2 jmp(L8 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L2 [onExceptionToFinallyBlock]: L9 [start finally]: - mark({ 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + 3 mark({ 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] r(2) L10 [finish finally]: - jmp(error) NEXT:[] + 2 jmp(error) NEXT:[] L8 [skipFinallyToErrorBlock]: - mark({ 2 }) PREV:[jmp(L8 [skipFinallyToErrorBlock])] + 3 mark({ 2 }) PREV:[jmp(L8 [skipFinallyToErrorBlock])] r(2) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[jmp(error)] sink: @@ -133,22 +133,22 @@ sink: } --------------------- L4: - - mark(if (2 > 3) { return@ }) + 4 + 5 mark(if (2 > 3) { return@ }) mark(if (2 > 3) { return@ }) mark(2 > 3) r(2) r(3) call(>, compareTo) jf(L6) NEXT:[read (Unit), mark({ return@ })] - mark({ return@ }) + 6 mark({ return@ }) ret L5 NEXT:[] -- jmp(L7) NEXT:[] PREV:[] +- 5 jmp(L7) NEXT:[] PREV:[] L6: read (Unit) PREV:[jf(L6)] L5: L7: - NEXT:[] PREV:[ret L5, read (Unit)] + 4 NEXT:[] PREV:[ret L5, read (Unit)] error: PREV:[] sink: @@ -169,8 +169,8 @@ fun t4() { } --------------------- L0: - - mark({ @{ () -> try { 1 if (2 > 3) { return@ } } finally { 2 } } }) + 1 + 2 mark({ @{ () -> try { 1 if (2 > 3) { return@ } } finally { 2 } } }) mark(@{ () -> try { 1 if (2 > 3) { return@ } } finally { 2 } }) mark({ () -> try { 1 if (2 > 3) { return@ } } finally { 2 } }) jmp?(L2) NEXT:[r({ () -> try { 1 if (2 > 3) { return@ } } finally { 2 } }), d({ () -> try { 1 if (2 > 3) { return@ } } finally { 2 } })] @@ -178,7 +178,7 @@ L0: L2: r({ () -> try { 1 if (2 > 3) { return@ } } finally { 2 } }) PREV:[jmp?(L2)] L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: @@ -197,11 +197,11 @@ sink: } --------------------- L3: - - mark(try { 1 if (2 > 3) { return@ } } finally { 2 }) + 3 + 4 mark(try { 1 if (2 > 3) { return@ } } finally { 2 }) mark(try { 1 if (2 > 3) { return@ } } finally { 2 }) jmp?(L5 [onExceptionToFinallyBlock]) NEXT:[mark({ 2 }), mark({ 1 if (2 > 3) { return@ } })] - mark({ 1 if (2 > 3) { return@ } }) + 5 mark({ 1 if (2 > 3) { return@ } }) r(1) mark(if (2 > 3) { return@ }) mark(2 > 3) @@ -209,26 +209,26 @@ L3: r(3) call(>, compareTo) jf(L6) NEXT:[read (Unit), mark({ return@ })] - mark({ return@ }) + 6 mark({ return@ }) L7 [start finally]: - mark({ 2 }) + 7 mark({ 2 }) r(2) L8 [finish finally]: - ret L4 NEXT:[] -- jmp(L9) NEXT:[jmp(L10 [skipFinallyToErrorBlock])] PREV:[] + 6 ret L4 NEXT:[] +- 5 jmp(L9) NEXT:[jmp(L10 [skipFinallyToErrorBlock])] PREV:[] L6: read (Unit) PREV:[jf(L6)] L9: - jmp(L10 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] + 4 jmp(L10 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L5 [onExceptionToFinallyBlock]: - mark({ 2 }) PREV:[jmp?(L5 [onExceptionToFinallyBlock])] + 7 mark({ 2 }) PREV:[jmp?(L5 [onExceptionToFinallyBlock])] r(2) - jmp(error) NEXT:[] + 4 jmp(error) NEXT:[] L10 [skipFinallyToErrorBlock]: - mark({ 2 }) PREV:[jmp(L10 [skipFinallyToErrorBlock])] + 7 mark({ 2 }) PREV:[jmp(L10 [skipFinallyToErrorBlock])] r(2) L4: - NEXT:[] PREV:[ret L4, r(2)] + 3 NEXT:[] PREV:[ret L4, r(2)] error: PREV:[jmp(error)] sink: @@ -249,18 +249,18 @@ fun t5() { } --------------------- L0: - - mark({ @ while(true) { try { 1 if (2 > 3) { break @ } } finally { 2 } } }) + 1 + 2 mark({ @ while(true) { try { 1 if (2 > 3) { break @ } } finally { 2 } } }) mark(@ while(true) { try { 1 if (2 > 3) { break @ } } finally { 2 } }) mark(while(true) { try { 1 if (2 > 3) { break @ } } finally { 2 } }) L2 [loop entry point]: L5 [condition entry point]: r(true) PREV:[mark(while(true) { try { 1 if (2 > 3) { break @ } } finally { 2 } }), jmp(L2 [loop entry point])] L4 [body entry point]: - mark({ try { 1 if (2 > 3) { break @ } } finally { 2 } }) + 3 mark({ try { 1 if (2 > 3) { break @ } } finally { 2 } }) mark(try { 1 if (2 > 3) { break @ } } finally { 2 }) jmp?(L6 [onExceptionToFinallyBlock]) NEXT:[mark({ 2 }), mark({ 1 if (2 > 3) { break @ } })] - mark({ 1 if (2 > 3) { break @ } }) + 4 mark({ 1 if (2 > 3) { break @ } }) r(1) mark(if (2 > 3) { break @ }) mark(2 > 3) @@ -268,29 +268,29 @@ L4 [body entry point]: r(3) call(>, compareTo) jf(L7) NEXT:[read (Unit), mark({ break @ })] - mark({ break @ }) + 5 mark({ break @ }) L8 [start finally]: - mark({ 2 }) + 6 mark({ 2 }) r(2) L9 [finish finally]: - jmp(L3 [loop exit point]) NEXT:[read (Unit)] -- jmp(L10) NEXT:[jmp(L11 [skipFinallyToErrorBlock])] PREV:[] + 5 jmp(L3 [loop exit point]) NEXT:[read (Unit)] +- 4 jmp(L10) NEXT:[jmp(L11 [skipFinallyToErrorBlock])] PREV:[] L7: read (Unit) PREV:[jf(L7)] L10: - jmp(L11 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] + 3 jmp(L11 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L6 [onExceptionToFinallyBlock]: - mark({ 2 }) PREV:[jmp?(L6 [onExceptionToFinallyBlock])] + 6 mark({ 2 }) PREV:[jmp?(L6 [onExceptionToFinallyBlock])] r(2) - jmp(error) NEXT:[] + 3 jmp(error) NEXT:[] L11 [skipFinallyToErrorBlock]: - mark({ 2 }) PREV:[jmp(L11 [skipFinallyToErrorBlock])] + 6 mark({ 2 }) PREV:[jmp(L11 [skipFinallyToErrorBlock])] r(2) - jmp(L2 [loop entry point]) NEXT:[r(true)] + 2 jmp(L2 [loop entry point]) NEXT:[r(true)] L3 [loop exit point]: read (Unit) PREV:[jmp(L3 [loop exit point])] L1: - NEXT:[] + 1 NEXT:[] error: PREV:[jmp(error)] sink: @@ -312,18 +312,18 @@ fun t6() { } --------------------- L0: - - mark({ try { @ while(true) { 1 if (2 > 3) { break @ } } 5 } finally { 2 } }) + 1 + 2 mark({ try { @ while(true) { 1 if (2 > 3) { break @ } } 5 } finally { 2 } }) mark(try { @ while(true) { 1 if (2 > 3) { break @ } } 5 } finally { 2 }) jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[mark({ 2 }), mark({ @ while(true) { 1 if (2 > 3) { break @ } } 5 })] - mark({ @ while(true) { 1 if (2 > 3) { break @ } } 5 }) + 3 mark({ @ while(true) { 1 if (2 > 3) { break @ } } 5 }) mark(@ while(true) { 1 if (2 > 3) { break @ } }) mark(while(true) { 1 if (2 > 3) { break @ } }) L3 [loop entry point]: L6 [condition entry point]: r(true) PREV:[mark(while(true) { 1 if (2 > 3) { break @ } }), jmp(L3 [loop entry point])] L5 [body entry point]: - mark({ 1 if (2 > 3) { break @ } }) + 4 mark({ 1 if (2 > 3) { break @ } }) r(1) mark(if (2 > 3) { break @ }) mark(2 > 3) @@ -331,28 +331,28 @@ L5 [body entry point]: r(3) call(>, compareTo) jf(L7) NEXT:[read (Unit), mark({ break @ })] - mark({ break @ }) + 5 mark({ break @ }) jmp(L4 [loop exit point]) NEXT:[read (Unit)] -- jmp(L8) NEXT:[jmp(L3 [loop entry point])] PREV:[] +- 4 jmp(L8) NEXT:[jmp(L3 [loop entry point])] PREV:[] L7: read (Unit) PREV:[jf(L7)] L8: - jmp(L3 [loop entry point]) NEXT:[r(true)] + 3 jmp(L3 [loop entry point]) NEXT:[r(true)] L4 [loop exit point]: read (Unit) PREV:[jmp(L4 [loop exit point])] r(5) - jmp(L9 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] + 2 jmp(L9 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L2 [onExceptionToFinallyBlock]: L10 [start finally]: - mark({ 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + 3 mark({ 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] r(2) L11 [finish finally]: - jmp(error) NEXT:[] + 2 jmp(error) NEXT:[] L9 [skipFinallyToErrorBlock]: - mark({ 2 }) PREV:[jmp(L9 [skipFinallyToErrorBlock])] + 3 mark({ 2 }) PREV:[jmp(L9 [skipFinallyToErrorBlock])] r(2) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[jmp(error)] sink: @@ -373,18 +373,18 @@ fun t7() { } --------------------- L0: - - mark({ try { @ while(true) { 1 if (2 > 3) { break @ } } } finally { 2 } }) + 1 + 2 mark({ try { @ while(true) { 1 if (2 > 3) { break @ } } } finally { 2 } }) mark(try { @ while(true) { 1 if (2 > 3) { break @ } } } finally { 2 }) jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[mark({ 2 }), mark({ @ while(true) { 1 if (2 > 3) { break @ } } })] - mark({ @ while(true) { 1 if (2 > 3) { break @ } } }) + 3 mark({ @ while(true) { 1 if (2 > 3) { break @ } } }) mark(@ while(true) { 1 if (2 > 3) { break @ } }) mark(while(true) { 1 if (2 > 3) { break @ } }) L3 [loop entry point]: L6 [condition entry point]: r(true) PREV:[mark(while(true) { 1 if (2 > 3) { break @ } }), jmp(L3 [loop entry point])] L5 [body entry point]: - mark({ 1 if (2 > 3) { break @ } }) + 4 mark({ 1 if (2 > 3) { break @ } }) r(1) mark(if (2 > 3) { break @ }) mark(2 > 3) @@ -392,27 +392,27 @@ L5 [body entry point]: r(3) call(>, compareTo) jf(L7) NEXT:[read (Unit), mark({ break @ })] - mark({ break @ }) + 5 mark({ break @ }) jmp(L4 [loop exit point]) NEXT:[read (Unit)] -- jmp(L8) NEXT:[jmp(L3 [loop entry point])] PREV:[] +- 4 jmp(L8) NEXT:[jmp(L3 [loop entry point])] PREV:[] L7: read (Unit) PREV:[jf(L7)] L8: - jmp(L3 [loop entry point]) NEXT:[r(true)] + 3 jmp(L3 [loop entry point]) NEXT:[r(true)] L4 [loop exit point]: read (Unit) PREV:[jmp(L4 [loop exit point])] - jmp(L9 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] + 2 jmp(L9 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L2 [onExceptionToFinallyBlock]: L10 [start finally]: - mark({ 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + 3 mark({ 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] r(2) L11 [finish finally]: - jmp(error) NEXT:[] + 2 jmp(error) NEXT:[] L9 [skipFinallyToErrorBlock]: - mark({ 2 }) PREV:[jmp(L9 [skipFinallyToErrorBlock])] + 3 mark({ 2 }) PREV:[jmp(L9 [skipFinallyToErrorBlock])] r(2) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[jmp(error)] sink: @@ -433,12 +433,12 @@ fun t8(a : Int) { } --------------------- L0: - + 1 v(a : Int) w(a) - mark({ @ for (i in 1..a) { try { 1 if (2 > 3) { continue @ } } finally { 2 } } }) + 2 mark({ @ for (i in 1..a) { try { 1 if (2 > 3) { continue @ } } finally { 2 } } }) mark(@ for (i in 1..a) { try { 1 if (2 > 3) { continue @ } } finally { 2 } }) - mark(for (i in 1..a) { try { 1 if (2 > 3) { continue @ } } finally { 2 } }) + 3 mark(for (i in 1..a) { try { 1 if (2 > 3) { continue @ } } finally { 2 } }) mark(1..a) r(1) r(a) @@ -449,10 +449,10 @@ L3: jmp?(L2) NEXT:[read (Unit), mark({ try { 1 if (2 > 3) { continue @ } } finally { 2 } })] L4 [loop entry point]: L5 [body entry point]: - mark({ try { 1 if (2 > 3) { continue @ } } finally { 2 } }) PREV:[jmp?(L2), jmp(L4 [loop entry point]), jmp?(L4 [loop entry point])] + 4 mark({ try { 1 if (2 > 3) { continue @ } } finally { 2 } }) PREV:[jmp?(L2), jmp(L4 [loop entry point]), jmp?(L4 [loop entry point])] mark(try { 1 if (2 > 3) { continue @ } } finally { 2 }) jmp?(L6 [onExceptionToFinallyBlock]) NEXT:[mark({ 2 }), mark({ 1 if (2 > 3) { continue @ } })] - mark({ 1 if (2 > 3) { continue @ } }) + 5 mark({ 1 if (2 > 3) { continue @ } }) r(1) mark(if (2 > 3) { continue @ }) mark(2 > 3) @@ -460,29 +460,29 @@ L5 [body entry point]: r(3) call(>, compareTo) jf(L7) NEXT:[read (Unit), mark({ continue @ })] - mark({ continue @ }) + 6 mark({ continue @ }) L8 [start finally]: - mark({ 2 }) + 7 mark({ 2 }) r(2) L9 [finish finally]: - jmp(L4 [loop entry point]) NEXT:[mark({ try { 1 if (2 > 3) { continue @ } } finally { 2 } })] -- jmp(L10) NEXT:[jmp(L11 [skipFinallyToErrorBlock])] PREV:[] + 6 jmp(L4 [loop entry point]) NEXT:[mark({ try { 1 if (2 > 3) { continue @ } } finally { 2 } })] +- 5 jmp(L10) NEXT:[jmp(L11 [skipFinallyToErrorBlock])] PREV:[] L7: read (Unit) PREV:[jf(L7)] L10: - jmp(L11 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] + 4 jmp(L11 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L6 [onExceptionToFinallyBlock]: - mark({ 2 }) PREV:[jmp?(L6 [onExceptionToFinallyBlock])] + 7 mark({ 2 }) PREV:[jmp?(L6 [onExceptionToFinallyBlock])] r(2) - jmp(error) NEXT:[] + 4 jmp(error) NEXT:[] L11 [skipFinallyToErrorBlock]: - mark({ 2 }) PREV:[jmp(L11 [skipFinallyToErrorBlock])] + 7 mark({ 2 }) PREV:[jmp(L11 [skipFinallyToErrorBlock])] r(2) - jmp?(L4 [loop entry point]) NEXT:[mark({ try { 1 if (2 > 3) { continue @ } } finally { 2 } }), read (Unit)] + 3 jmp?(L4 [loop entry point]) NEXT:[mark({ try { 1 if (2 > 3) { continue @ } } finally { 2 } }), read (Unit)] L2: read (Unit) PREV:[jmp?(L2), jmp?(L4 [loop entry point])] L1: - NEXT:[] + 1 NEXT:[] error: PREV:[jmp(error)] sink: @@ -504,15 +504,15 @@ fun t9(a : Int) { } --------------------- L0: - + 1 v(a : Int) w(a) - mark({ try { @ for (i in 1..a) { 1 if (2 > 3) { continue @ } } 5 } finally { 2 } }) + 2 mark({ try { @ for (i in 1..a) { 1 if (2 > 3) { continue @ } } 5 } finally { 2 } }) mark(try { @ for (i in 1..a) { 1 if (2 > 3) { continue @ } } 5 } finally { 2 }) jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[mark({ 2 }), mark({ @ for (i in 1..a) { 1 if (2 > 3) { continue @ } } 5 })] - mark({ @ for (i in 1..a) { 1 if (2 > 3) { continue @ } } 5 }) + 3 mark({ @ for (i in 1..a) { 1 if (2 > 3) { continue @ } } 5 }) mark(@ for (i in 1..a) { 1 if (2 > 3) { continue @ } }) - mark(for (i in 1..a) { 1 if (2 > 3) { continue @ } }) + 4 mark(for (i in 1..a) { 1 if (2 > 3) { continue @ } }) mark(1..a) r(1) r(a) @@ -523,7 +523,7 @@ L4: jmp?(L3) NEXT:[read (Unit), mark({ 1 if (2 > 3) { continue @ } })] L5 [loop entry point]: L6 [body entry point]: - mark({ 1 if (2 > 3) { continue @ } }) PREV:[jmp?(L3), jmp(L5 [loop entry point]), jmp?(L5 [loop entry point])] + 5 mark({ 1 if (2 > 3) { continue @ } }) PREV:[jmp?(L3), jmp(L5 [loop entry point]), jmp?(L5 [loop entry point])] r(1) mark(if (2 > 3) { continue @ }) mark(2 > 3) @@ -531,28 +531,28 @@ L6 [body entry point]: r(3) call(>, compareTo) jf(L7) NEXT:[read (Unit), mark({ continue @ })] - mark({ continue @ }) + 6 mark({ continue @ }) jmp(L5 [loop entry point]) NEXT:[mark({ 1 if (2 > 3) { continue @ } })] -- jmp(L8) NEXT:[jmp?(L5 [loop entry point])] PREV:[] +- 5 jmp(L8) NEXT:[jmp?(L5 [loop entry point])] PREV:[] L7: read (Unit) PREV:[jf(L7)] L8: - jmp?(L5 [loop entry point]) NEXT:[mark({ 1 if (2 > 3) { continue @ } }), read (Unit)] + 4 jmp?(L5 [loop entry point]) NEXT:[mark({ 1 if (2 > 3) { continue @ } }), read (Unit)] L3: read (Unit) PREV:[jmp?(L3), jmp?(L5 [loop entry point])] - r(5) - jmp(L9 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] + 3 r(5) + 2 jmp(L9 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L2 [onExceptionToFinallyBlock]: L10 [start finally]: - mark({ 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + 3 mark({ 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] r(2) L11 [finish finally]: - jmp(error) NEXT:[] + 2 jmp(error) NEXT:[] L9 [skipFinallyToErrorBlock]: - mark({ 2 }) PREV:[jmp(L9 [skipFinallyToErrorBlock])] + 3 mark({ 2 }) PREV:[jmp(L9 [skipFinallyToErrorBlock])] r(2) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[jmp(error)] sink: @@ -573,15 +573,15 @@ fun t10(a : Int) { } --------------------- L0: - + 1 v(a : Int) w(a) - mark({ try { @ for (i in 1..a) { 1 if (2 > 3) { continue @ } } } finally { 2 } }) + 2 mark({ try { @ for (i in 1..a) { 1 if (2 > 3) { continue @ } } } finally { 2 } }) mark(try { @ for (i in 1..a) { 1 if (2 > 3) { continue @ } } } finally { 2 }) jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[mark({ 2 }), mark({ @ for (i in 1..a) { 1 if (2 > 3) { continue @ } } })] - mark({ @ for (i in 1..a) { 1 if (2 > 3) { continue @ } } }) + 3 mark({ @ for (i in 1..a) { 1 if (2 > 3) { continue @ } } }) mark(@ for (i in 1..a) { 1 if (2 > 3) { continue @ } }) - mark(for (i in 1..a) { 1 if (2 > 3) { continue @ } }) + 4 mark(for (i in 1..a) { 1 if (2 > 3) { continue @ } }) mark(1..a) r(1) r(a) @@ -592,7 +592,7 @@ L4: jmp?(L3) NEXT:[read (Unit), mark({ 1 if (2 > 3) { continue @ } })] L5 [loop entry point]: L6 [body entry point]: - mark({ 1 if (2 > 3) { continue @ } }) PREV:[jmp?(L3), jmp(L5 [loop entry point]), jmp?(L5 [loop entry point])] + 5 mark({ 1 if (2 > 3) { continue @ } }) PREV:[jmp?(L3), jmp(L5 [loop entry point]), jmp?(L5 [loop entry point])] r(1) mark(if (2 > 3) { continue @ }) mark(2 > 3) @@ -600,27 +600,27 @@ L6 [body entry point]: r(3) call(>, compareTo) jf(L7) NEXT:[read (Unit), mark({ continue @ })] - mark({ continue @ }) + 6 mark({ continue @ }) jmp(L5 [loop entry point]) NEXT:[mark({ 1 if (2 > 3) { continue @ } })] -- jmp(L8) NEXT:[jmp?(L5 [loop entry point])] PREV:[] +- 5 jmp(L8) NEXT:[jmp?(L5 [loop entry point])] PREV:[] L7: read (Unit) PREV:[jf(L7)] L8: - jmp?(L5 [loop entry point]) NEXT:[mark({ 1 if (2 > 3) { continue @ } }), read (Unit)] + 4 jmp?(L5 [loop entry point]) NEXT:[mark({ 1 if (2 > 3) { continue @ } }), read (Unit)] L3: read (Unit) PREV:[jmp?(L3), jmp?(L5 [loop entry point])] - jmp(L9 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] + 2 jmp(L9 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L2 [onExceptionToFinallyBlock]: L10 [start finally]: - mark({ 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + 3 mark({ 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] r(2) L11 [finish finally]: - jmp(error) NEXT:[] + 2 jmp(error) NEXT:[] L9 [skipFinallyToErrorBlock]: - mark({ 2 }) PREV:[jmp(L9 [skipFinallyToErrorBlock])] + 3 mark({ 2 }) PREV:[jmp(L9 [skipFinallyToErrorBlock])] r(2) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[jmp(error)] sink: @@ -637,30 +637,30 @@ fun t11() { } --------------------- L0: - - mark({ try { return 1 } finally { return 2 } }) + 1 + 2 mark({ try { return 1 } finally { return 2 } }) mark(try { return 1 } finally { return 2 }) jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[mark({ return 2 }), mark({ return 1 })] - mark({ return 1 }) + 3 mark({ return 1 }) r(1) L3 [start finally]: - mark({ return 2 }) + 4 mark({ return 2 }) r(2) ret(*) L1 NEXT:[] L4 [finish finally]: -- ret(*) L1 NEXT:[] PREV:[] -- jmp(L5 [skipFinallyToErrorBlock]) NEXT:[mark({ return 2 })] PREV:[] +- 3 ret(*) L1 NEXT:[] PREV:[] +- 2 jmp(L5 [skipFinallyToErrorBlock]) NEXT:[mark({ return 2 })] PREV:[] L2 [onExceptionToFinallyBlock]: - mark({ return 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + 4 mark({ return 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] r(2) ret(*) L1 NEXT:[] -- jmp(error) NEXT:[] PREV:[] +- 2 jmp(error) NEXT:[] PREV:[] L5 [skipFinallyToErrorBlock]: -- mark({ return 2 }) PREV:[] +- 4 mark({ return 2 }) PREV:[] - r(2) PREV:[] - ret(*) L1 PREV:[] L1: - NEXT:[] PREV:[ret(*) L1, ret(*) L1] + 1 NEXT:[] PREV:[ret(*) L1, ret(*) L1] error: PREV:[] sink: @@ -677,33 +677,33 @@ fun t12() : Int { } --------------------- L0: - - mark({ try { return 1 } finally { doSmth(3) } }) + 1 + 2 mark({ try { return 1 } finally { doSmth(3) } }) mark(try { return 1 } finally { doSmth(3) }) jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[mark({ doSmth(3) }), mark({ return 1 })] - mark({ return 1 }) + 3 mark({ return 1 }) r(1) L3 [start finally]: - mark({ doSmth(3) }) + 4 mark({ doSmth(3) }) mark(doSmth(3)) r(3) call(doSmth, doSmth) L4 [finish finally]: - ret(*) L1 NEXT:[] -- jmp(L5 [skipFinallyToErrorBlock]) NEXT:[mark({ doSmth(3) })] PREV:[] + 3 ret(*) L1 NEXT:[] +- 2 jmp(L5 [skipFinallyToErrorBlock]) NEXT:[mark({ doSmth(3) })] PREV:[] L2 [onExceptionToFinallyBlock]: - mark({ doSmth(3) }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + 4 mark({ doSmth(3) }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] mark(doSmth(3)) r(3) call(doSmth, doSmth) - jmp(error) NEXT:[] + 2 jmp(error) NEXT:[] L5 [skipFinallyToErrorBlock]: -- mark({ doSmth(3) }) PREV:[] +- 4 mark({ doSmth(3) }) PREV:[] - mark(doSmth(3)) PREV:[] - r(3) PREV:[] - call(doSmth, doSmth) PREV:[] L1: - NEXT:[] PREV:[ret(*) L1] + 1 NEXT:[] PREV:[ret(*) L1] error: PREV:[jmp(error)] sink: @@ -723,44 +723,44 @@ fun t13() : Int { } --------------------- L0: - - mark({ try { return 1 } catch (e: UnsupportedOperationException) { doSmth(2) } finally { doSmth(3) } }) + 1 + 2 mark({ try { return 1 } catch (e: UnsupportedOperationException) { doSmth(2) } finally { doSmth(3) } }) mark(try { return 1 } catch (e: UnsupportedOperationException) { doSmth(2) } finally { doSmth(3) }) jmp?(L2 [onException]) NEXT:[v(e: UnsupportedOperationException), jmp?(L3 [onExceptionToFinallyBlock])] jmp?(L3 [onExceptionToFinallyBlock]) NEXT:[mark({ doSmth(3) }), mark({ return 1 })] - mark({ return 1 }) + 3 mark({ return 1 }) r(1) L4 [start finally]: - mark({ doSmth(3) }) + 4 mark({ doSmth(3) }) mark(doSmth(3)) r(3) call(doSmth, doSmth) L5 [finish finally]: - ret(*) L1 NEXT:[] -- jmp(L6 [afterCatches]) NEXT:[jmp(L7 [skipFinallyToErrorBlock])] PREV:[] + 3 ret(*) L1 NEXT:[] +- 2 jmp(L6 [afterCatches]) NEXT:[jmp(L7 [skipFinallyToErrorBlock])] PREV:[] L2 [onException]: - v(e: UnsupportedOperationException) PREV:[jmp?(L2 [onException])] + 3 v(e: UnsupportedOperationException) PREV:[jmp?(L2 [onException])] w(e) - mark({ doSmth(2) }) + 4 mark({ doSmth(2) }) mark(doSmth(2)) r(2) call(doSmth, doSmth) - jmp(L6 [afterCatches]) + 3 jmp(L6 [afterCatches]) L6 [afterCatches]: - jmp(L7 [skipFinallyToErrorBlock]) NEXT:[mark({ doSmth(3) })] + 2 jmp(L7 [skipFinallyToErrorBlock]) NEXT:[mark({ doSmth(3) })] L3 [onExceptionToFinallyBlock]: - mark({ doSmth(3) }) PREV:[jmp?(L3 [onExceptionToFinallyBlock])] + 4 mark({ doSmth(3) }) PREV:[jmp?(L3 [onExceptionToFinallyBlock])] mark(doSmth(3)) r(3) call(doSmth, doSmth) - jmp(error) NEXT:[] + 2 jmp(error) NEXT:[] L7 [skipFinallyToErrorBlock]: - mark({ doSmth(3) }) PREV:[jmp(L7 [skipFinallyToErrorBlock])] + 4 mark({ doSmth(3) }) PREV:[jmp(L7 [skipFinallyToErrorBlock])] mark(doSmth(3)) r(3) call(doSmth, doSmth) L1: - NEXT:[] PREV:[ret(*) L1, call(doSmth, doSmth)] + 1 NEXT:[] PREV:[ret(*) L1, call(doSmth, doSmth)] error: PREV:[jmp(error)] sink: @@ -777,25 +777,25 @@ fun t14() : Int { } --------------------- L0: - - mark({ try { return 1 } catch (e: UnsupportedOperationException) { doSmth(2) } }) + 1 + 2 mark({ try { return 1 } catch (e: UnsupportedOperationException) { doSmth(2) } }) mark(try { return 1 } catch (e: UnsupportedOperationException) { doSmth(2) }) jmp?(L2 [onException]) NEXT:[v(e: UnsupportedOperationException), mark({ return 1 })] - mark({ return 1 }) + 3 mark({ return 1 }) r(1) ret(*) L1 NEXT:[] -- jmp(L3 [afterCatches]) NEXT:[] PREV:[] +- 2 jmp(L3 [afterCatches]) NEXT:[] PREV:[] L2 [onException]: - v(e: UnsupportedOperationException) PREV:[jmp?(L2 [onException])] + 3 v(e: UnsupportedOperationException) PREV:[jmp?(L2 [onException])] w(e) - mark({ doSmth(2) }) + 4 mark({ doSmth(2) }) mark(doSmth(2)) r(2) call(doSmth, doSmth) - jmp(L3 [afterCatches]) + 3 jmp(L3 [afterCatches]) L1: L3 [afterCatches]: - NEXT:[] PREV:[ret(*) L1, jmp(L3 [afterCatches])] + 1 NEXT:[] PREV:[ret(*) L1, jmp(L3 [afterCatches])] error: PREV:[] sink: @@ -815,47 +815,47 @@ fun t15() : Int { } --------------------- L0: - - mark({ try { return 1 } catch (e: UnsupportedOperationException) { return 2 } finally { doSmth(3) } }) + 1 + 2 mark({ try { return 1 } catch (e: UnsupportedOperationException) { return 2 } finally { doSmth(3) } }) mark(try { return 1 } catch (e: UnsupportedOperationException) { return 2 } finally { doSmth(3) }) jmp?(L2 [onException]) NEXT:[v(e: UnsupportedOperationException), jmp?(L3 [onExceptionToFinallyBlock])] jmp?(L3 [onExceptionToFinallyBlock]) NEXT:[mark({ doSmth(3) }), mark({ return 1 })] - mark({ return 1 }) + 3 mark({ return 1 }) r(1) L4 [start finally]: - mark({ doSmth(3) }) + 4 mark({ doSmth(3) }) mark(doSmth(3)) r(3) call(doSmth, doSmth) L5 [finish finally]: - ret(*) L1 NEXT:[] -- jmp(L6 [afterCatches]) NEXT:[jmp(L7 [skipFinallyToErrorBlock])] PREV:[] + 3 ret(*) L1 NEXT:[] +- 2 jmp(L6 [afterCatches]) NEXT:[jmp(L7 [skipFinallyToErrorBlock])] PREV:[] L2 [onException]: - v(e: UnsupportedOperationException) PREV:[jmp?(L2 [onException])] + 3 v(e: UnsupportedOperationException) PREV:[jmp?(L2 [onException])] w(e) - mark({ return 2 }) + 4 mark({ return 2 }) r(2) mark({ doSmth(3) }) mark(doSmth(3)) r(3) call(doSmth, doSmth) ret(*) L1 NEXT:[] -- jmp(L6 [afterCatches]) PREV:[] +- 3 jmp(L6 [afterCatches]) PREV:[] L6 [afterCatches]: -- jmp(L7 [skipFinallyToErrorBlock]) NEXT:[mark({ doSmth(3) })] PREV:[] +- 2 jmp(L7 [skipFinallyToErrorBlock]) NEXT:[mark({ doSmth(3) })] PREV:[] L3 [onExceptionToFinallyBlock]: - mark({ doSmth(3) }) PREV:[jmp?(L3 [onExceptionToFinallyBlock])] + 4 mark({ doSmth(3) }) PREV:[jmp?(L3 [onExceptionToFinallyBlock])] mark(doSmth(3)) r(3) call(doSmth, doSmth) - jmp(error) NEXT:[] + 2 jmp(error) NEXT:[] L7 [skipFinallyToErrorBlock]: -- mark({ doSmth(3) }) PREV:[] +- 4 mark({ doSmth(3) }) PREV:[] - mark(doSmth(3)) PREV:[] - r(3) PREV:[] - call(doSmth, doSmth) PREV:[] L1: - NEXT:[] PREV:[ret(*) L1, ret(*) L1] + 1 NEXT:[] PREV:[ret(*) L1, ret(*) L1] error: PREV:[jmp(error)] sink: @@ -875,44 +875,44 @@ fun t16() : Int { } --------------------- L0: - - mark({ try { doSmth(1) } catch (e: UnsupportedOperationException) { return 2 } finally { doSmth(3) } }) + 1 + 2 mark({ try { doSmth(1) } catch (e: UnsupportedOperationException) { return 2 } finally { doSmth(3) } }) mark(try { doSmth(1) } catch (e: UnsupportedOperationException) { return 2 } finally { doSmth(3) }) jmp?(L2 [onException]) NEXT:[v(e: UnsupportedOperationException), jmp?(L3 [onExceptionToFinallyBlock])] jmp?(L3 [onExceptionToFinallyBlock]) NEXT:[mark({ doSmth(3) }), mark({ doSmth(1) })] - mark({ doSmth(1) }) + 3 mark({ doSmth(1) }) mark(doSmth(1)) r(1) call(doSmth, doSmth) - jmp(L4 [afterCatches]) NEXT:[jmp(L7 [skipFinallyToErrorBlock])] + 2 jmp(L4 [afterCatches]) NEXT:[jmp(L7 [skipFinallyToErrorBlock])] L2 [onException]: - v(e: UnsupportedOperationException) PREV:[jmp?(L2 [onException])] + 3 v(e: UnsupportedOperationException) PREV:[jmp?(L2 [onException])] w(e) - mark({ return 2 }) + 4 mark({ return 2 }) r(2) L5 [start finally]: - mark({ doSmth(3) }) + 5 mark({ doSmth(3) }) mark(doSmth(3)) r(3) call(doSmth, doSmth) L6 [finish finally]: - ret(*) L1 NEXT:[] -- jmp(L4 [afterCatches]) PREV:[] + 4 ret(*) L1 NEXT:[] +- 3 jmp(L4 [afterCatches]) PREV:[] L4 [afterCatches]: - jmp(L7 [skipFinallyToErrorBlock]) NEXT:[mark({ doSmth(3) })] PREV:[jmp(L4 [afterCatches])] + 2 jmp(L7 [skipFinallyToErrorBlock]) NEXT:[mark({ doSmth(3) })] PREV:[jmp(L4 [afterCatches])] L3 [onExceptionToFinallyBlock]: - mark({ doSmth(3) }) PREV:[jmp?(L3 [onExceptionToFinallyBlock])] + 5 mark({ doSmth(3) }) PREV:[jmp?(L3 [onExceptionToFinallyBlock])] mark(doSmth(3)) r(3) call(doSmth, doSmth) - jmp(error) NEXT:[] + 2 jmp(error) NEXT:[] L7 [skipFinallyToErrorBlock]: - mark({ doSmth(3) }) PREV:[jmp(L7 [skipFinallyToErrorBlock])] + 5 mark({ doSmth(3) }) PREV:[jmp(L7 [skipFinallyToErrorBlock])] mark(doSmth(3)) r(3) call(doSmth, doSmth) L1: - NEXT:[] PREV:[ret(*) L1, call(doSmth, doSmth)] + 1 NEXT:[] PREV:[ret(*) L1, call(doSmth, doSmth)] error: PREV:[jmp(error)] sink: @@ -923,13 +923,13 @@ fun doSmth(i: Int) { } --------------------- L0: - + 1 v(i: Int) w(i) - mark({ }) + 2 mark({ }) read (Unit) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/controlStructures/FinallyTestCopy.instructions b/compiler/testData/cfg/controlStructures/FinallyTestCopy.instructions index bdd12d67312..1d0c09a9bcc 100644 --- a/compiler/testData/cfg/controlStructures/FinallyTestCopy.instructions +++ b/compiler/testData/cfg/controlStructures/FinallyTestCopy.instructions @@ -2,11 +2,11 @@ fun doSmth() {} --------------------- L0: - - mark({}) + 1 + 2 mark({}) read (Unit) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: @@ -16,11 +16,11 @@ sink: fun doSmth1() {} --------------------- L0: - - mark({}) + 1 + 2 mark({}) read (Unit) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: @@ -30,11 +30,11 @@ sink: fun doSmth2() {} --------------------- L0: - - mark({}) + 1 + 2 mark({}) read (Unit) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: @@ -44,11 +44,11 @@ sink: fun cond() {} --------------------- L0: - - mark({}) + 1 + 2 mark({}) read (Unit) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: @@ -71,45 +71,45 @@ fun testCopy1() : Int { } --------------------- L0: - - mark({ try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { return 1 } }) + 1 + 2 mark({ try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { return 1 } }) mark(try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { return 1 }) jmp?(L2 [onException]) NEXT:[jmp?(L5 [catch 0]), jmp?(L3 [onExceptionToFinallyBlock])] jmp?(L3 [onExceptionToFinallyBlock]) NEXT:[mark({ return 1 }), mark({ doSmth() })] - mark({ doSmth() }) + 3 mark({ doSmth() }) mark(doSmth()) call(doSmth, doSmth) - jmp(L4 [afterCatches]) NEXT:[jmp(L6 [skipFinallyToErrorBlock])] + 2 jmp(L4 [afterCatches]) NEXT:[jmp(L6 [skipFinallyToErrorBlock])] L2 [onException]: jmp?(L5 [catch 0]) NEXT:[v(e: Exception), v(e: NullPointerException)] PREV:[jmp?(L2 [onException])] - v(e: NullPointerException) + 3 v(e: NullPointerException) w(e) - mark({ doSmth1() }) + 4 mark({ doSmth1() }) mark(doSmth1()) call(doSmth1, doSmth1) - jmp(L4 [afterCatches]) NEXT:[jmp(L6 [skipFinallyToErrorBlock])] + 3 jmp(L4 [afterCatches]) NEXT:[jmp(L6 [skipFinallyToErrorBlock])] L5 [catch 0]: v(e: Exception) PREV:[jmp?(L5 [catch 0])] w(e) - mark({ doSmth2() }) + 4 mark({ doSmth2() }) mark(doSmth2()) call(doSmth2, doSmth2) - jmp(L4 [afterCatches]) + 3 jmp(L4 [afterCatches]) L4 [afterCatches]: - jmp(L6 [skipFinallyToErrorBlock]) NEXT:[mark({ return 1 })] PREV:[jmp(L4 [afterCatches]), jmp(L4 [afterCatches]), jmp(L4 [afterCatches])] + 2 jmp(L6 [skipFinallyToErrorBlock]) NEXT:[mark({ return 1 })] PREV:[jmp(L4 [afterCatches]), jmp(L4 [afterCatches]), jmp(L4 [afterCatches])] L3 [onExceptionToFinallyBlock]: L7 [start finally]: - mark({ return 1 }) PREV:[jmp?(L3 [onExceptionToFinallyBlock])] + 3 mark({ return 1 }) PREV:[jmp?(L3 [onExceptionToFinallyBlock])] r(1) ret(*) L1 NEXT:[] L8 [finish finally]: -- jmp(error) NEXT:[] PREV:[] +- 2 jmp(error) NEXT:[] PREV:[] L6 [skipFinallyToErrorBlock]: - mark({ return 1 }) PREV:[jmp(L6 [skipFinallyToErrorBlock])] + 3 mark({ return 1 }) PREV:[jmp(L6 [skipFinallyToErrorBlock])] r(1) ret(*) L1 L1: - NEXT:[] PREV:[ret(*) L1, ret(*) L1] + 1 NEXT:[] PREV:[ret(*) L1, ret(*) L1] error: PREV:[] sink: @@ -135,8 +135,8 @@ fun testCopy2() { } --------------------- L0: - - mark({ while (cond()) { try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { if (cond()) return else continue } } }) + 1 + 2 mark({ while (cond()) { try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { if (cond()) return else continue } } }) mark(while (cond()) { try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { if (cond()) return else continue } }) L2 [loop entry point]: L5 [condition entry point]: @@ -144,34 +144,34 @@ L5 [condition entry point]: call(cond, cond) jf(L3 [loop exit point]) NEXT:[read (Unit), mark({ try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { if (cond()) return else continue } })] L4 [body entry point]: - mark({ try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { if (cond()) return else continue } }) + 3 mark({ try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { if (cond()) return else continue } }) mark(try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { if (cond()) return else continue }) jmp?(L6 [onException]) NEXT:[jmp?(L9 [catch 0]), jmp?(L7 [onExceptionToFinallyBlock])] jmp?(L7 [onExceptionToFinallyBlock]) NEXT:[mark({ if (cond()) return else continue }), mark({ doSmth() })] - mark({ doSmth() }) + 4 mark({ doSmth() }) mark(doSmth()) call(doSmth, doSmth) - jmp(L8 [afterCatches]) NEXT:[jmp(L10 [skipFinallyToErrorBlock])] + 3 jmp(L8 [afterCatches]) NEXT:[jmp(L10 [skipFinallyToErrorBlock])] L6 [onException]: jmp?(L9 [catch 0]) NEXT:[v(e: Exception), v(e: NullPointerException)] PREV:[jmp?(L6 [onException])] - v(e: NullPointerException) + 4 v(e: NullPointerException) w(e) - mark({ doSmth1() }) + 5 mark({ doSmth1() }) mark(doSmth1()) call(doSmth1, doSmth1) - jmp(L8 [afterCatches]) NEXT:[jmp(L10 [skipFinallyToErrorBlock])] + 4 jmp(L8 [afterCatches]) NEXT:[jmp(L10 [skipFinallyToErrorBlock])] L9 [catch 0]: v(e: Exception) PREV:[jmp?(L9 [catch 0])] w(e) - mark({ doSmth2() }) + 5 mark({ doSmth2() }) mark(doSmth2()) call(doSmth2, doSmth2) - jmp(L8 [afterCatches]) + 4 jmp(L8 [afterCatches]) L8 [afterCatches]: - jmp(L10 [skipFinallyToErrorBlock]) NEXT:[mark({ if (cond()) return else continue })] PREV:[jmp(L8 [afterCatches]), jmp(L8 [afterCatches]), jmp(L8 [afterCatches])] + 3 jmp(L10 [skipFinallyToErrorBlock]) NEXT:[mark({ if (cond()) return else continue })] PREV:[jmp(L8 [afterCatches]), jmp(L8 [afterCatches]), jmp(L8 [afterCatches])] L7 [onExceptionToFinallyBlock]: L11 [start finally]: - mark({ if (cond()) return else continue }) PREV:[jmp?(L7 [onExceptionToFinallyBlock])] + 4 mark({ if (cond()) return else continue }) PREV:[jmp?(L7 [onExceptionToFinallyBlock])] mark(if (cond()) return else continue) mark(cond()) call(cond, cond) @@ -182,9 +182,9 @@ L12: jmp(L2 [loop entry point]) NEXT:[mark(cond())] PREV:[jf(L12)] L13: L14 [finish finally]: -- jmp(error) NEXT:[] PREV:[] +- 3 jmp(error) NEXT:[] PREV:[] L10 [skipFinallyToErrorBlock]: - mark({ if (cond()) return else continue }) PREV:[jmp(L10 [skipFinallyToErrorBlock])] + 4 mark({ if (cond()) return else continue }) PREV:[jmp(L10 [skipFinallyToErrorBlock])] mark(if (cond()) return else continue) mark(cond()) call(cond, cond) @@ -192,11 +192,11 @@ L10 [skipFinallyToErrorBlock]: ret L1 NEXT:[] - jmp(copy L13) NEXT:[jmp(L2 [loop entry point])] PREV:[] jmp(L2 [loop entry point]) NEXT:[mark(cond())] PREV:[jf(copy L12)] -- jmp(L2 [loop entry point]) NEXT:[mark(cond())] PREV:[] +- 2 jmp(L2 [loop entry point]) NEXT:[mark(cond())] PREV:[] L3 [loop exit point]: read (Unit) PREV:[jf(L3 [loop exit point])] L1: - NEXT:[] PREV:[ret L1, ret L1, read (Unit)] + 1 NEXT:[] PREV:[ret L1, ret L1, read (Unit)] error: PREV:[] sink: @@ -219,35 +219,35 @@ fun testCopy3() { } --------------------- L0: - - mark({ try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { while (cond()); } }) + 1 + 2 mark({ try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { while (cond()); } }) mark(try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { while (cond()); }) jmp?(L2 [onException]) NEXT:[jmp?(L5 [catch 0]), jmp?(L3 [onExceptionToFinallyBlock])] jmp?(L3 [onExceptionToFinallyBlock]) NEXT:[mark({ while (cond()); }), mark({ doSmth() })] - mark({ doSmth() }) + 3 mark({ doSmth() }) mark(doSmth()) call(doSmth, doSmth) - jmp(L4 [afterCatches]) NEXT:[jmp(L6 [skipFinallyToErrorBlock])] + 2 jmp(L4 [afterCatches]) NEXT:[jmp(L6 [skipFinallyToErrorBlock])] L2 [onException]: jmp?(L5 [catch 0]) NEXT:[v(e: Exception), v(e: NullPointerException)] PREV:[jmp?(L2 [onException])] - v(e: NullPointerException) + 3 v(e: NullPointerException) w(e) - mark({ doSmth1() }) + 4 mark({ doSmth1() }) mark(doSmth1()) call(doSmth1, doSmth1) - jmp(L4 [afterCatches]) NEXT:[jmp(L6 [skipFinallyToErrorBlock])] + 3 jmp(L4 [afterCatches]) NEXT:[jmp(L6 [skipFinallyToErrorBlock])] L5 [catch 0]: v(e: Exception) PREV:[jmp?(L5 [catch 0])] w(e) - mark({ doSmth2() }) + 4 mark({ doSmth2() }) mark(doSmth2()) call(doSmth2, doSmth2) - jmp(L4 [afterCatches]) + 3 jmp(L4 [afterCatches]) L4 [afterCatches]: - jmp(L6 [skipFinallyToErrorBlock]) NEXT:[mark({ while (cond()); })] PREV:[jmp(L4 [afterCatches]), jmp(L4 [afterCatches]), jmp(L4 [afterCatches])] + 2 jmp(L6 [skipFinallyToErrorBlock]) NEXT:[mark({ while (cond()); })] PREV:[jmp(L4 [afterCatches]), jmp(L4 [afterCatches]), jmp(L4 [afterCatches])] L3 [onExceptionToFinallyBlock]: L7 [start finally]: - mark({ while (cond()); }) PREV:[jmp?(L3 [onExceptionToFinallyBlock])] + 3 mark({ while (cond()); }) PREV:[jmp?(L3 [onExceptionToFinallyBlock])] mark(while (cond())) L8 [loop entry point]: L11 [condition entry point]: @@ -259,9 +259,9 @@ L10 [body entry point]: L9 [loop exit point]: read (Unit) PREV:[jf(L9 [loop exit point])] L12 [finish finally]: - jmp(error) NEXT:[] + 2 jmp(error) NEXT:[] L6 [skipFinallyToErrorBlock]: - mark({ while (cond()); }) PREV:[jmp(L6 [skipFinallyToErrorBlock])] + 3 mark({ while (cond()); }) PREV:[jmp(L6 [skipFinallyToErrorBlock])] mark(while (cond())) mark(cond()) PREV:[mark(while (cond())), jmp(copy L8 [loop entry point])] call(cond, cond) @@ -269,7 +269,7 @@ L6 [skipFinallyToErrorBlock]: jmp(copy L8 [loop entry point]) NEXT:[mark(cond())] read (Unit) PREV:[jf(copy L9 [loop exit point])] L1: - NEXT:[] + 1 NEXT:[] error: PREV:[jmp(error)] sink: @@ -287,47 +287,47 @@ fun doTestCopy4(list: List?) : Int { } --------------------- L0: - + 1 v(list: List?) w(list) - mark({ try { doSmth() } finally { if(list != null) { } } }) + 2 mark({ try { doSmth() } finally { if(list != null) { } } }) mark(try { doSmth() } finally { if(list != null) { } }) jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[mark({ if(list != null) { } }), mark({ doSmth() })] - mark({ doSmth() }) + 3 mark({ doSmth() }) mark(doSmth()) call(doSmth, doSmth) - jmp(L3 [skipFinallyToErrorBlock]) NEXT:[mark({ if(list != null) { } })] + 2 jmp(L3 [skipFinallyToErrorBlock]) NEXT:[mark({ if(list != null) { } })] L2 [onExceptionToFinallyBlock]: L4 [start finally]: - mark({ if(list != null) { } }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + 3 mark({ if(list != null) { } }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] mark(if(list != null) { }) mark(list != null) r(list) r(null) call(!=, equals) jf(L5) NEXT:[read (Unit), mark({ })] - mark({ }) + 4 mark({ }) read (Unit) - jmp(L6) NEXT:[jmp(error)] + 3 jmp(L6) NEXT:[jmp(error)] L5: read (Unit) PREV:[jf(L5)] L6: L7 [finish finally]: - jmp(error) NEXT:[] PREV:[jmp(L6), read (Unit)] + 2 jmp(error) NEXT:[] PREV:[jmp(L6), read (Unit)] L3 [skipFinallyToErrorBlock]: - mark({ if(list != null) { } }) PREV:[jmp(L3 [skipFinallyToErrorBlock])] + 3 mark({ if(list != null) { } }) PREV:[jmp(L3 [skipFinallyToErrorBlock])] mark(if(list != null) { }) mark(list != null) r(list) r(null) call(!=, equals) jf(copy L5) NEXT:[read (Unit), mark({ })] - mark({ }) + 4 mark({ }) read (Unit) - jmp(copy L6) NEXT:[] + 3 jmp(copy L6) NEXT:[] read (Unit) PREV:[jf(copy L5)] L1: - NEXT:[] PREV:[jmp(copy L6), read (Unit)] + 1 NEXT:[] PREV:[jmp(copy L6), read (Unit)] error: PREV:[jmp(error)] sink: diff --git a/compiler/testData/cfg/controlStructures/For.instructions b/compiler/testData/cfg/controlStructures/For.instructions index be2d7a23d21..bc0d47a75d4 100644 --- a/compiler/testData/cfg/controlStructures/For.instructions +++ b/compiler/testData/cfg/controlStructures/For.instructions @@ -6,9 +6,9 @@ fun t1() { } --------------------- L0: - - mark({ for (i in 1..2) { doSmth(i) } }) - mark(for (i in 1..2) { doSmth(i) }) + 1 + 2 mark({ for (i in 1..2) { doSmth(i) } }) + 3 mark(for (i in 1..2) { doSmth(i) }) mark(1..2) r(1) r(2) @@ -19,15 +19,15 @@ L3: jmp?(L2) NEXT:[read (Unit), mark({ doSmth(i) })] L4 [loop entry point]: L5 [body entry point]: - mark({ doSmth(i) }) PREV:[jmp?(L2), jmp?(L4 [loop entry point])] + 4 mark({ doSmth(i) }) PREV:[jmp?(L2), jmp?(L4 [loop entry point])] mark(doSmth(i)) r(i) call(doSmth, doSmth) - jmp?(L4 [loop entry point]) NEXT:[mark({ doSmth(i) }), read (Unit)] + 3 jmp?(L4 [loop entry point]) NEXT:[mark({ doSmth(i) }), read (Unit)] L2: read (Unit) PREV:[jmp?(L2), jmp?(L4 [loop entry point])] L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: @@ -37,13 +37,13 @@ sink: fun doSmth(i: Int) {} --------------------- L0: - + 1 v(i: Int) w(i) - mark({}) + 2 mark({}) read (Unit) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/controlStructures/If.instructions b/compiler/testData/cfg/controlStructures/If.instructions index 9a5f76422b9..13d0780b8ff 100644 --- a/compiler/testData/cfg/controlStructures/If.instructions +++ b/compiler/testData/cfg/controlStructures/If.instructions @@ -17,19 +17,19 @@ fun t1(b: Boolean) { } --------------------- L0: - + 1 v(b: Boolean) w(b) - mark({ var u: String if (b) { u = "s" } doSmth(u) var r: String if (b) { r = "s" } else { r = "t" } doSmth(r) }) + 2 mark({ var u: String if (b) { u = "s" } doSmth(u) var r: String if (b) { r = "s" } else { r = "t" } doSmth(r) }) v(var u: String) mark(if (b) { u = "s" }) r(b) jf(L2) NEXT:[read (Unit), mark({ u = "s" })] - mark({ u = "s" }) + 3 mark({ u = "s" }) mark("s") r("s") w(u) - jmp(L3) NEXT:[mark(doSmth(u))] + 2 jmp(L3) NEXT:[mark(doSmth(u))] L2: read (Unit) PREV:[jf(L2)] L3: @@ -40,22 +40,22 @@ L3: mark(if (b) { r = "s" } else { r = "t" }) r(b) jf(L4) NEXT:[mark({ r = "t" }), mark({ r = "s" })] - mark({ r = "s" }) + 3 mark({ r = "s" }) mark("s") r("s") w(r) - jmp(L5) NEXT:[mark(doSmth(r))] + 2 jmp(L5) NEXT:[mark(doSmth(r))] L4: - mark({ r = "t" }) PREV:[jf(L4)] + 3 mark({ r = "t" }) PREV:[jf(L4)] mark("t") r("t") w(r) L5: - mark(doSmth(r)) PREV:[jmp(L5), w(r)] + 2 mark(doSmth(r)) PREV:[jmp(L5), w(r)] r(r) call(doSmth, doSmth) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: @@ -74,19 +74,19 @@ fun t2(b: Boolean) { } --------------------- L0: - + 1 v(b: Boolean) w(b) - mark({ val i = 3 if (b) { return; } doSmth(i) if (i is Int) { return; } }) + 2 mark({ val i = 3 if (b) { return; } doSmth(i) if (i is Int) { return; } }) v(val i = 3) r(3) w(i) mark(if (b) { return; }) r(b) jf(L2) NEXT:[read (Unit), mark({ return; })] - mark({ return; }) + 3 mark({ return; }) ret L1 NEXT:[] -- jmp(L3) NEXT:[mark(doSmth(i))] PREV:[] +- 2 jmp(L3) NEXT:[mark(doSmth(i))] PREV:[] L2: read (Unit) PREV:[jf(L2)] L3: @@ -97,14 +97,14 @@ L3: mark(i is Int) r(i) jf(L4) NEXT:[read (Unit), mark({ return; })] - mark({ return; }) + 3 mark({ return; }) ret L1 NEXT:[] -- jmp(L5) NEXT:[] PREV:[] +- 2 jmp(L5) NEXT:[] PREV:[] L4: read (Unit) PREV:[jf(L4)] L1: L5: - NEXT:[] PREV:[ret L1, ret L1, read (Unit)] + 1 NEXT:[] PREV:[ret L1, ret L1, read (Unit)] error: PREV:[] sink: @@ -114,13 +114,13 @@ sink: fun doSmth(s: String) {} --------------------- L0: - + 1 v(s: String) w(s) - mark({}) + 2 mark({}) read (Unit) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/controlStructures/OnlyWhileInFunctionBody.instructions b/compiler/testData/cfg/controlStructures/OnlyWhileInFunctionBody.instructions index d29ea67abdf..62b6f1fde5f 100644 --- a/compiler/testData/cfg/controlStructures/OnlyWhileInFunctionBody.instructions +++ b/compiler/testData/cfg/controlStructures/OnlyWhileInFunctionBody.instructions @@ -6,8 +6,8 @@ fun main() { } --------------------- L0: - - mark({ while(1 > 0) { 2 } }) + 1 + 2 mark({ while(1 > 0) { 2 } }) mark(while(1 > 0) { 2 }) L2 [loop entry point]: L5 [condition entry point]: @@ -17,13 +17,13 @@ L5 [condition entry point]: call(>, compareTo) jf(L3 [loop exit point]) NEXT:[read (Unit), mark({ 2 })] L4 [body entry point]: - mark({ 2 }) + 3 mark({ 2 }) r(2) - jmp(L2 [loop entry point]) NEXT:[mark(1 > 0)] + 2 jmp(L2 [loop entry point]) NEXT:[mark(1 > 0)] L3 [loop exit point]: read (Unit) PREV:[jf(L3 [loop exit point])] L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: @@ -36,9 +36,9 @@ fun dowhile() { } --------------------- L0: - - mark({ do {return} while(1 > 0) }) - mark(do {return} while(1 > 0)) + 1 + 2 mark({ do {return} while(1 > 0) }) + 3 mark(do {return} while(1 > 0)) L2 [loop entry point]: L4 [body entry point]: mark({return}) @@ -52,7 +52,7 @@ L5 [condition entry point]: L3 [loop exit point]: - read (Unit) PREV:[] L1: - NEXT:[] PREV:[ret L1] + 1 NEXT:[] PREV:[ret L1] error: PREV:[] sink: diff --git a/compiler/testData/cfg/controlStructures/returnsInWhen.instructions b/compiler/testData/cfg/controlStructures/returnsInWhen.instructions index e5aeff8370e..7a0fc4b73dd 100644 --- a/compiler/testData/cfg/controlStructures/returnsInWhen.instructions +++ b/compiler/testData/cfg/controlStructures/returnsInWhen.instructions @@ -6,10 +6,10 @@ fun illegalWhenBlock(a: Any): Any { } --------------------- L0: - + 1 v(a: Any) w(a) - mark({ when(a) { is Int -> return a } }) + 2 mark({ when(a) { is Int -> return a } }) mark(when(a) { is Int -> return a }) r(a) mark(is Int -> return a) @@ -21,7 +21,7 @@ L3: L1: L2: L4: - NEXT:[] PREV:[jmp?(L4), ret(*) L1] + 1 NEXT:[] PREV:[jmp?(L4), ret(*) L1] error: PREV:[] sink: diff --git a/compiler/testData/cfg/conventions/equals.instructions b/compiler/testData/cfg/conventions/equals.instructions index 72b70160179..52dbbc29c35 100644 --- a/compiler/testData/cfg/conventions/equals.instructions +++ b/compiler/testData/cfg/conventions/equals.instructions @@ -5,26 +5,26 @@ fun foo(a: Int, b: Int) { } --------------------- L0: - + 1 v(a: Int) w(a) v(b: Int) w(b) - mark({ if (a == b) { } }) + 2 mark({ if (a == b) { } }) mark(if (a == b) { }) mark(a == b) r(a) r(b) call(==, equals) jf(L2) NEXT:[read (Unit), mark({ })] - mark({ }) + 3 mark({ }) read (Unit) - jmp(L3) NEXT:[] + 2 jmp(L3) NEXT:[] L2: read (Unit) PREV:[jf(L2)] L1: L3: - NEXT:[] PREV:[jmp(L3), read (Unit)] + 1 NEXT:[] PREV:[jmp(L3), read (Unit)] error: PREV:[] sink: diff --git a/compiler/testData/cfg/conventions/incrementAtTheEnd.instructions b/compiler/testData/cfg/conventions/incrementAtTheEnd.instructions index 080c35b051e..e2cb5d26a8f 100644 --- a/compiler/testData/cfg/conventions/incrementAtTheEnd.instructions +++ b/compiler/testData/cfg/conventions/incrementAtTheEnd.instructions @@ -5,8 +5,8 @@ fun foo() { } --------------------- L0: - - mark({ var i = 1 i++ }) + 1 + 2 mark({ var i = 1 i++ }) v(var i = 1) r(1) w(i) @@ -15,7 +15,7 @@ L0: call(++, inc) w(i) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/conventions/invoke.instructions b/compiler/testData/cfg/conventions/invoke.instructions index ad71705964e..343c30f3801 100644 --- a/compiler/testData/cfg/conventions/invoke.instructions +++ b/compiler/testData/cfg/conventions/invoke.instructions @@ -4,15 +4,15 @@ fun foo(f: () -> Unit) { } --------------------- L0: - + 1 v(f: () -> Unit) w(f) - mark({ f() }) + 2 mark({ f() }) mark(f()) r(f) call(f, invoke) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/conventions/notEqual.instructions b/compiler/testData/cfg/conventions/notEqual.instructions index 5bb121f60e4..c51afa63624 100644 --- a/compiler/testData/cfg/conventions/notEqual.instructions +++ b/compiler/testData/cfg/conventions/notEqual.instructions @@ -4,26 +4,26 @@ fun neq(a: Int, b: Int) { } --------------------- L0: - + 1 v(a: Int) w(a) v(b: Int) w(b) - mark({ if (a != b) {} }) + 2 mark({ if (a != b) {} }) mark(if (a != b) {}) mark(a != b) r(a) r(b) call(!=, equals) jf(L2) NEXT:[read (Unit), mark({})] - mark({}) + 3 mark({}) read (Unit) - jmp(L3) NEXT:[] + 2 jmp(L3) NEXT:[] L2: read (Unit) PREV:[jf(L2)] L1: L3: - NEXT:[] PREV:[jmp(L3), read (Unit)] + 1 NEXT:[] PREV:[jmp(L3), read (Unit)] error: PREV:[] sink: diff --git a/compiler/testData/cfg/deadCode/DeadCode.instructions b/compiler/testData/cfg/deadCode/DeadCode.instructions index 5dd0f437c37..966fa83e508 100644 --- a/compiler/testData/cfg/deadCode/DeadCode.instructions +++ b/compiler/testData/cfg/deadCode/DeadCode.instructions @@ -5,8 +5,8 @@ fun test() { } --------------------- L0: - - mark({ throw Exception() test() }) + 1 + 2 mark({ throw Exception() test() }) mark(throw Exception()) mark(Exception()) call(Exception, ) @@ -14,7 +14,7 @@ L0: - mark(test()) PREV:[] - call(test, test) PREV:[] L1: - NEXT:[] PREV:[] + 1 NEXT:[] PREV:[] error: PREV:[throw (throw Exception())] sink: diff --git a/compiler/testData/cfg/deadCode/returnInElvis.instructions b/compiler/testData/cfg/deadCode/returnInElvis.instructions index 2c55d538e82..563fc82a741 100644 --- a/compiler/testData/cfg/deadCode/returnInElvis.instructions +++ b/compiler/testData/cfg/deadCode/returnInElvis.instructions @@ -4,14 +4,14 @@ fun foo() { } --------------------- L0: - - mark({ return ?: null }) + 1 + 2 mark({ return ?: null }) ret L1 NEXT:[] - jt(L2) NEXT:[r(null), ] PREV:[] - r(null) PREV:[] L1: L2: - NEXT:[] PREV:[ret L1] + 1 NEXT:[] PREV:[ret L1] error: PREV:[] sink: diff --git a/compiler/testData/cfg/deadCode/stringTemplate.instructions b/compiler/testData/cfg/deadCode/stringTemplate.instructions index 6cffdc156cc..ae603b28b5a 100644 --- a/compiler/testData/cfg/deadCode/stringTemplate.instructions +++ b/compiler/testData/cfg/deadCode/stringTemplate.instructions @@ -4,8 +4,8 @@ fun test() { } --------------------- L0: - - mark({ "${throw Exception()} ${1}" }) + 1 + 2 mark({ "${throw Exception()} ${1}" }) mark("${throw Exception()} ${1}") mark(throw Exception()) mark(Exception()) @@ -14,7 +14,7 @@ L0: - r(1) PREV:[] - r("${throw Exception()} ${1}") PREV:[] L1: - NEXT:[] PREV:[] + 1 NEXT:[] PREV:[] error: PREV:[throw (throw Exception())] sink: diff --git a/compiler/testData/cfg/declarations/classesAndObjects/AnonymousInitializers.instructions b/compiler/testData/cfg/declarations/classesAndObjects/AnonymousInitializers.instructions index d22d4d0f285..0451dfb8c40 100644 --- a/compiler/testData/cfg/declarations/classesAndObjects/AnonymousInitializers.instructions +++ b/compiler/testData/cfg/declarations/classesAndObjects/AnonymousInitializers.instructions @@ -16,20 +16,20 @@ class AnonymousInitializers() { } --------------------- L0: - + 1 v(val k = 34) r(34) w(k) v(val i: Int) - mark({ $i = 12 }) + 2 mark({ $i = 12 }) r(12) w($i) - v(val j: Int get() = 20) - mark({ $i = 13 }) + 1 v(val j: Int get() = 20) + 2 mark({ $i = 13 }) r(13) w($i) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/declarations/functionLiterals/unusedFunctionLiteral.instructions b/compiler/testData/cfg/declarations/functionLiterals/unusedFunctionLiteral.instructions index c86ac76da0a..97b458a4612 100644 --- a/compiler/testData/cfg/declarations/functionLiterals/unusedFunctionLiteral.instructions +++ b/compiler/testData/cfg/declarations/functionLiterals/unusedFunctionLiteral.instructions @@ -4,15 +4,15 @@ fun foo() { } --------------------- L0: - - mark({ {} }) + 1 + 2 mark({ {} }) mark({}) jmp?(L2) NEXT:[r({}), d({})] d({}) NEXT:[] L2: r({}) PREV:[jmp?(L2)] L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: @@ -22,11 +22,11 @@ sink: {} --------------------- L3: - - mark() + 3 + 4 mark() read (Unit) L4: - NEXT:[] + 3 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/declarations/functions/FailFunction.instructions b/compiler/testData/cfg/declarations/functions/FailFunction.instructions index 62c235de482..e872ac58e63 100644 --- a/compiler/testData/cfg/declarations/functions/FailFunction.instructions +++ b/compiler/testData/cfg/declarations/functions/FailFunction.instructions @@ -4,15 +4,15 @@ fun fail() : Nothing { } --------------------- L0: - - mark({ throw java.lang.RuntimeException() }) + 1 + 2 mark({ throw java.lang.RuntimeException() }) mark(throw java.lang.RuntimeException()) mark(java.lang.RuntimeException()) mark(RuntimeException()) call(RuntimeException, ) throw (throw java.lang.RuntimeException()) NEXT:[] L1: - NEXT:[] PREV:[] + 1 NEXT:[] PREV:[] error: PREV:[throw (throw java.lang.RuntimeException())] sink: diff --git a/compiler/testData/cfg/declarations/functions/typeParameter.instructions b/compiler/testData/cfg/declarations/functions/typeParameter.instructions index baab291140d..19370b640e3 100644 --- a/compiler/testData/cfg/declarations/functions/typeParameter.instructions +++ b/compiler/testData/cfg/declarations/functions/typeParameter.instructions @@ -4,11 +4,11 @@ fun foo() { } --------------------- L0: - - mark({ T }) + 1 + 2 mark({ T }) error(T, No resolved call) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/declarations/local/LocalDeclarations.instructions b/compiler/testData/cfg/declarations/local/LocalDeclarations.instructions index 0249c69a987..8ab58efdc28 100644 --- a/compiler/testData/cfg/declarations/local/LocalDeclarations.instructions +++ b/compiler/testData/cfg/declarations/local/LocalDeclarations.instructions @@ -18,7 +18,7 @@ class C() { } --------------------- L0: - + 1 v(val a: Int = 1) r(1) w(a) @@ -33,13 +33,13 @@ sink: fun doSmth(i: Int) {} --------------------- L0: - + 1 v(i: Int) w(i) - mark({}) + 2 mark({}) read (Unit) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: @@ -56,18 +56,18 @@ fun test1() { } --------------------- L0: - - mark({ val a = object { val x : Int { $x = 1 } } }) + 1 + 2 mark({ val a = object { val x : Int { $x = 1 } } }) v(val a = object { val x : Int { $x = 1 } }) mark(object { val x : Int { $x = 1 } }) v(val x : Int) - mark({ $x = 1 }) + 3 mark({ $x = 1 }) r(1) w($x) - r(object { val x : Int { $x = 1 } }) + 2 r(object { val x : Int { $x = 1 } }) w(a) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: @@ -82,13 +82,13 @@ object O { } --------------------- L0: - + 1 v(val x : Int) - mark({ $x = 1 }) + 2 mark({ $x = 1 }) r(1) w($x) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: @@ -103,8 +103,8 @@ fun test2() { } --------------------- L0: - - mark({ val b = 1 val a = object { val x = b } }) + 1 + 2 mark({ val b = 1 val a = object { val x = b } }) v(val b = 1) r(1) w(b) @@ -116,7 +116,7 @@ L0: r(object { val x = b }) w(a) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: @@ -133,8 +133,8 @@ fun test3() { } --------------------- L0: - - mark({ val a = object { val y : Int fun inner_bar() { y = 10 } } }) + 1 + 2 mark({ val a = object { val y : Int fun inner_bar() { y = 10 } } }) 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) @@ -144,7 +144,7 @@ L2: r(object { val y : Int fun inner_bar() { y = 10 } }) PREV:[jmp?(L2)] w(a) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: @@ -156,12 +156,12 @@ fun inner_bar() { } --------------------- L3: - - mark({ y = 10 }) + 3 + 4 mark({ y = 10 }) r(10) w(y) L4: - NEXT:[] + 3 NEXT:[] error: PREV:[] sink: @@ -182,22 +182,22 @@ fun test4() { } --------------------- L0: - - mark({ val a = object { val x : Int val y : Int { $x = 1 } fun ggg() { y = 10 } } }) + 1 + 2 mark({ val a = object { val x : Int val y : Int { $x = 1 } fun ggg() { y = 10 } } }) v(val a = object { val x : Int val y : Int { $x = 1 } fun ggg() { y = 10 } }) mark(object { val x : Int val y : Int { $x = 1 } fun ggg() { y = 10 } }) v(val x : Int) v(val y : Int) - mark({ $x = 1 }) + 3 mark({ $x = 1 }) r(1) w($x) - 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) 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)] w(a) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: @@ -209,12 +209,12 @@ fun ggg() { } --------------------- L3: - - mark({ y = 10 }) + 3 + 4 mark({ y = 10 }) r(10) w(y) L4: - NEXT:[] + 3 NEXT:[] error: PREV:[] sink: @@ -237,17 +237,17 @@ fun test5() { } --------------------- L0: - - mark({ val a = object { var x = 1 { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } } }) + 1 + 2 mark({ val a = object { var x = 1 { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } } }) v(val a = object { var x = 1 { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) mark(object { var x = 1 { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) v(var x = 1) r(1) w(x) - mark({ $x = 2 }) + 3 mark({ $x = 2 }) r(2) w($x) - jmp?(L2) NEXT:[jmp?(L5), d(fun foo() { x = 3 })] + 2 jmp?(L2) NEXT:[jmp?(L5), 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)] @@ -256,7 +256,7 @@ L5: r(object { var x = 1 { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) PREV:[jmp?(L5)] w(a) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: @@ -268,12 +268,12 @@ fun foo() { } --------------------- L3: - - mark({ x = 3 }) + 3 + 4 mark({ x = 3 }) r(3) w(x) L4: - NEXT:[] + 3 NEXT:[] error: PREV:[] sink: @@ -285,12 +285,12 @@ fun bar() { } --------------------- L6: - - mark({ x = 4 }) + 3 + 4 mark({ x = 4 }) r(4) w(x) L7: - NEXT:[] + 3 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/declarations/local/ObjectExpression.instructions b/compiler/testData/cfg/declarations/local/ObjectExpression.instructions index 6f03c120bf3..50c341b4be3 100644 --- a/compiler/testData/cfg/declarations/local/ObjectExpression.instructions +++ b/compiler/testData/cfg/declarations/local/ObjectExpression.instructions @@ -4,7 +4,7 @@ trait A { } --------------------- L0: - + 1 L1: NEXT:[] error: @@ -16,7 +16,7 @@ sink: fun foo() : Int --------------------- L0: - + 1 L1: NEXT:[] error: @@ -30,7 +30,7 @@ class B : A { } --------------------- L0: - + 1 unsupported(DELEGATOR_SUPER_CLASS : A) L1: NEXT:[] @@ -43,7 +43,7 @@ sink: override fun foo() = 10 --------------------- L0: - + 1 r(10) L1: NEXT:[] @@ -59,10 +59,10 @@ fun foo(b: B) : Int { } --------------------- L0: - + 1 v(b: B) w(b) - mark({ val o = object : A by b {} return o.foo() }) + 2 mark({ val o = object : A by b {} return o.foo() }) v(val o = object : A by b {}) mark(object : A by b {}) r(b) @@ -74,7 +74,7 @@ L0: call(foo, foo) ret(*) L1 L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/declarations/local/localClass.instructions b/compiler/testData/cfg/declarations/local/localClass.instructions index d822caf23c5..86fd3a9c68b 100644 --- a/compiler/testData/cfg/declarations/local/localClass.instructions +++ b/compiler/testData/cfg/declarations/local/localClass.instructions @@ -12,13 +12,13 @@ fun f() { } --------------------- L0: - - mark({ class LocalClass() { fun f() { val x = "" fun loc() { val x3 = "" } } } }) + 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 = "" } })] d(fun f() { val x = "" fun loc() { val x3 = "" } }) NEXT:[] L1: L2: - NEXT:[] PREV:[jmp?(L2)] + 1 NEXT:[] PREV:[jmp?(L2)] error: PREV:[] sink: @@ -34,8 +34,8 @@ fun f() { } --------------------- L3: - - mark({ val x = "" fun loc() { val x3 = "" } }) + 3 + 4 mark({ val x = "" fun loc() { val x3 = "" } }) v(val x = "") mark("") r("") @@ -44,7 +44,7 @@ L3: d(fun loc() { val x3 = "" }) NEXT:[] L4: L5: - NEXT:[] PREV:[jmp?(L5)] + 3 NEXT:[] PREV:[jmp?(L5)] error: PREV:[] sink: @@ -56,14 +56,14 @@ fun loc() { } --------------------- L6: - - mark({ val x3 = "" }) + 5 + 6 mark({ val x3 = "" }) v(val x3 = "") mark("") r("") w(x3) L7: - NEXT:[] + 5 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/declarations/local/localProperty.instructions b/compiler/testData/cfg/declarations/local/localProperty.instructions index 51e8d451364..bd552c5e5f6 100644 --- a/compiler/testData/cfg/declarations/local/localProperty.instructions +++ b/compiler/testData/cfg/declarations/local/localProperty.instructions @@ -10,14 +10,14 @@ fun foo() { } --------------------- L0: - - mark({ class B { val a: Int get() { val b: Int return b } } }) + 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 })] d(get() { val b: Int return b }) NEXT:[] L1: L2: - NEXT:[] PREV:[jmp?(L2)] + 1 NEXT:[] PREV:[jmp?(L2)] error: PREV:[] sink: @@ -30,13 +30,13 @@ get() { } --------------------- L3: - - mark({ val b: Int return b }) + 3 + 4 mark({ val b: Int return b }) v(val b: Int) r(b) ret(*) L4 L4: - NEXT:[] + 3 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/declarations/multiDeclaration/MultiDecl.instructions b/compiler/testData/cfg/declarations/multiDeclaration/MultiDecl.instructions index 24feb88a7a0..cda2ea6f8c2 100644 --- a/compiler/testData/cfg/declarations/multiDeclaration/MultiDecl.instructions +++ b/compiler/testData/cfg/declarations/multiDeclaration/MultiDecl.instructions @@ -5,7 +5,7 @@ class C { } --------------------- L0: - + 1 L1: NEXT:[] error: @@ -17,7 +17,7 @@ sink: fun component1() = 1 --------------------- L0: - + 1 r(1) L1: NEXT:[] @@ -30,7 +30,7 @@ sink: fun component2() = 2 --------------------- L0: - + 1 r(2) L1: NEXT:[] @@ -46,10 +46,10 @@ fun test(c: C) { } --------------------- L0: - + 1 v(c: C) w(c) - mark({ val (a, b) = c val d = 1 }) + 2 mark({ val (a, b) = c val d = 1 }) r(c) v(a) call(a, component1) @@ -61,7 +61,7 @@ L0: r(1) w(d) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/declarations/multiDeclaration/multiDeclarationWithError.instructions b/compiler/testData/cfg/declarations/multiDeclaration/multiDeclarationWithError.instructions index b29bc7d469c..f3d578841e0 100644 --- a/compiler/testData/cfg/declarations/multiDeclaration/multiDeclarationWithError.instructions +++ b/compiler/testData/cfg/declarations/multiDeclaration/multiDeclarationWithError.instructions @@ -5,10 +5,10 @@ fun foo(x: Int) { } --------------------- L0: - + 1 v(x: Int) w(x) - mark({ val (a, b) = x a }) + 2 mark({ val (a, b) = x a }) r(x) v(a) w(a) @@ -16,7 +16,7 @@ L0: w(b) r(a) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/declarations/properties/DelegatedProperty.instructions b/compiler/testData/cfg/declarations/properties/DelegatedProperty.instructions index bde85a89eb3..9beaaa9dce4 100644 --- a/compiler/testData/cfg/declarations/properties/DelegatedProperty.instructions +++ b/compiler/testData/cfg/declarations/properties/DelegatedProperty.instructions @@ -4,7 +4,7 @@ class Delegate { } --------------------- L0: - + 1 L1: NEXT:[] error: @@ -16,7 +16,7 @@ sink: fun get(_this: Any, p: PropertyMetadata): Int = 0 --------------------- L0: - + 1 v(_this: Any) w(_this) v(p: PropertyMetadata) @@ -33,7 +33,7 @@ sink: val a = Delegate() --------------------- L0: - + 1 v(val a = Delegate()) mark(Delegate()) call(Delegate, ) @@ -49,7 +49,7 @@ sink: val b by a --------------------- L0: - + 1 v(val b by a) r(a) L1: diff --git a/compiler/testData/cfg/declarations/properties/backingFieldAccess.instructions b/compiler/testData/cfg/declarations/properties/backingFieldAccess.instructions index a505eddf68f..63a417ffcb9 100644 --- a/compiler/testData/cfg/declarations/properties/backingFieldAccess.instructions +++ b/compiler/testData/cfg/declarations/properties/backingFieldAccess.instructions @@ -9,12 +9,12 @@ class C { } --------------------- L0: - + 1 v(val a: Int get() = 1) - mark({ $a }) + 2 mark({ $a }) r($a) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/declarations/properties/backingFieldQualifiedWithThis.instructions b/compiler/testData/cfg/declarations/properties/backingFieldQualifiedWithThis.instructions index 2c9520ad281..de82eb00ed5 100644 --- a/compiler/testData/cfg/declarations/properties/backingFieldQualifiedWithThis.instructions +++ b/compiler/testData/cfg/declarations/properties/backingFieldQualifiedWithThis.instructions @@ -5,7 +5,7 @@ abstract class Bar { } --------------------- L0: - + 1 v(abstract var bar : String) L1: NEXT:[] @@ -18,7 +18,7 @@ sink: fun foo() = "foo" + this.$bar --------------------- L0: - + 1 mark("foo" + this.$bar) mark("foo") r("foo") diff --git a/compiler/testData/cfg/expressions/Assignments.instructions b/compiler/testData/cfg/expressions/Assignments.instructions index 8fcbf55c320..90396adefd3 100644 --- a/compiler/testData/cfg/expressions/Assignments.instructions +++ b/compiler/testData/cfg/expressions/Assignments.instructions @@ -4,7 +4,7 @@ class Test { } --------------------- L0: - + 1 v(var x : Int;) L1: NEXT:[] @@ -29,8 +29,8 @@ fun assignments() : Unit { } --------------------- L0: - - mark({ var x = 1 x = 2 x += 2 x = if (true) 1 else 2 val y = true && false val z = false && true val t = Test(); t.x = 1 }) + 1 + 2 mark({ var x = 1 x = 2 x += 2 x = if (true) 1 else 2 val y = true && false val z = false && true val t = Test(); t.x = 1 }) v(var x = 1) r(1) w(x) @@ -72,7 +72,7 @@ L5: r(t) w(t.x) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/expressions/LazyBooleans.instructions b/compiler/testData/cfg/expressions/LazyBooleans.instructions index da8836064b8..90d788b06e8 100644 --- a/compiler/testData/cfg/expressions/LazyBooleans.instructions +++ b/compiler/testData/cfg/expressions/LazyBooleans.instructions @@ -18,23 +18,23 @@ fun lazyBooleans(a : Boolean, b : Boolean) : Unit { } --------------------- L0: - + 1 v(a : Boolean) w(a) v(b : Boolean) w(b) - 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 }) + 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 })] - mark({ 1 }) + 3 mark({ 1 }) r(1) - jmp(L3) NEXT:[r(3)] + 2 jmp(L3) NEXT:[r(3)] L2: - mark({ 2 }) PREV:[jf(L2)] + 3 mark({ 2 }) PREV:[jf(L2)] r(2) L3: - r(3) PREV:[jmp(L3), r(2)] + 2 r(3) PREV:[jmp(L3), r(2)] mark(if (a && b) 5 else 6) r(a) jf(L4) NEXT:[jf(L5), r(b)] @@ -78,7 +78,7 @@ L12: L13: r(14) PREV:[jmp(L13), r(13)] L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/expressions/ReturnFromExpression.instructions b/compiler/testData/cfg/expressions/ReturnFromExpression.instructions index a78cbf012d9..22ef4e698df 100644 --- a/compiler/testData/cfg/expressions/ReturnFromExpression.instructions +++ b/compiler/testData/cfg/expressions/ReturnFromExpression.instructions @@ -4,8 +4,8 @@ fun blockAndAndMismatch() : Boolean { } --------------------- L0: - - mark({ false || (return false) }) + 1 + 2 mark({ false || (return false) }) r(false) jt(L2) NEXT:[mark((return false)), r(false || (return false))] mark((return false)) @@ -14,7 +14,7 @@ L0: L2: r(false || (return false)) PREV:[jt(L2)] L1: - NEXT:[] PREV:[ret(*) L1, r(false || (return false))] + 1 NEXT:[] PREV:[ret(*) L1, r(false || (return false))] error: PREV:[] sink: diff --git a/compiler/testData/cfg/expressions/assignmentToThis.instructions b/compiler/testData/cfg/expressions/assignmentToThis.instructions index 27b97620025..0d47e9f9d5d 100644 --- a/compiler/testData/cfg/expressions/assignmentToThis.instructions +++ b/compiler/testData/cfg/expressions/assignmentToThis.instructions @@ -4,14 +4,14 @@ fun Int.bar(c: C) { } --------------------- L0: - + 1 v(c: C) w(c) - mark({ this = c }) + 2 mark({ this = c }) r(c) unsupported(BINARY_EXPRESSION : this = c) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/expressions/chainedQualifiedExpression.instructions b/compiler/testData/cfg/expressions/chainedQualifiedExpression.instructions index 4952be7efef..e22d69ede6a 100644 --- a/compiler/testData/cfg/expressions/chainedQualifiedExpression.instructions +++ b/compiler/testData/cfg/expressions/chainedQualifiedExpression.instructions @@ -2,7 +2,7 @@ class JetToken --------------------- L0: - + 1 L1: NEXT:[] error: @@ -59,8 +59,8 @@ public open class JetKeywordCompletionContributor() { } --------------------- L0: - - mark({ val inTopLevel = 1.0 BunchKeywordRegister() .add(ABSTRACT_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(FINAL_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(OPEN_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(INTERNAL_KEYWORD, inTopLevel, inTopLevel, inTopLevel, inTopLevel) .add(PRIVATE_KEYWORD, inTopLevel, inTopLevel, inTopLevel, inTopLevel) .add(PROTECTED_KEYWORD, inTopLevel, inTopLevel, inTopLevel, inTopLevel) .add(PUBLIC_KEYWORD, inTopLevel, inTopLevel, inTopLevel, inTopLevel) .add(CLASS_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(ENUM_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(FUN_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(GET_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(SET_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(TRAIT_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(VAL_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(VAR_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(TYPE_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(IMPORT_KEYWORD, inTopLevel) .add(PACKAGE_KEYWORD, inTopLevel) .add(OVERRIDE_KEYWORD, inTopLevel) .add(IN_KEYWORD, inTopLevel, inTopLevel) .add(OUT_KEYWORD, inTopLevel) .add(OBJECT_KEYWORD, unresolvedCode) .registerAll() }) + 1 + 2 mark({ val inTopLevel = 1.0 BunchKeywordRegister() .add(ABSTRACT_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(FINAL_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(OPEN_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(INTERNAL_KEYWORD, inTopLevel, inTopLevel, inTopLevel, inTopLevel) .add(PRIVATE_KEYWORD, inTopLevel, inTopLevel, inTopLevel, inTopLevel) .add(PROTECTED_KEYWORD, inTopLevel, inTopLevel, inTopLevel, inTopLevel) .add(PUBLIC_KEYWORD, inTopLevel, inTopLevel, inTopLevel, inTopLevel) .add(CLASS_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(ENUM_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(FUN_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(GET_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(SET_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(TRAIT_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(VAL_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(VAR_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(TYPE_KEYWORD, inTopLevel, inTopLevel, inTopLevel) .add(IMPORT_KEYWORD, inTopLevel) .add(PACKAGE_KEYWORD, inTopLevel) .add(OVERRIDE_KEYWORD, inTopLevel) .add(IN_KEYWORD, inTopLevel, inTopLevel) .add(OUT_KEYWORD, inTopLevel) .add(OBJECT_KEYWORD, unresolvedCode) .registerAll() }) v(val inTopLevel = 1.0) r(1.0) w(inTopLevel) @@ -217,7 +217,7 @@ L0: call(add, add) call(registerAll, registerAll) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: @@ -227,7 +227,7 @@ sink: val ABSTRACT_KEYWORD = JetToken() --------------------- L0: - + 1 v(val ABSTRACT_KEYWORD = JetToken()) mark(JetToken()) call(JetToken, ) @@ -243,7 +243,7 @@ sink: val FINAL_KEYWORD OPEN_KEYWORD = JetToken() --------------------- L0: - + 1 v(val FINAL_KEYWORD OPEN_KEYWORD = JetToken()) L1: NEXT:[] @@ -256,7 +256,7 @@ sink: val OPEN_KEYWORD = JetToken() --------------------- L0: - + 1 v(val OPEN_KEYWORD = JetToken()) mark(JetToken()) call(JetToken, ) @@ -272,7 +272,7 @@ sink: val INTERNAL_KEYWORD = JetToken() --------------------- L0: - + 1 v(val INTERNAL_KEYWORD = JetToken()) mark(JetToken()) call(JetToken, ) @@ -288,7 +288,7 @@ sink: val PRIVATE_KEYWORD = JetToken() --------------------- L0: - + 1 v(val PRIVATE_KEYWORD = JetToken()) mark(JetToken()) call(JetToken, ) @@ -304,7 +304,7 @@ sink: val PROTECTED_KEYWORD = JetToken() --------------------- L0: - + 1 v(val PROTECTED_KEYWORD = JetToken()) mark(JetToken()) call(JetToken, ) @@ -320,7 +320,7 @@ sink: val PUBLIC_KEYWORD = JetToken() --------------------- L0: - + 1 v(val PUBLIC_KEYWORD = JetToken()) mark(JetToken()) call(JetToken, ) @@ -336,7 +336,7 @@ sink: val CLASS_KEYWORD = JetToken() --------------------- L0: - + 1 v(val CLASS_KEYWORD = JetToken()) mark(JetToken()) call(JetToken, ) @@ -352,7 +352,7 @@ sink: val ENUM_KEYWORD = JetToken() --------------------- L0: - + 1 v(val ENUM_KEYWORD = JetToken()) mark(JetToken()) call(JetToken, ) @@ -368,7 +368,7 @@ sink: val FUN_KEYWORD = JetToken() --------------------- L0: - + 1 v(val FUN_KEYWORD = JetToken()) mark(JetToken()) call(JetToken, ) @@ -384,7 +384,7 @@ sink: val GET_KEYWORD = JetToken() --------------------- L0: - + 1 v(val GET_KEYWORD = JetToken()) mark(JetToken()) call(JetToken, ) @@ -400,7 +400,7 @@ sink: val SET_KEYWORD = JetToken() --------------------- L0: - + 1 v(val SET_KEYWORD = JetToken()) mark(JetToken()) call(JetToken, ) @@ -416,7 +416,7 @@ sink: val TRAIT_KEYWORD = JetToken() --------------------- L0: - + 1 v(val TRAIT_KEYWORD = JetToken()) mark(JetToken()) call(JetToken, ) @@ -432,7 +432,7 @@ sink: val VAL_KEYWORD = JetToken() --------------------- L0: - + 1 v(val VAL_KEYWORD = JetToken()) mark(JetToken()) call(JetToken, ) @@ -448,7 +448,7 @@ sink: val VAR_KEYWORD = JetToken() --------------------- L0: - + 1 v(val VAR_KEYWORD = JetToken()) mark(JetToken()) call(JetToken, ) @@ -464,7 +464,7 @@ sink: val TYPE_KEYWORD = JetToken() --------------------- L0: - + 1 v(val TYPE_KEYWORD = JetToken()) mark(JetToken()) call(JetToken, ) @@ -480,7 +480,7 @@ sink: val IMPORT_KEYWORD = JetToken() --------------------- L0: - + 1 v(val IMPORT_KEYWORD = JetToken()) mark(JetToken()) call(JetToken, ) @@ -496,7 +496,7 @@ sink: val PACKAGE_KEYWORD = JetToken() --------------------- L0: - + 1 v(val PACKAGE_KEYWORD = JetToken()) mark(JetToken()) call(JetToken, ) @@ -512,7 +512,7 @@ sink: val OVERRIDE_KEYWORD = JetToken() --------------------- L0: - + 1 v(val OVERRIDE_KEYWORD = JetToken()) mark(JetToken()) call(JetToken, ) @@ -528,7 +528,7 @@ sink: val IN_KEYWORD = JetToken() --------------------- L0: - + 1 v(val IN_KEYWORD = JetToken()) mark(JetToken()) call(JetToken, ) @@ -544,7 +544,7 @@ sink: val OUT_KEYWORD = JetToken() --------------------- L0: - + 1 v(val OUT_KEYWORD = JetToken()) mark(JetToken()) call(JetToken, ) @@ -560,7 +560,7 @@ sink: val OBJECT_KEYWORD = JetToken() --------------------- L0: - + 1 v(val OBJECT_KEYWORD = JetToken()) mark(JetToken()) call(JetToken, ) diff --git a/compiler/testData/cfg/expressions/expressionAsFunction.instructions b/compiler/testData/cfg/expressions/expressionAsFunction.instructions index bfd302189d1..d55d17078b1 100644 --- a/compiler/testData/cfg/expressions/expressionAsFunction.instructions +++ b/compiler/testData/cfg/expressions/expressionAsFunction.instructions @@ -4,16 +4,16 @@ fun invoke(f: () -> Unit) { } --------------------- L0: - + 1 v(f: () -> Unit) w(f) - mark({ (f)() }) + 2 mark({ (f)() }) mark((f)()) mark((f)) r(f) call((f), ) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/expressions/propertySafeCall.instructions b/compiler/testData/cfg/expressions/propertySafeCall.instructions index ba87073cdd5..2a6f2ed4c90 100644 --- a/compiler/testData/cfg/expressions/propertySafeCall.instructions +++ b/compiler/testData/cfg/expressions/propertySafeCall.instructions @@ -4,15 +4,15 @@ fun test(s: String?) { } --------------------- L0: - + 1 v(s: String?) w(s) - mark({ s?.length }) + 2 mark({ s?.length }) mark(s?.length) r(s) r(length) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/expressions/qualifiedExpressionWithoutSelector.instructions b/compiler/testData/cfg/expressions/qualifiedExpressionWithoutSelector.instructions index da2e827fef1..237002a0aba 100644 --- a/compiler/testData/cfg/expressions/qualifiedExpressionWithoutSelector.instructions +++ b/compiler/testData/cfg/expressions/qualifiedExpressionWithoutSelector.instructions @@ -4,14 +4,14 @@ fun foo(s: String) { } --------------------- L0: - + 1 v(s: String) w(s) - mark({ s. }) + 2 mark({ s. }) mark(s.) r(s) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/expressions/thisExpression.instructions b/compiler/testData/cfg/expressions/thisExpression.instructions index e7afb9d7dff..907b4c530e5 100644 --- a/compiler/testData/cfg/expressions/thisExpression.instructions +++ b/compiler/testData/cfg/expressions/thisExpression.instructions @@ -4,13 +4,13 @@ fun Function0.foo() { } --------------------- L0: - - mark({ this() }) + 1 + 2 mark({ this() }) mark(this()) r(this) call(this, ) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/expressions/unresolved.instructions b/compiler/testData/cfg/expressions/unresolved.instructions index 349f0d13b7a..59cc3cdbb76 100644 --- a/compiler/testData/cfg/expressions/unresolved.instructions +++ b/compiler/testData/cfg/expressions/unresolved.instructions @@ -4,17 +4,17 @@ fun test(a: Any) { } --------------------- L0: - + 1 v(a: Any) w(a) - mark({ a.foo() }) + 2 mark({ a.foo() }) mark(a.foo()) mark(foo()) error(foo, No resolved call) error(foo, No resolved call) r(a) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/expressions/unusedExpressionSimpleName.instructions b/compiler/testData/cfg/expressions/unusedExpressionSimpleName.instructions index 57fd0a0f70e..29051e20e03 100644 --- a/compiler/testData/cfg/expressions/unusedExpressionSimpleName.instructions +++ b/compiler/testData/cfg/expressions/unusedExpressionSimpleName.instructions @@ -4,13 +4,13 @@ fun main(arg : Array) { } --------------------- L0: - + 1 v(arg : Array) w(arg) - mark({ a }) + 2 mark({ a }) error(a, No resolved call) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/tailCalls/finally.instructions b/compiler/testData/cfg/tailCalls/finally.instructions index 8a7f98d1e34..da92e99985a 100644 --- a/compiler/testData/cfg/tailCalls/finally.instructions +++ b/compiler/testData/cfg/tailCalls/finally.instructions @@ -8,26 +8,26 @@ tailRecursive fun test() : Int { } --------------------- L0: - - mark({ try { // do nothing } finally { test() } }) + 1 + 2 mark({ try { // do nothing } finally { test() } }) mark(try { // do nothing } finally { test() }) jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[mark({ test() }), mark({ // do nothing })] - mark({ // do nothing }) + 3 mark({ // do nothing }) read (Unit) - jmp(L3 [skipFinallyToErrorBlock]) NEXT:[mark({ test() })] + 2 jmp(L3 [skipFinallyToErrorBlock]) NEXT:[mark({ test() })] L2 [onExceptionToFinallyBlock]: L4 [start finally]: - mark({ test() }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + 3 mark({ test() }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] mark(test()) call(test, test) L5 [finish finally]: - jmp(error) NEXT:[] + 2 jmp(error) NEXT:[] L3 [skipFinallyToErrorBlock]: - mark({ test() }) PREV:[jmp(L3 [skipFinallyToErrorBlock])] + 3 mark({ test() }) PREV:[jmp(L3 [skipFinallyToErrorBlock])] mark(test()) call(test, test) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[jmp(error)] sink: diff --git a/compiler/testData/cfg/tailCalls/finallyWithReturn.instructions b/compiler/testData/cfg/tailCalls/finallyWithReturn.instructions index a3248bf0cda..c32c5ee1e69 100644 --- a/compiler/testData/cfg/tailCalls/finallyWithReturn.instructions +++ b/compiler/testData/cfg/tailCalls/finallyWithReturn.instructions @@ -8,28 +8,28 @@ tailRecursive fun test() : Int { } --------------------- L0: - - mark({ try { // do nothing } finally { return test() } }) + 1 + 2 mark({ try { // do nothing } finally { return test() } }) mark(try { // do nothing } finally { return test() }) jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[mark({ return test() }), mark({ // do nothing })] - mark({ // do nothing }) + 3 mark({ // do nothing }) read (Unit) - jmp(L3 [skipFinallyToErrorBlock]) NEXT:[mark({ return test() })] + 2 jmp(L3 [skipFinallyToErrorBlock]) NEXT:[mark({ return test() })] L2 [onExceptionToFinallyBlock]: L4 [start finally]: - mark({ return test() }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + 3 mark({ return test() }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] mark(test()) call(test, test) ret(*) L1 NEXT:[] L5 [finish finally]: -- jmp(error) NEXT:[] PREV:[] +- 2 jmp(error) NEXT:[] PREV:[] L3 [skipFinallyToErrorBlock]: - mark({ return test() }) PREV:[jmp(L3 [skipFinallyToErrorBlock])] + 3 mark({ return test() }) PREV:[jmp(L3 [skipFinallyToErrorBlock])] mark(test()) call(test, test) ret(*) L1 L1: - NEXT:[] PREV:[ret(*) L1, ret(*) L1] + 1 NEXT:[] PREV:[ret(*) L1, ret(*) L1] error: PREV:[] sink: diff --git a/compiler/testData/cfg/tailCalls/sum.instructions b/compiler/testData/cfg/tailCalls/sum.instructions index 2c205a26ab4..a761f5f7370 100644 --- a/compiler/testData/cfg/tailCalls/sum.instructions +++ b/compiler/testData/cfg/tailCalls/sum.instructions @@ -5,12 +5,12 @@ tailRecursive fun sum(x: Long, sum: Long): Long { } --------------------- L0: - + 1 v(x: Long) w(x) v(sum: Long) w(sum) - mark({ if (x == 0.toLong()) return sum return sum(x - 1, sum + x) }) + 2 mark({ if (x == 0.toLong()) return sum return sum(x - 1, sum + x) }) mark(if (x == 0.toLong()) return sum) mark(x == 0.toLong()) r(x) @@ -38,7 +38,7 @@ L3: call(sum, sum) ret(*) L1 L1: - NEXT:[] PREV:[ret(*) L1, ret(*) L1] + 1 NEXT:[] PREV:[ret(*) L1, ret(*) L1] error: PREV:[] sink: diff --git a/compiler/testData/cfg/tailCalls/try.instructions b/compiler/testData/cfg/tailCalls/try.instructions index e8a94b1bed8..74d41bf85b4 100644 --- a/compiler/testData/cfg/tailCalls/try.instructions +++ b/compiler/testData/cfg/tailCalls/try.instructions @@ -8,24 +8,24 @@ tailRecursive fun foo() { } --------------------- L0: - - mark({ try { return foo() } catch (e: Throwable) { } }) + 1 + 2 mark({ try { return foo() } catch (e: Throwable) { } }) mark(try { return foo() } catch (e: Throwable) { }) jmp?(L2 [onException]) NEXT:[v(e: Throwable), mark({ return foo() })] - mark({ return foo() }) + 3 mark({ return foo() }) mark(foo()) call(foo, foo) ret(*) L1 NEXT:[] -- jmp(L3 [afterCatches]) NEXT:[] PREV:[] +- 2 jmp(L3 [afterCatches]) NEXT:[] PREV:[] L2 [onException]: - v(e: Throwable) PREV:[jmp?(L2 [onException])] + 3 v(e: Throwable) PREV:[jmp?(L2 [onException])] w(e) - mark({ }) + 4 mark({ }) read (Unit) - jmp(L3 [afterCatches]) + 3 jmp(L3 [afterCatches]) L1: L3 [afterCatches]: - NEXT:[] PREV:[ret(*) L1, jmp(L3 [afterCatches])] + 1 NEXT:[] PREV:[ret(*) L1, jmp(L3 [afterCatches])] error: PREV:[] sink: diff --git a/compiler/testData/cfg/tailCalls/tryCatchFinally.instructions b/compiler/testData/cfg/tailCalls/tryCatchFinally.instructions index 271b8c8cf64..f1ec2da8673 100644 --- a/compiler/testData/cfg/tailCalls/tryCatchFinally.instructions +++ b/compiler/testData/cfg/tailCalls/tryCatchFinally.instructions @@ -10,37 +10,37 @@ fun test() : Unit { } --------------------- L0: - - mark({ try { test() } catch (any : Exception) { test() } finally { test() } }) + 1 + 2 mark({ try { test() } catch (any : Exception) { test() } finally { test() } }) mark(try { test() } catch (any : Exception) { test() } finally { test() }) jmp?(L2 [onException]) NEXT:[v(any : Exception), jmp?(L3 [onExceptionToFinallyBlock])] jmp?(L3 [onExceptionToFinallyBlock]) NEXT:[mark({ test() }), mark({ test() })] - mark({ test() }) + 3 mark({ test() }) mark(test()) call(test, test) - jmp(L4 [afterCatches]) NEXT:[jmp(L5 [skipFinallyToErrorBlock])] + 2 jmp(L4 [afterCatches]) NEXT:[jmp(L5 [skipFinallyToErrorBlock])] L2 [onException]: - v(any : Exception) PREV:[jmp?(L2 [onException])] + 3 v(any : Exception) PREV:[jmp?(L2 [onException])] w(any) - mark({ test() }) + 4 mark({ test() }) mark(test()) call(test, test) - jmp(L4 [afterCatches]) + 3 jmp(L4 [afterCatches]) L4 [afterCatches]: - jmp(L5 [skipFinallyToErrorBlock]) NEXT:[mark({ test() })] PREV:[jmp(L4 [afterCatches]), jmp(L4 [afterCatches])] + 2 jmp(L5 [skipFinallyToErrorBlock]) NEXT:[mark({ test() })] PREV:[jmp(L4 [afterCatches]), jmp(L4 [afterCatches])] L3 [onExceptionToFinallyBlock]: L6 [start finally]: - mark({ test() }) PREV:[jmp?(L3 [onExceptionToFinallyBlock])] + 3 mark({ test() }) PREV:[jmp?(L3 [onExceptionToFinallyBlock])] mark(test()) call(test, test) L7 [finish finally]: - jmp(error) NEXT:[] + 2 jmp(error) NEXT:[] L5 [skipFinallyToErrorBlock]: - mark({ test() }) PREV:[jmp(L5 [skipFinallyToErrorBlock])] + 3 mark({ test() }) PREV:[jmp(L5 [skipFinallyToErrorBlock])] mark(test()) call(test, test) L1: - NEXT:[] + 1 NEXT:[] error: PREV:[jmp(error)] sink: diff --git a/compiler/tests/org/jetbrains/jet/cfg/AbstractPseudocodeTest.java b/compiler/tests/org/jetbrains/jet/cfg/AbstractPseudocodeTest.java index 922f69c3c51..3214edce1e4 100644 --- a/compiler/tests/org/jetbrains/jet/cfg/AbstractPseudocodeTest.java +++ b/compiler/tests/org/jetbrains/jet/cfg/AbstractPseudocodeTest.java @@ -20,6 +20,7 @@ import com.google.common.collect.Sets; import com.intellij.openapi.util.text.StringUtil; import kotlin.Function3; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.ConfigurationKind; import org.jetbrains.jet.JetTestUtils; import org.jetbrains.jet.analyzer.AnalyzeExhaust; @@ -125,11 +126,27 @@ public abstract class AbstractPseudocodeTest extends KotlinTestWithEnvironment { protected void checkPseudocode(PseudocodeImpl pseudocode) { } - private static String formatInstruction(Instruction instruction, int maxLength, Set remainedAfterPostProcessInstructions) { - String[] parts = instruction.toString().split("\n"); + private String getIsDeadInstructionPrefix( + @NotNull Instruction instruction, + @NotNull Set remainedAfterPostProcessInstructions + ) { boolean isRemovedThroughPostProcess = !remainedAfterPostProcessInstructions.contains(instruction); assert isRemovedThroughPostProcess == ((InstructionImpl)instruction).isDead(); - String prefix = isRemovedThroughPostProcess ? "- " : " "; + return isRemovedThroughPostProcess ? "-" : " "; + } + + private String getDepthInstructionPrefix(@NotNull Instruction instruction, @Nullable Instruction previous) { + Integer prevDepth = previous != null ? previous.getLexicalScope().getDepth() : null; + int depth = instruction.getLexicalScope().getDepth(); + if (prevDepth == null || depth != prevDepth) { + return String.format("%2d ", depth); + } + return " "; + } + + private String formatInstruction(Instruction instruction, int maxLength, String prefix) { + String[] parts = instruction.toString().split("\n"); + if (parts.length == 1) { return prefix + String.format("%1$-" + maxLength + "s", instruction); } @@ -168,11 +185,14 @@ public abstract class AbstractPseudocodeTest extends KotlinTestWithEnvironment { StringBuilder line = new StringBuilder(); - line.append(formatInstruction(instruction, instructionColumnWidth, remainedAfterPostProcessInstructions)); - // Only print NEXT and PREV if the values are non-trivial Instruction next = i == instructions.size() - 1 ? null : instructions.get(i + 1); Instruction prev = i == 0 ? null : instructions.get(i - 1); + + String prefix = getIsDeadInstructionPrefix(instruction, remainedAfterPostProcessInstructions) + + getDepthInstructionPrefix(instruction, prev); + line.append(formatInstruction(instruction, instructionColumnWidth, prefix)); + line.append(getInstructionData.invoke(instruction, next, prev)); out.append(StringUtil.trimTrailing(line.toString())); diff --git a/compiler/tests/org/jetbrains/jet/cfg/DataFlowTestGenerated.java b/compiler/tests/org/jetbrains/jet/cfg/DataFlowTestGenerated.java index ce71735dc1b..51eef61cc4a 100644 --- a/compiler/tests/org/jetbrains/jet/cfg/DataFlowTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/cfg/DataFlowTestGenerated.java @@ -31,7 +31,7 @@ import org.jetbrains.jet.cfg.AbstractDataFlowTest; /** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") @TestMetadata("compiler/testData/cfg-variables") -@InnerTestClasses({DataFlowTestGenerated.Basic.class}) +@InnerTestClasses({DataFlowTestGenerated.Basic.class, DataFlowTestGenerated.LexicalScopes.class}) public class DataFlowTestGenerated extends AbstractDataFlowTest { public void testAllFilesPresentInCfg_variables() throws Exception { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/cfg-variables"), Pattern.compile("^(.+)\\.kt$"), true); @@ -70,10 +70,79 @@ public class DataFlowTestGenerated extends AbstractDataFlowTest { } + @TestMetadata("compiler/testData/cfg-variables/lexicalScopes") + public static class LexicalScopes extends AbstractDataFlowTest { + public void testAllFilesPresentInLexicalScopes() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("compiler/testData/cfg-variables/lexicalScopes"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("doWhileScope.kt") + public void testDoWhileScope() throws Exception { + doTest("compiler/testData/cfg-variables/lexicalScopes/doWhileScope.kt"); + } + + @TestMetadata("forScope.kt") + public void testForScope() throws Exception { + doTest("compiler/testData/cfg-variables/lexicalScopes/forScope.kt"); + } + + @TestMetadata("functionLiteralScope.kt") + public void testFunctionLiteralScope() throws Exception { + doTest("compiler/testData/cfg-variables/lexicalScopes/functionLiteralScope.kt"); + } + + @TestMetadata("ifScope.kt") + public void testIfScope() throws Exception { + doTest("compiler/testData/cfg-variables/lexicalScopes/ifScope.kt"); + } + + @TestMetadata("localClass.kt") + public void testLocalClass() throws Exception { + doTest("compiler/testData/cfg-variables/lexicalScopes/localClass.kt"); + } + + @TestMetadata("localFunctionScope.kt") + public void testLocalFunctionScope() throws Exception { + doTest("compiler/testData/cfg-variables/lexicalScopes/localFunctionScope.kt"); + } + + @TestMetadata("localFunctionScopeWithoutBody.kt") + public void testLocalFunctionScopeWithoutBody() throws Exception { + doTest("compiler/testData/cfg-variables/lexicalScopes/localFunctionScopeWithoutBody.kt"); + } + + @TestMetadata("localObject.kt") + public void testLocalObject() throws Exception { + doTest("compiler/testData/cfg-variables/lexicalScopes/localObject.kt"); + } + + @TestMetadata("objectLiteralScope.kt") + public void testObjectLiteralScope() throws Exception { + doTest("compiler/testData/cfg-variables/lexicalScopes/objectLiteralScope.kt"); + } + + @TestMetadata("propertyAccessorScope.kt") + public void testPropertyAccessorScope() throws Exception { + doTest("compiler/testData/cfg-variables/lexicalScopes/propertyAccessorScope.kt"); + } + + @TestMetadata("tryScope.kt") + public void testTryScope() throws Exception { + doTest("compiler/testData/cfg-variables/lexicalScopes/tryScope.kt"); + } + + @TestMetadata("whileScope.kt") + public void testWhileScope() throws Exception { + doTest("compiler/testData/cfg-variables/lexicalScopes/whileScope.kt"); + } + + } + public static Test suite() { TestSuite suite = new TestSuite("DataFlowTestGenerated"); suite.addTestSuite(DataFlowTestGenerated.class); suite.addTestSuite(Basic.class); + suite.addTestSuite(LexicalScopes.class); return suite; } }