From 87879ba65412b5367b2f16d0993e0277b5c813e3 Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Wed, 4 Dec 2013 14:30:41 +0400 Subject: [PATCH] Test data fixed: mark() instructions added --- .../cfg/AnonymousInitializers.instructions | 10 +- .../testData/cfg/ArrayAccess.instructions | 58 +- .../testData/cfg/Assignments.instructions | 78 +- compiler/testData/cfg/Basic.instructions | 90 +- .../cfg/DelegatedProperty.instructions | 1 + .../testData/cfg/EmptyFunction.instructions | 1 + .../testData/cfg/FailFunction.instructions | 16 +- compiler/testData/cfg/Finally.instructions | 896 +++++++++++------- compiler/testData/cfg/Finally.kt | 4 +- .../testData/cfg/FinallyTestCopy.instructions | 271 +++--- compiler/testData/cfg/For.instructions | 34 +- compiler/testData/cfg/If.instructions | 111 ++- .../testData/cfg/LazyBooleans.instructions | 92 +- .../cfg/LocalDeclarations.instructions | 257 ++--- compiler/testData/cfg/MultiDecl.instructions | 33 +- .../cfg/ObjectExpression.instructions | 30 +- .../cfg/OnlyWhileInFunctionBody.instructions | 50 +- .../cfg/ReturnFromExpression.instructions | 20 +- .../cfg/arrayAccessExpression.instructions | 4 + compiler/testData/cfg/arraySet.instructions | 22 +- .../cfg/arraySetPlusAssign.instructions | 33 +- .../cfg/assignmentToThis.instructions | 1 + .../cfg/backingFieldAccess.instructions | 9 +- .../cfg/deadCode/DeadCode.instructions | 18 +- .../cfg/deadCode/returnInElvis.instructions | 15 +- compiler/testData/cfg/equals.instructions | 34 +- .../cfg/expressionAsFunction.instructions | 3 + .../cfg/incrementAtTheEnd.instructions | 22 +- compiler/testData/cfg/invoke.instructions | 2 + .../multiDeclarationWithError.instructions | 25 +- compiler/testData/cfg/notEqual.instructions | 34 +- .../cfg/propertySafeCall.instructions | 18 +- .../testData/cfg/returnsInWhen.instructions | 18 +- .../testData/cfg/thisExpression.instructions | 2 + .../testData/cfg/typeParameter.instructions | 1 + compiler/testData/cfg/unresolved.instructions | 3 + .../cfg/unusedFunctionLiteral.instructions | 18 +- 37 files changed, 1358 insertions(+), 976 deletions(-) diff --git a/compiler/testData/cfg/AnonymousInitializers.instructions b/compiler/testData/cfg/AnonymousInitializers.instructions index d9105099c83..46519de211b 100644 --- a/compiler/testData/cfg/AnonymousInitializers.instructions +++ b/compiler/testData/cfg/AnonymousInitializers.instructions @@ -21,16 +21,18 @@ L0: r(34) w(k) v(val i: Int) + mark({ $i = 12 }) r(12) w($i) v(val j: Int get() = 20) - jmp?(L2) NEXT:[r(13), d(get() = 20)] - d(get() = 20) NEXT:[] + jmp?(L2) NEXT:[mark({ $i = 13 }), d(get() = 20)] + d(get() = 20) NEXT:[] L2: - r(13) PREV:[jmp?(L2)] + mark({ $i = 13 }) PREV:[jmp?(L2)] + r(13) w($i) L1: - NEXT:[] + NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/ArrayAccess.instructions b/compiler/testData/cfg/ArrayAccess.instructions index c7559866203..8e42eb99d62 100644 --- a/compiler/testData/cfg/ArrayAccess.instructions +++ b/compiler/testData/cfg/ArrayAccess.instructions @@ -10,33 +10,39 @@ fun foo() { } --------------------- L0: - - v(val a = Array) - call(Array, ) - w(a) - r(3) - r(a) - r(10) - r(4) - call(a[10], set) - r(2) - r(a) - r(10) - call(a[10], get) - r(100) - r(a) - r(10) - call(a[10], get) - r(1) - call(+=, plus) - r(a) - r(10) - r(1) - call(a[10], set) + + mark({ val a = Array 3 a[10] = 4 2 a[10] 100 a[10] += 1 }) + v(val a = Array) + mark(Array) + call(Array, ) + w(a) + r(3) + mark(a[10]) + r(a) + r(10) + r(4) + call(a[10], set) + r(2) + mark(a[10]) + r(a) + r(10) + call(a[10], get) + r(100) + mark(a[10] += 1) + mark(a[10]) + r(a) + r(10) + call(a[10], get) + r(1) + call(+=, plus) + r(a) + r(10) + r(1) + call(a[10], set) L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== diff --git a/compiler/testData/cfg/Assignments.instructions b/compiler/testData/cfg/Assignments.instructions index 8399c43d317..5d279c50b33 100644 --- a/compiler/testData/cfg/Assignments.instructions +++ b/compiler/testData/cfg/Assignments.instructions @@ -29,48 +29,52 @@ fun assignments() : Unit { } --------------------- L0: - - v(var x = 1) - r(1) - w(x) - r(2) - w(x) - r(x) - r(2) - call(+=, plus) - w(x) - r(true) - jf(L2) NEXT:[r(2), r(1)] - r(1) - jmp(L3) NEXT:[w(x)] + + 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) + r(2) + w(x) + mark(x += 2) + r(x) + r(2) + call(+=, plus) + w(x) + mark(if (true) 1 else 2) + r(true) + jf(L2) NEXT:[r(2), r(1)] + r(1) + jmp(L3) NEXT:[w(x)] L2: - r(2) PREV:[jf(L2)] + r(2) PREV:[jf(L2)] L3: - w(x) PREV:[jmp(L3), r(2)] - v(val y = true && false) - r(true) - jf(L4) NEXT:[r(true && false), r(false)] - r(false) + w(x) PREV:[jmp(L3), r(2)] + v(val y = true && false) + r(true) + jf(L4) NEXT:[r(true && false), r(false)] + r(false) L4: - r(true && false) PREV:[jf(L4), r(false)] - w(y) - v(val z = false && true) - r(false) - jf(L5) NEXT:[r(false && true), r(true)] - r(true) + r(true && false) PREV:[jf(L4), r(false)] + w(y) + v(val z = false && true) + r(false) + jf(L5) NEXT:[r(false && true), r(true)] + r(true) L5: - r(false && true) PREV:[jf(L5), r(true)] - w(z) - v(val t = Test()) - call(Test, ) - w(t) - r(1) - r(t) - w(t.x) + r(false && true) PREV:[jf(L5), r(true)] + w(z) + v(val t = Test()) + mark(Test()) + call(Test, ) + w(t) + r(1) + r(t) + w(t.x) L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== diff --git a/compiler/testData/cfg/Basic.instructions b/compiler/testData/cfg/Basic.instructions index 1633f282884..4a39a213c89 100644 --- a/compiler/testData/cfg/Basic.instructions +++ b/compiler/testData/cfg/Basic.instructions @@ -18,52 +18,64 @@ fun f(a : Boolean) : Unit { } --------------------- L0: - - v(a : Boolean) - w(a) - r(1) - r(a) - r(2) - call(toLong, toLong) - r(a) - r(3) - call(foo, foo) - call(genfun, genfun) - jmp?(L2) NEXT:[r({1}), d({1})] - d({1}) NEXT:[] + + 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 }) + r(1) + r(a) + mark(2.toLong()) + mark(toLong()) + r(2) + call(toLong, toLong) + mark(foo(a, 3)) + r(a) + r(3) + call(foo, foo) + mark(genfun()) + call(genfun, genfun) + mark(flfun {1}) + mark({1}) + jmp?(L2) NEXT:[r({1}), d({1})] + d({1}) NEXT:[] L2: - r({1}) PREV:[jmp?(L2)] - call(flfun, flfun) - r(3) - r(4) - call(equals, equals) - r(3) - r(4) - call(equals, equals) - r(1) - r(2) - call(+, plus) - r(a) - jf(L5) NEXT:[r(a && true), r(true)] - r(true) + r({1}) PREV:[jmp?(L2)] + call(flfun, flfun) + mark(3.equals(4)) + mark(equals(4)) + r(3) + r(4) + call(equals, equals) + mark(3 equals 4) + r(3) + r(4) + call(equals, equals) + mark(1 + 2) + r(1) + r(2) + call(+, plus) + r(a) + jf(L5) NEXT:[r(a && true), r(true)] + r(true) L5: - r(a && true) PREV:[jf(L5), r(true)] - r(a) - jt(L6) NEXT:[r(false), r(a || false)] - r(false) + r(a && true) PREV:[jf(L5), r(true)] + r(a) + jt(L6) NEXT:[r(false), r(a || false)] + r(false) L6: - r(a || false) PREV:[jt(L6), r(false)] + r(a || false) PREV:[jt(L6), r(false)] L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, , d({1})] + PREV:[, , d({1})] L3: + mark(1) r(1) L4: - NEXT:[] + NEXT:[] error: PREV:[] sink: @@ -74,9 +86,10 @@ sink: --------------------- L3: + mark(1) r(1) L4: - NEXT:[] + NEXT:[] error: PREV:[] sink: @@ -91,6 +104,7 @@ L0: w(a) v(b : Int) w(b) + mark({}) read (Unit) L1: NEXT:[] @@ -104,6 +118,7 @@ fun genfun() : Unit {} --------------------- L0: + mark({}) read (Unit) L1: NEXT:[] @@ -119,6 +134,7 @@ L0: v(f : () -> Any) w(f) + mark({}) read (Unit) L1: NEXT:[] diff --git a/compiler/testData/cfg/DelegatedProperty.instructions b/compiler/testData/cfg/DelegatedProperty.instructions index 06936f44b5d..c4092a14a3d 100644 --- a/compiler/testData/cfg/DelegatedProperty.instructions +++ b/compiler/testData/cfg/DelegatedProperty.instructions @@ -18,6 +18,7 @@ val a = Delegate() L0: v(val a = Delegate()) + mark(Delegate()) call(Delegate, ) w(a) L1: diff --git a/compiler/testData/cfg/EmptyFunction.instructions b/compiler/testData/cfg/EmptyFunction.instructions index bd55d8f0e74..0ac05d7378e 100644 --- a/compiler/testData/cfg/EmptyFunction.instructions +++ b/compiler/testData/cfg/EmptyFunction.instructions @@ -3,6 +3,7 @@ fun empty() {} --------------------- L0: + mark({}) read (Unit) L1: NEXT:[] diff --git a/compiler/testData/cfg/FailFunction.instructions b/compiler/testData/cfg/FailFunction.instructions index f324c48951e..71146eb9cfa 100644 --- a/compiler/testData/cfg/FailFunction.instructions +++ b/compiler/testData/cfg/FailFunction.instructions @@ -4,13 +4,17 @@ fun fail() : Nothing { } --------------------- L0: - - call(RuntimeException, ) - throw (throw java.lang.RuntimeException()) NEXT:[] + + 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:[] + NEXT:[] PREV:[] error: - PREV:[throw (throw java.lang.RuntimeException())] + PREV:[throw (throw java.lang.RuntimeException())] sink: - PREV:[, ] + PREV:[, ] ===================== diff --git a/compiler/testData/cfg/Finally.instructions b/compiler/testData/cfg/Finally.instructions index 8c03ba3d30a..5d06aa9302b 100644 --- a/compiler/testData/cfg/Finally.instructions +++ b/compiler/testData/cfg/Finally.instructions @@ -9,16 +9,21 @@ fun t1() { --------------------- L0: - jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[r(2), r(1)] + mark({ try { 1 } finally { 2 } }) + mark(try { 1 } finally { 2 }) + jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[mark({ 2 }), mark({ 1 })] + mark({ 1 }) r(1) - jmp(L3 [skipFinallyToErrorBlock]) NEXT:[r(2)] + jmp(L3 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L2 [onExceptionToFinallyBlock]: L4 [start finally]: - r(2) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + mark({ 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + r(2) L5 [finish finally]: jmp(error) NEXT:[] L3 [skipFinallyToErrorBlock]: - r(2) PREV:[jmp(L3 [skipFinallyToErrorBlock])] + mark({ 2 }) PREV:[jmp(L3 [skipFinallyToErrorBlock])] + r(2) L1: NEXT:[] error: @@ -39,39 +44,48 @@ fun t2() { } --------------------- L0: - - jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[r(2), r(1)] - r(1) - r(2) - r(3) - call(>, compareTo) - jf(L3) NEXT:[read (Unit), r(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 } }) + r(1) + mark(if (2 > 3) { return }) + mark(2 > 3) + r(2) + r(3) + call(>, compareTo) + jf(L3) NEXT:[read (Unit), mark({ return })] + mark({ return }) L4 [start finally]: - r(2) + mark({ 2 }) + r(2) L5 [finish finally]: - ret L1 NEXT:[] -- jmp(L6) NEXT:[jmp(L7 [skipFinallyToErrorBlock])] PREV:[] + ret L1 NEXT:[] +- jmp(L6) NEXT:[jmp(L7 [skipFinallyToErrorBlock])] PREV:[] L3: - read (Unit) PREV:[jf(L3)] + read (Unit) PREV:[jf(L3)] L6: - jmp(L7 [skipFinallyToErrorBlock]) NEXT:[r(2)] + jmp(L7 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L2 [onExceptionToFinallyBlock]: - r(2) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] - jmp(error) NEXT:[] + mark({ 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + r(2) + jmp(error) NEXT:[] L7 [skipFinallyToErrorBlock]: - r(2) PREV:[jmp(L7 [skipFinallyToErrorBlock])] + mark({ 2 }) PREV:[jmp(L7 [skipFinallyToErrorBlock])] + r(2) L1: - NEXT:[] PREV:[ret L1, r(2)] + NEXT:[] PREV:[ret L1, r(2)] error: - PREV:[jmp(error)] + PREV:[jmp(error)] sink: - PREV:[, ] + PREV:[, ] ===================== == t3 == fun t3() { try { 1 - @{ () => + @{ () -> if (2 > 3) { return@ } @@ -82,73 +96,88 @@ fun t3() { } --------------------- L0: - - jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[r(2), r(1)] - r(1) - jmp?(L3) NEXT:[r({ () => if (2 > 3) { return@ } }), d({ () => if (2 > 3) { return@ } })] - d({ () => if (2 > 3) { return@ } }) NEXT:[] + + 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@ } } }) + r(1) + mark(@{ () -> if (2 > 3) { return@ } }) + mark({ () -> if (2 > 3) { return@ } }) + jmp?(L3) NEXT:[r({ () -> if (2 > 3) { return@ } }), d({ () -> if (2 > 3) { return@ } })] + d({ () -> if (2 > 3) { return@ } }) NEXT:[] L3: - r({ () => if (2 > 3) { return@ } }) PREV:[jmp?(L3)] - jmp(L8 [skipFinallyToErrorBlock]) NEXT:[r(2)] + r({ () -> if (2 > 3) { return@ } }) PREV:[jmp?(L3)] + jmp(L8 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L2 [onExceptionToFinallyBlock]: L9 [start finally]: - r(2) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + mark({ 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + r(2) L10 [finish finally]: - jmp(error) NEXT:[] + jmp(error) NEXT:[] L8 [skipFinallyToErrorBlock]: - r(2) PREV:[jmp(L8 [skipFinallyToErrorBlock])] + mark({ 2 }) PREV:[jmp(L8 [skipFinallyToErrorBlock])] + r(2) L1: - NEXT:[] + NEXT:[] error: - PREV:[jmp(error)] + PREV:[jmp(error)] sink: - PREV:[, , d({ () => if (2 > 3) { return@ } })] + PREV:[, , d({ () -> if (2 > 3) { return@ } })] L4: - - r(2) - r(3) - call(>, compareTo) - jf(L6) NEXT:[read (Unit), ret L5] - ret L5 NEXT:[] -- jmp(L7) NEXT:[] PREV:[] + + 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@ }) + ret L5 NEXT:[] +- jmp(L7) NEXT:[] PREV:[] L6: - read (Unit) PREV:[jf(L6)] + read (Unit) PREV:[jf(L6)] L5: L7: - NEXT:[] PREV:[ret L5, read (Unit)] + NEXT:[] PREV:[ret L5, read (Unit)] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== == anonymous_0 == -{ () => +{ () -> if (2 > 3) { return@ } } --------------------- L4: - - r(2) - r(3) - call(>, compareTo) - jf(L6) NEXT:[read (Unit), ret L5] - ret L5 NEXT:[] -- jmp(L7) NEXT:[] PREV:[] + + 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@ }) + ret L5 NEXT:[] +- jmp(L7) NEXT:[] PREV:[] L6: - read (Unit) PREV:[jf(L6)] + read (Unit) PREV:[jf(L6)] L5: L7: - NEXT:[] PREV:[ret L5, read (Unit)] + NEXT:[] PREV:[ret L5, read (Unit)] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== == t4 == fun t4() { - @{ () => + @{ () -> try { 1 if (2 > 3) { @@ -161,48 +190,60 @@ fun t4() { } --------------------- L0: - - jmp?(L2) NEXT:[r({ () => try { 1 if (2 > 3) { return@ } } finally { 2 } }), d({ () => try { 1 if (2 > 3) { return@ } } finally { 2 } })] - d({ () => try { 1 if (2 > 3) { return@ } } finally { 2 } }) NEXT:[] + + 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 } })] + d({ () -> try { 1 if (2 > 3) { return@ } } finally { 2 } }) NEXT:[] L2: - r({ () => try { 1 if (2 > 3) { return@ } } finally { 2 } }) PREV:[jmp?(L2)] + r({ () -> try { 1 if (2 > 3) { return@ } } finally { 2 } }) PREV:[jmp?(L2)] L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, , d({ () => try { 1 if (2 > 3) { return@ } } finally { 2 } })] + PREV:[, , d({ () -> try { 1 if (2 > 3) { return@ } } finally { 2 } })] L3: - - jmp?(L5 [onExceptionToFinallyBlock]) NEXT:[r(2), r(1)] - r(1) - r(2) - r(3) - call(>, compareTo) - jf(L6) NEXT:[read (Unit), r(2)] + + 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@ } }) + r(1) + mark(if (2 > 3) { return@ }) + mark(2 > 3) + r(2) + r(3) + call(>, compareTo) + jf(L6) NEXT:[read (Unit), mark({ return@ })] + mark({ return@ }) L7 [start finally]: - r(2) + mark({ 2 }) + r(2) L8 [finish finally]: - ret L4 NEXT:[] -- jmp(L9) NEXT:[jmp(L10 [skipFinallyToErrorBlock])] PREV:[] + ret L4 NEXT:[] +- jmp(L9) NEXT:[jmp(L10 [skipFinallyToErrorBlock])] PREV:[] L6: - read (Unit) PREV:[jf(L6)] + read (Unit) PREV:[jf(L6)] L9: - jmp(L10 [skipFinallyToErrorBlock]) NEXT:[r(2)] + jmp(L10 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L5 [onExceptionToFinallyBlock]: - r(2) PREV:[jmp?(L5 [onExceptionToFinallyBlock])] - jmp(error) NEXT:[] + mark({ 2 }) PREV:[jmp?(L5 [onExceptionToFinallyBlock])] + r(2) + jmp(error) NEXT:[] L10 [skipFinallyToErrorBlock]: - r(2) PREV:[jmp(L10 [skipFinallyToErrorBlock])] + mark({ 2 }) PREV:[jmp(L10 [skipFinallyToErrorBlock])] + r(2) L4: - NEXT:[] PREV:[ret L4, r(2)] + NEXT:[] PREV:[ret L4, r(2)] error: - PREV:[jmp(error)] + PREV:[jmp(error)] sink: - PREV:[, ] + PREV:[, ] ===================== == anonymous_1 == -{ () => +{ () -> try { 1 if (2 > 3) { @@ -214,33 +255,42 @@ sink: } --------------------- L3: - - jmp?(L5 [onExceptionToFinallyBlock]) NEXT:[r(2), r(1)] - r(1) - r(2) - r(3) - call(>, compareTo) - jf(L6) NEXT:[read (Unit), r(2)] + + 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@ } }) + r(1) + mark(if (2 > 3) { return@ }) + mark(2 > 3) + r(2) + r(3) + call(>, compareTo) + jf(L6) NEXT:[read (Unit), mark({ return@ })] + mark({ return@ }) L7 [start finally]: - r(2) + mark({ 2 }) + r(2) L8 [finish finally]: - ret L4 NEXT:[] -- jmp(L9) NEXT:[jmp(L10 [skipFinallyToErrorBlock])] PREV:[] + ret L4 NEXT:[] +- jmp(L9) NEXT:[jmp(L10 [skipFinallyToErrorBlock])] PREV:[] L6: - read (Unit) PREV:[jf(L6)] + read (Unit) PREV:[jf(L6)] L9: - jmp(L10 [skipFinallyToErrorBlock]) NEXT:[r(2)] + jmp(L10 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L5 [onExceptionToFinallyBlock]: - r(2) PREV:[jmp?(L5 [onExceptionToFinallyBlock])] - jmp(error) NEXT:[] + mark({ 2 }) PREV:[jmp?(L5 [onExceptionToFinallyBlock])] + r(2) + jmp(error) NEXT:[] L10 [skipFinallyToErrorBlock]: - r(2) PREV:[jmp(L10 [skipFinallyToErrorBlock])] + mark({ 2 }) PREV:[jmp(L10 [skipFinallyToErrorBlock])] + r(2) L4: - NEXT:[] PREV:[ret L4, r(2)] + NEXT:[] PREV:[ret L4, r(2)] error: - PREV:[jmp(error)] + PREV:[jmp(error)] sink: - PREV:[, ] + PREV:[, ] ===================== == t5 == fun t5() { @@ -257,40 +307,52 @@ fun t5() { } --------------------- L0: - + + 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:[, jmp(L2 [loop 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]: - jmp?(L6 [onExceptionToFinallyBlock]) NEXT:[r(2), r(1)] - r(1) - r(2) - r(3) - call(>, compareTo) - jf(L7) NEXT:[read (Unit), r(2)] + 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 @ } }) + r(1) + mark(if (2 > 3) { break @ }) + mark(2 > 3) + r(2) + r(3) + call(>, compareTo) + jf(L7) NEXT:[read (Unit), mark({ break @ })] + mark({ break @ }) L8 [start finally]: - r(2) + mark({ 2 }) + r(2) L9 [finish finally]: - jmp(L3 [loop exit point]) NEXT:[read (Unit)] -- jmp(L10) NEXT:[jmp(L11 [skipFinallyToErrorBlock])] PREV:[] + jmp(L3 [loop exit point]) NEXT:[read (Unit)] +- jmp(L10) NEXT:[jmp(L11 [skipFinallyToErrorBlock])] PREV:[] L7: - read (Unit) PREV:[jf(L7)] + read (Unit) PREV:[jf(L7)] L10: - jmp(L11 [skipFinallyToErrorBlock]) NEXT:[r(2)] + jmp(L11 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L6 [onExceptionToFinallyBlock]: - r(2) PREV:[jmp?(L6 [onExceptionToFinallyBlock])] - jmp(error) NEXT:[] + mark({ 2 }) PREV:[jmp?(L6 [onExceptionToFinallyBlock])] + r(2) + jmp(error) NEXT:[] L11 [skipFinallyToErrorBlock]: - r(2) PREV:[jmp(L11 [skipFinallyToErrorBlock])] - jmp(L2 [loop entry point]) NEXT:[r(true)] + mark({ 2 }) PREV:[jmp(L11 [skipFinallyToErrorBlock])] + r(2) + jmp(L2 [loop entry point]) NEXT:[r(true)] L3 [loop exit point]: - read (Unit) PREV:[jmp(L3 [loop exit point])] + read (Unit) PREV:[jmp(L3 [loop exit point])] L1: - NEXT:[] + NEXT:[] error: - PREV:[jmp(error)] + PREV:[jmp(error)] sink: - PREV:[, ] + PREV:[, ] ===================== == t6 == fun t6() { @@ -308,40 +370,51 @@ fun t6() { } --------------------- L0: - - jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[r(2), r(true)] + + 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 }) + 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:[jmp?(L2 [onExceptionToFinallyBlock]), jmp(L3 [loop entry point])] + r(true) PREV:[mark(while(true) { 1 if (2 > 3) { break @ } }), jmp(L3 [loop entry point])] L5 [body entry point]: - r(1) - r(2) - r(3) - call(>, compareTo) - jf(L7) NEXT:[read (Unit), jmp(L4 [loop exit point])] - jmp(L4 [loop exit point]) NEXT:[read (Unit)] -- jmp(L8) NEXT:[jmp(L3 [loop entry point])] PREV:[] + mark({ 1 if (2 > 3) { break @ } }) + r(1) + mark(if (2 > 3) { break @ }) + mark(2 > 3) + r(2) + r(3) + call(>, compareTo) + jf(L7) NEXT:[read (Unit), mark({ break @ })] + mark({ break @ }) + jmp(L4 [loop exit point]) NEXT:[read (Unit)] +- jmp(L8) NEXT:[jmp(L3 [loop entry point])] PREV:[] L7: - read (Unit) PREV:[jf(L7)] + read (Unit) PREV:[jf(L7)] L8: - jmp(L3 [loop entry point]) NEXT:[r(true)] + 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:[r(2)] + read (Unit) PREV:[jmp(L4 [loop exit point])] + r(5) + jmp(L9 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L2 [onExceptionToFinallyBlock]: L10 [start finally]: - r(2) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + mark({ 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + r(2) L11 [finish finally]: - jmp(error) NEXT:[] + jmp(error) NEXT:[] L9 [skipFinallyToErrorBlock]: - r(2) PREV:[jmp(L9 [skipFinallyToErrorBlock])] + mark({ 2 }) PREV:[jmp(L9 [skipFinallyToErrorBlock])] + r(2) L1: - NEXT:[] + NEXT:[] error: - PREV:[jmp(error)] + PREV:[jmp(error)] sink: - PREV:[, ] + PREV:[, ] ===================== == t7 == fun t7() { @@ -358,39 +431,50 @@ fun t7() { } --------------------- L0: - - jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[r(2), r(true)] + + 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 @ } } }) + 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:[jmp?(L2 [onExceptionToFinallyBlock]), jmp(L3 [loop entry point])] + r(true) PREV:[mark(while(true) { 1 if (2 > 3) { break @ } }), jmp(L3 [loop entry point])] L5 [body entry point]: - r(1) - r(2) - r(3) - call(>, compareTo) - jf(L7) NEXT:[read (Unit), jmp(L4 [loop exit point])] - jmp(L4 [loop exit point]) NEXT:[read (Unit)] -- jmp(L8) NEXT:[jmp(L3 [loop entry point])] PREV:[] + mark({ 1 if (2 > 3) { break @ } }) + r(1) + mark(if (2 > 3) { break @ }) + mark(2 > 3) + r(2) + r(3) + call(>, compareTo) + jf(L7) NEXT:[read (Unit), mark({ break @ })] + mark({ break @ }) + jmp(L4 [loop exit point]) NEXT:[read (Unit)] +- jmp(L8) NEXT:[jmp(L3 [loop entry point])] PREV:[] L7: - read (Unit) PREV:[jf(L7)] + read (Unit) PREV:[jf(L7)] L8: - jmp(L3 [loop entry point]) NEXT:[r(true)] + jmp(L3 [loop entry point]) NEXT:[r(true)] L4 [loop exit point]: - read (Unit) PREV:[jmp(L4 [loop exit point])] - jmp(L9 [skipFinallyToErrorBlock]) NEXT:[r(2)] + read (Unit) PREV:[jmp(L4 [loop exit point])] + jmp(L9 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L2 [onExceptionToFinallyBlock]: L10 [start finally]: - r(2) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + mark({ 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + r(2) L11 [finish finally]: - jmp(error) NEXT:[] + jmp(error) NEXT:[] L9 [skipFinallyToErrorBlock]: - r(2) PREV:[jmp(L9 [skipFinallyToErrorBlock])] + mark({ 2 }) PREV:[jmp(L9 [skipFinallyToErrorBlock])] + r(2) L1: - NEXT:[] + NEXT:[] error: - PREV:[jmp(error)] + PREV:[jmp(error)] sink: - PREV:[, ] + PREV:[, ] ===================== == t8 == fun t8(a : Int) { @@ -407,47 +491,60 @@ fun t8(a : Int) { } --------------------- L0: - - v(a : Int) - w(a) - r(1) - r(a) - call(.., rangeTo) - v(i) - w(i) + + v(a : Int) + w(a) + 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 } }) + mark(1..a) + r(1) + r(a) + call(.., rangeTo) + v(i) + w(i) L3: - jmp?(L2) NEXT:[read (Unit), jmp?(L6 [onExceptionToFinallyBlock])] + jmp?(L2) NEXT:[read (Unit), mark({ try { 1 if (2 > 3) { continue @ } } finally { 2 } })] L4 [loop entry point]: L5 [body entry point]: - jmp?(L6 [onExceptionToFinallyBlock]) NEXT:[r(2), r(1)] PREV:[jmp?(L2), jmp(L4 [loop entry point]), jmp?(L4 [loop entry point])] - r(1) - r(2) - r(3) - call(>, compareTo) - jf(L7) NEXT:[read (Unit), r(2)] + 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 @ } }) + r(1) + mark(if (2 > 3) { continue @ }) + mark(2 > 3) + r(2) + r(3) + call(>, compareTo) + jf(L7) NEXT:[read (Unit), mark({ continue @ })] + mark({ continue @ }) L8 [start finally]: - r(2) + mark({ 2 }) + r(2) L9 [finish finally]: - jmp(L4 [loop entry point]) NEXT:[jmp?(L6 [onExceptionToFinallyBlock])] -- jmp(L10) NEXT:[jmp(L11 [skipFinallyToErrorBlock])] PREV:[] + jmp(L4 [loop entry point]) NEXT:[mark({ try { 1 if (2 > 3) { continue @ } } finally { 2 } })] +- jmp(L10) NEXT:[jmp(L11 [skipFinallyToErrorBlock])] PREV:[] L7: - read (Unit) PREV:[jf(L7)] + read (Unit) PREV:[jf(L7)] L10: - jmp(L11 [skipFinallyToErrorBlock]) NEXT:[r(2)] + jmp(L11 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L6 [onExceptionToFinallyBlock]: - r(2) PREV:[jmp?(L6 [onExceptionToFinallyBlock])] - jmp(error) NEXT:[] + mark({ 2 }) PREV:[jmp?(L6 [onExceptionToFinallyBlock])] + r(2) + jmp(error) NEXT:[] L11 [skipFinallyToErrorBlock]: - r(2) PREV:[jmp(L11 [skipFinallyToErrorBlock])] - jmp?(L4 [loop entry point]) NEXT:[jmp?(L6 [onExceptionToFinallyBlock]), read (Unit)] + 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)] L2: - read (Unit) PREV:[jmp?(L2), jmp?(L4 [loop entry point])] + read (Unit) PREV:[jmp?(L2), jmp?(L4 [loop entry point])] L1: - NEXT:[] + NEXT:[] error: - PREV:[jmp(error)] + PREV:[jmp(error)] sink: - PREV:[, ] + PREV:[, ] ===================== == t9 == fun t9(a : Int) { @@ -465,47 +562,59 @@ fun t9(a : Int) { } --------------------- L0: - - v(a : Int) - w(a) - jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[r(2), r(1)] - r(1) - r(a) - call(.., rangeTo) - v(i) - w(i) + + v(a : Int) + w(a) + 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 }) + mark(@ for (i in 1..a) { 1 if (2 > 3) { continue @ } }) + mark(for (i in 1..a) { 1 if (2 > 3) { continue @ } }) + mark(1..a) + r(1) + r(a) + call(.., rangeTo) + v(i) + w(i) L4: - jmp?(L3) NEXT:[read (Unit), r(1)] + jmp?(L3) NEXT:[read (Unit), mark({ 1 if (2 > 3) { continue @ } })] L5 [loop entry point]: L6 [body entry point]: - r(1) PREV:[jmp?(L3), jmp(L5 [loop entry point]), jmp?(L5 [loop entry point])] - r(2) - r(3) - call(>, compareTo) - jf(L7) NEXT:[read (Unit), jmp(L5 [loop entry point])] - jmp(L5 [loop entry point]) NEXT:[r(1)] -- jmp(L8) NEXT:[jmp?(L5 [loop entry point])] PREV:[] + 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) + r(2) + r(3) + call(>, compareTo) + jf(L7) NEXT:[read (Unit), mark({ continue @ })] + mark({ continue @ }) + jmp(L5 [loop entry point]) NEXT:[mark({ 1 if (2 > 3) { continue @ } })] +- jmp(L8) NEXT:[jmp?(L5 [loop entry point])] PREV:[] L7: - read (Unit) PREV:[jf(L7)] + read (Unit) PREV:[jf(L7)] L8: - jmp?(L5 [loop entry point]) NEXT:[r(1), read (Unit)] + 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:[r(2)] + read (Unit) PREV:[jmp?(L3), jmp?(L5 [loop entry point])] + r(5) + jmp(L9 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L2 [onExceptionToFinallyBlock]: L10 [start finally]: - r(2) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + mark({ 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + r(2) L11 [finish finally]: - jmp(error) NEXT:[] + jmp(error) NEXT:[] L9 [skipFinallyToErrorBlock]: - r(2) PREV:[jmp(L9 [skipFinallyToErrorBlock])] + mark({ 2 }) PREV:[jmp(L9 [skipFinallyToErrorBlock])] + r(2) L1: - NEXT:[] + NEXT:[] error: - PREV:[jmp(error)] + PREV:[jmp(error)] sink: - PREV:[, ] + PREV:[, ] ===================== == t10 == fun t10(a : Int) { @@ -522,46 +631,58 @@ fun t10(a : Int) { } --------------------- L0: - - v(a : Int) - w(a) - jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[r(2), r(1)] - r(1) - r(a) - call(.., rangeTo) - v(i) - w(i) + + v(a : Int) + w(a) + 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 @ } } }) + mark(@ for (i in 1..a) { 1 if (2 > 3) { continue @ } }) + mark(for (i in 1..a) { 1 if (2 > 3) { continue @ } }) + mark(1..a) + r(1) + r(a) + call(.., rangeTo) + v(i) + w(i) L4: - jmp?(L3) NEXT:[read (Unit), r(1)] + jmp?(L3) NEXT:[read (Unit), mark({ 1 if (2 > 3) { continue @ } })] L5 [loop entry point]: L6 [body entry point]: - r(1) PREV:[jmp?(L3), jmp(L5 [loop entry point]), jmp?(L5 [loop entry point])] - r(2) - r(3) - call(>, compareTo) - jf(L7) NEXT:[read (Unit), jmp(L5 [loop entry point])] - jmp(L5 [loop entry point]) NEXT:[r(1)] -- jmp(L8) NEXT:[jmp?(L5 [loop entry point])] PREV:[] + 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) + r(2) + r(3) + call(>, compareTo) + jf(L7) NEXT:[read (Unit), mark({ continue @ })] + mark({ continue @ }) + jmp(L5 [loop entry point]) NEXT:[mark({ 1 if (2 > 3) { continue @ } })] +- jmp(L8) NEXT:[jmp?(L5 [loop entry point])] PREV:[] L7: - read (Unit) PREV:[jf(L7)] + read (Unit) PREV:[jf(L7)] L8: - jmp?(L5 [loop entry point]) NEXT:[r(1), read (Unit)] + 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:[r(2)] + read (Unit) PREV:[jmp?(L3), jmp?(L5 [loop entry point])] + jmp(L9 [skipFinallyToErrorBlock]) NEXT:[mark({ 2 })] L2 [onExceptionToFinallyBlock]: L10 [start finally]: - r(2) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + mark({ 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + r(2) L11 [finish finally]: - jmp(error) NEXT:[] + jmp(error) NEXT:[] L9 [skipFinallyToErrorBlock]: - r(2) PREV:[jmp(L9 [skipFinallyToErrorBlock])] + mark({ 2 }) PREV:[jmp(L9 [skipFinallyToErrorBlock])] + r(2) L1: - NEXT:[] + NEXT:[] error: - PREV:[jmp(error)] + PREV:[jmp(error)] sink: - PREV:[, ] + PREV:[, ] ===================== == t11 == fun t11() { @@ -574,28 +695,34 @@ fun t11() { } --------------------- L0: - - jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[r(2), r(1)] - r(1) + + 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 }) + r(1) L3 [start finally]: - r(2) - ret(*) L1 NEXT:[] + mark({ return 2 }) + r(2) + ret(*) L1 NEXT:[] L4 [finish finally]: -- ret(*) L1 NEXT:[] PREV:[] -- jmp(L5 [skipFinallyToErrorBlock]) NEXT:[r(2)] PREV:[] +- ret(*) L1 NEXT:[] PREV:[] +- jmp(L5 [skipFinallyToErrorBlock]) NEXT:[mark({ return 2 })] PREV:[] L2 [onExceptionToFinallyBlock]: - r(2) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] - ret(*) L1 NEXT:[] -- jmp(error) NEXT:[] PREV:[] + mark({ return 2 }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + r(2) + ret(*) L1 NEXT:[] +- jmp(error) NEXT:[] PREV:[] L5 [skipFinallyToErrorBlock]: -- r(2) PREV:[] -- ret(*) L1 PREV:[] +- mark({ return 2 }) PREV:[] +- r(2) PREV:[] +- ret(*) L1 PREV:[] L1: - NEXT:[] PREV:[ret(*) L1, ret(*) L1] + NEXT:[] PREV:[ret(*) L1, ret(*) L1] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== == t12 == fun t12() : Int { @@ -608,28 +735,37 @@ fun t12() : Int { } --------------------- L0: - - jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[r(3), r(1)] - r(1) + + 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 }) + r(1) L3 [start finally]: - r(3) - call(doSmth, doSmth) + mark({ doSmth(3) }) + mark(doSmth(3)) + r(3) + call(doSmth, doSmth) L4 [finish finally]: - ret(*) L1 NEXT:[] -- jmp(L5 [skipFinallyToErrorBlock]) NEXT:[r(3)] PREV:[] + ret(*) L1 NEXT:[] +- jmp(L5 [skipFinallyToErrorBlock]) NEXT:[mark({ doSmth(3) })] PREV:[] L2 [onExceptionToFinallyBlock]: - r(3) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] - call(doSmth, doSmth) - jmp(error) NEXT:[] + mark({ doSmth(3) }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + mark(doSmth(3)) + r(3) + call(doSmth, doSmth) + jmp(error) NEXT:[] L5 [skipFinallyToErrorBlock]: -- r(3) PREV:[] -- call(doSmth, doSmth) PREV:[] +- mark({ doSmth(3) }) PREV:[] +- mark(doSmth(3)) PREV:[] +- r(3) PREV:[] +- call(doSmth, doSmth) PREV:[] L1: - NEXT:[] PREV:[ret(*) L1] + NEXT:[] PREV:[ret(*) L1] error: - PREV:[jmp(error)] + PREV:[jmp(error)] sink: - PREV:[, ] + PREV:[, ] ===================== == t13 == fun t13() : Int { @@ -645,37 +781,48 @@ fun t13() : Int { } --------------------- L0: - - jmp?(L2 [onException]) NEXT:[v(e: UnsupportedOperationException), jmp?(L3 [onExceptionToFinallyBlock])] - jmp?(L3 [onExceptionToFinallyBlock]) NEXT:[r(3), r(1)] - r(1) + + 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 }) + r(1) L4 [start finally]: - r(3) - call(doSmth, doSmth) + 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:[] + ret(*) L1 NEXT:[] +- jmp(L6 [afterCatches]) NEXT:[jmp(L7 [skipFinallyToErrorBlock])] PREV:[] L2 [onException]: - v(e: UnsupportedOperationException) PREV:[jmp?(L2 [onException])] - w(e) - r(2) - call(doSmth, doSmth) - jmp(L6 [afterCatches]) + v(e: UnsupportedOperationException) PREV:[jmp?(L2 [onException])] + w(e) + mark({ doSmth(2) }) + mark(doSmth(2)) + r(2) + call(doSmth, doSmth) + jmp(L6 [afterCatches]) L6 [afterCatches]: - jmp(L7 [skipFinallyToErrorBlock]) NEXT:[r(3)] + jmp(L7 [skipFinallyToErrorBlock]) NEXT:[mark({ doSmth(3) })] L3 [onExceptionToFinallyBlock]: - r(3) PREV:[jmp?(L3 [onExceptionToFinallyBlock])] - call(doSmth, doSmth) - jmp(error) NEXT:[] + mark({ doSmth(3) }) PREV:[jmp?(L3 [onExceptionToFinallyBlock])] + mark(doSmth(3)) + r(3) + call(doSmth, doSmth) + jmp(error) NEXT:[] L7 [skipFinallyToErrorBlock]: - r(3) PREV:[jmp(L7 [skipFinallyToErrorBlock])] - call(doSmth, doSmth) + mark({ doSmth(3) }) PREV:[jmp(L7 [skipFinallyToErrorBlock])] + mark(doSmth(3)) + r(3) + call(doSmth, doSmth) L1: - NEXT:[] PREV:[ret(*) L1, call(doSmth, doSmth)] + NEXT:[] PREV:[ret(*) L1, call(doSmth, doSmth)] error: - PREV:[jmp(error)] + PREV:[jmp(error)] sink: - PREV:[, ] + PREV:[, ] ===================== == t14 == fun t14() : Int { @@ -688,24 +835,29 @@ fun t14() : Int { } --------------------- L0: - - jmp?(L2 [onException]) NEXT:[v(e: UnsupportedOperationException), r(1)] - r(1) - ret(*) L1 NEXT:[] -- jmp(L3 [afterCatches]) NEXT:[] PREV:[] + + 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 }) + r(1) + ret(*) L1 NEXT:[] +- jmp(L3 [afterCatches]) NEXT:[] PREV:[] L2 [onException]: - v(e: UnsupportedOperationException) PREV:[jmp?(L2 [onException])] - w(e) - r(2) - call(doSmth, doSmth) - jmp(L3 [afterCatches]) + v(e: UnsupportedOperationException) PREV:[jmp?(L2 [onException])] + w(e) + mark({ doSmth(2) }) + mark(doSmth(2)) + r(2) + call(doSmth, doSmth) + jmp(L3 [afterCatches]) L1: L3 [afterCatches]: - NEXT:[] PREV:[ret(*) L1, jmp(L3 [afterCatches])] + NEXT:[] PREV:[ret(*) L1, jmp(L3 [afterCatches])] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== == t15 == fun t15() : Int { @@ -721,39 +873,51 @@ fun t15() : Int { } --------------------- L0: - - jmp?(L2 [onException]) NEXT:[v(e: UnsupportedOperationException), jmp?(L3 [onExceptionToFinallyBlock])] - jmp?(L3 [onExceptionToFinallyBlock]) NEXT:[r(3), r(1)] - r(1) + + 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 }) + r(1) L4 [start finally]: - r(3) - call(doSmth, doSmth) + 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:[] + ret(*) L1 NEXT:[] +- jmp(L6 [afterCatches]) NEXT:[jmp(L7 [skipFinallyToErrorBlock])] PREV:[] L2 [onException]: - v(e: UnsupportedOperationException) PREV:[jmp?(L2 [onException])] - w(e) - r(2) - r(3) - call(doSmth, doSmth) - ret(*) L1 NEXT:[] -- jmp(L6 [afterCatches]) PREV:[] + v(e: UnsupportedOperationException) PREV:[jmp?(L2 [onException])] + w(e) + mark({ return 2 }) + r(2) + mark({ doSmth(3) }) + mark(doSmth(3)) + r(3) + call(doSmth, doSmth) + ret(*) L1 NEXT:[] +- jmp(L6 [afterCatches]) PREV:[] L6 [afterCatches]: -- jmp(L7 [skipFinallyToErrorBlock]) NEXT:[r(3)] PREV:[] +- jmp(L7 [skipFinallyToErrorBlock]) NEXT:[mark({ doSmth(3) })] PREV:[] L3 [onExceptionToFinallyBlock]: - r(3) PREV:[jmp?(L3 [onExceptionToFinallyBlock])] - call(doSmth, doSmth) - jmp(error) NEXT:[] + mark({ doSmth(3) }) PREV:[jmp?(L3 [onExceptionToFinallyBlock])] + mark(doSmth(3)) + r(3) + call(doSmth, doSmth) + jmp(error) NEXT:[] L7 [skipFinallyToErrorBlock]: -- r(3) PREV:[] -- call(doSmth, doSmth) PREV:[] +- mark({ doSmth(3) }) PREV:[] +- mark(doSmth(3)) PREV:[] +- r(3) PREV:[] +- call(doSmth, doSmth) PREV:[] L1: - NEXT:[] PREV:[ret(*) L1, ret(*) L1] + NEXT:[] PREV:[ret(*) L1, ret(*) L1] error: - PREV:[jmp(error)] + PREV:[jmp(error)] sink: - PREV:[, ] + PREV:[, ] ===================== == t16 == fun t16() : Int { @@ -769,37 +933,48 @@ fun t16() : Int { } --------------------- L0: - - jmp?(L2 [onException]) NEXT:[v(e: UnsupportedOperationException), jmp?(L3 [onExceptionToFinallyBlock])] - jmp?(L3 [onExceptionToFinallyBlock]) NEXT:[r(3), r(1)] - r(1) - call(doSmth, doSmth) - jmp(L4 [afterCatches]) NEXT:[jmp(L7 [skipFinallyToErrorBlock])] + + 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) }) + mark(doSmth(1)) + r(1) + call(doSmth, doSmth) + jmp(L4 [afterCatches]) NEXT:[jmp(L7 [skipFinallyToErrorBlock])] L2 [onException]: - v(e: UnsupportedOperationException) PREV:[jmp?(L2 [onException])] - w(e) - r(2) + v(e: UnsupportedOperationException) PREV:[jmp?(L2 [onException])] + w(e) + mark({ return 2 }) + r(2) L5 [start finally]: - r(3) - call(doSmth, doSmth) + mark({ doSmth(3) }) + mark(doSmth(3)) + r(3) + call(doSmth, doSmth) L6 [finish finally]: - ret(*) L1 NEXT:[] -- jmp(L4 [afterCatches]) PREV:[] + ret(*) L1 NEXT:[] +- jmp(L4 [afterCatches]) PREV:[] L4 [afterCatches]: - jmp(L7 [skipFinallyToErrorBlock]) NEXT:[r(3)] PREV:[jmp(L4 [afterCatches])] + jmp(L7 [skipFinallyToErrorBlock]) NEXT:[mark({ doSmth(3) })] PREV:[jmp(L4 [afterCatches])] L3 [onExceptionToFinallyBlock]: - r(3) PREV:[jmp?(L3 [onExceptionToFinallyBlock])] - call(doSmth, doSmth) - jmp(error) NEXT:[] + mark({ doSmth(3) }) PREV:[jmp?(L3 [onExceptionToFinallyBlock])] + mark(doSmth(3)) + r(3) + call(doSmth, doSmth) + jmp(error) NEXT:[] L7 [skipFinallyToErrorBlock]: - r(3) PREV:[jmp(L7 [skipFinallyToErrorBlock])] - call(doSmth, doSmth) + mark({ doSmth(3) }) PREV:[jmp(L7 [skipFinallyToErrorBlock])] + mark(doSmth(3)) + r(3) + call(doSmth, doSmth) L1: - NEXT:[] PREV:[ret(*) L1, call(doSmth, doSmth)] + NEXT:[] PREV:[ret(*) L1, call(doSmth, doSmth)] error: - PREV:[jmp(error)] + PREV:[jmp(error)] sink: - PREV:[, ] + PREV:[, ] ===================== == doSmth == fun doSmth(i: Int) { @@ -809,6 +984,7 @@ L0: v(i: Int) w(i) + mark({ }) read (Unit) L1: NEXT:[] diff --git a/compiler/testData/cfg/Finally.kt b/compiler/testData/cfg/Finally.kt index 71d2bc6c33f..9e41b453caf 100644 --- a/compiler/testData/cfg/Finally.kt +++ b/compiler/testData/cfg/Finally.kt @@ -20,7 +20,7 @@ fun t2() { fun t3() { try { 1 - @{ () => + @{ () -> if (2 > 3) { return@ } @@ -31,7 +31,7 @@ fun t3() { } fun t4() { - @{ () => + @{ () -> try { 1 if (2 > 3) { diff --git a/compiler/testData/cfg/FinallyTestCopy.instructions b/compiler/testData/cfg/FinallyTestCopy.instructions index 115beb7d4f7..b43926dfec1 100644 --- a/compiler/testData/cfg/FinallyTestCopy.instructions +++ b/compiler/testData/cfg/FinallyTestCopy.instructions @@ -3,6 +3,7 @@ fun doSmth() {} --------------------- L0: + mark({}) read (Unit) L1: NEXT:[] @@ -16,6 +17,7 @@ fun doSmth1() {} --------------------- L0: + mark({}) read (Unit) L1: NEXT:[] @@ -29,6 +31,7 @@ fun doSmth2() {} --------------------- L0: + mark({}) read (Unit) L1: NEXT:[] @@ -42,6 +45,7 @@ fun cond() {} --------------------- L0: + mark({}) read (Unit) L1: NEXT:[] @@ -67,39 +71,49 @@ fun testCopy1() : Int { } --------------------- L0: - - jmp?(L2 [onException]) NEXT:[jmp?(L5 [catch 0]), jmp?(L3 [onExceptionToFinallyBlock])] - jmp?(L3 [onExceptionToFinallyBlock]) NEXT:[r(1), call(doSmth, doSmth)] - call(doSmth, doSmth) - jmp(L4 [afterCatches]) NEXT:[jmp(L6 [skipFinallyToErrorBlock])] + + 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() }) + mark(doSmth()) + call(doSmth, doSmth) + 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) - w(e) - call(doSmth1, doSmth1) - jmp(L4 [afterCatches]) NEXT:[jmp(L6 [skipFinallyToErrorBlock])] + jmp?(L5 [catch 0]) NEXT:[v(e: Exception), v(e: NullPointerException)] PREV:[jmp?(L2 [onException])] + v(e: NullPointerException) + w(e) + mark({ doSmth1() }) + mark(doSmth1()) + call(doSmth1, doSmth1) + jmp(L4 [afterCatches]) NEXT:[jmp(L6 [skipFinallyToErrorBlock])] L5 [catch 0]: - v(e: Exception) PREV:[jmp?(L5 [catch 0])] - w(e) - call(doSmth2, doSmth2) - jmp(L4 [afterCatches]) + v(e: Exception) PREV:[jmp?(L5 [catch 0])] + w(e) + mark({ doSmth2() }) + mark(doSmth2()) + call(doSmth2, doSmth2) + jmp(L4 [afterCatches]) L4 [afterCatches]: - jmp(L6 [skipFinallyToErrorBlock]) NEXT:[r(1)] PREV:[jmp(L4 [afterCatches]), jmp(L4 [afterCatches]), jmp(L4 [afterCatches])] + jmp(L6 [skipFinallyToErrorBlock]) NEXT:[mark({ return 1 })] PREV:[jmp(L4 [afterCatches]), jmp(L4 [afterCatches]), jmp(L4 [afterCatches])] L3 [onExceptionToFinallyBlock]: L7 [start finally]: - r(1) PREV:[jmp?(L3 [onExceptionToFinallyBlock])] - ret(*) L1 NEXT:[] + mark({ return 1 }) PREV:[jmp?(L3 [onExceptionToFinallyBlock])] + r(1) + ret(*) L1 NEXT:[] L8 [finish finally]: -- jmp(error) NEXT:[] PREV:[] +- jmp(error) NEXT:[] PREV:[] L6 [skipFinallyToErrorBlock]: - r(1) PREV:[jmp(L6 [skipFinallyToErrorBlock])] - ret(*) L1 + mark({ return 1 }) PREV:[jmp(L6 [skipFinallyToErrorBlock])] + r(1) + ret(*) L1 L1: - NEXT:[] PREV:[ret(*) L1, ret(*) L1] + NEXT:[] PREV:[ret(*) L1, ret(*) L1] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== == testCopy2 == fun testCopy2() { @@ -121,55 +135,72 @@ fun testCopy2() { } --------------------- L0: - + + 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]: - call(cond, cond) PREV:[, jmp(L2 [loop entry point]), jmp(L2 [loop entry point])] - jf(L3 [loop exit point]) NEXT:[read (Unit), jmp?(L6 [onException])] + mark(cond()) PREV:[mark(while (cond()) { try { doSmth() } catch (e: NullPointerException) { doSmth1() } catch (e: Exception) { doSmth2() } finally { if (cond()) return else continue } }), jmp(L2 [loop entry point]), jmp(L2 [loop 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]: - jmp?(L6 [onException]) NEXT:[jmp?(L9 [catch 0]), jmp?(L7 [onExceptionToFinallyBlock])] - jmp?(L7 [onExceptionToFinallyBlock]) NEXT:[call(cond, cond), call(doSmth, doSmth)] - call(doSmth, doSmth) - jmp(L8 [afterCatches]) NEXT:[jmp(L10 [skipFinallyToErrorBlock])] + 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() }) + mark(doSmth()) + call(doSmth, doSmth) + 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) - w(e) - call(doSmth1, doSmth1) - jmp(L8 [afterCatches]) NEXT:[jmp(L10 [skipFinallyToErrorBlock])] + jmp?(L9 [catch 0]) NEXT:[v(e: Exception), v(e: NullPointerException)] PREV:[jmp?(L6 [onException])] + v(e: NullPointerException) + w(e) + mark({ doSmth1() }) + mark(doSmth1()) + call(doSmth1, doSmth1) + jmp(L8 [afterCatches]) NEXT:[jmp(L10 [skipFinallyToErrorBlock])] L9 [catch 0]: - v(e: Exception) PREV:[jmp?(L9 [catch 0])] - w(e) - call(doSmth2, doSmth2) - jmp(L8 [afterCatches]) + v(e: Exception) PREV:[jmp?(L9 [catch 0])] + w(e) + mark({ doSmth2() }) + mark(doSmth2()) + call(doSmth2, doSmth2) + jmp(L8 [afterCatches]) L8 [afterCatches]: - jmp(L10 [skipFinallyToErrorBlock]) NEXT:[call(cond, cond)] PREV:[jmp(L8 [afterCatches]), jmp(L8 [afterCatches]), jmp(L8 [afterCatches])] + 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]: - call(cond, cond) PREV:[jmp?(L7 [onExceptionToFinallyBlock])] - jf(L12) NEXT:[jmp(L2 [loop entry point]), ret L1] - ret L1 NEXT:[] -- jmp(L13) NEXT:[jmp(error)] PREV:[] + mark({ if (cond()) return else continue }) PREV:[jmp?(L7 [onExceptionToFinallyBlock])] + mark(if (cond()) return else continue) + mark(cond()) + call(cond, cond) + jf(L12) NEXT:[jmp(L2 [loop entry point]), ret L1] + ret L1 NEXT:[] +- jmp(L13) NEXT:[jmp(error)] PREV:[] L12: - jmp(L2 [loop entry point]) NEXT:[call(cond, cond)] PREV:[jf(L12)] + jmp(L2 [loop entry point]) NEXT:[mark(cond())] PREV:[jf(L12)] L13: L14 [finish finally]: -- jmp(error) NEXT:[] PREV:[] +- jmp(error) NEXT:[] PREV:[] L10 [skipFinallyToErrorBlock]: - call(cond, cond) PREV:[jmp(L10 [skipFinallyToErrorBlock])] - jf(copy L12) NEXT:[jmp(L2 [loop entry point]), ret L1] - ret L1 NEXT:[] -- jmp(copy L13) NEXT:[jmp(L2 [loop entry point])] PREV:[] - jmp(L2 [loop entry point]) NEXT:[call(cond, cond)] PREV:[jf(copy L12)] -- jmp(L2 [loop entry point]) NEXT:[call(cond, cond)] PREV:[] + mark({ if (cond()) return else continue }) PREV:[jmp(L10 [skipFinallyToErrorBlock])] + mark(if (cond()) return else continue) + mark(cond()) + call(cond, cond) + jf(copy L12) NEXT:[jmp(L2 [loop entry point]), ret L1] + 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:[] L3 [loop exit point]: - read (Unit) PREV:[jf(L3 [loop exit point])] + read (Unit) PREV:[jf(L3 [loop exit point])] L1: - NEXT:[] PREV:[ret L1, ret L1, read (Unit)] + NEXT:[] PREV:[ret L1, ret L1, read (Unit)] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== == testCopy3 == fun testCopy3() { @@ -188,47 +219,61 @@ fun testCopy3() { } --------------------- L0: - - jmp?(L2 [onException]) NEXT:[jmp?(L5 [catch 0]), jmp?(L3 [onExceptionToFinallyBlock])] - jmp?(L3 [onExceptionToFinallyBlock]) NEXT:[call(cond, cond), call(doSmth, doSmth)] - call(doSmth, doSmth) - jmp(L4 [afterCatches]) NEXT:[jmp(L6 [skipFinallyToErrorBlock])] + + 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() }) + mark(doSmth()) + call(doSmth, doSmth) + 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) - w(e) - call(doSmth1, doSmth1) - jmp(L4 [afterCatches]) NEXT:[jmp(L6 [skipFinallyToErrorBlock])] + jmp?(L5 [catch 0]) NEXT:[v(e: Exception), v(e: NullPointerException)] PREV:[jmp?(L2 [onException])] + v(e: NullPointerException) + w(e) + mark({ doSmth1() }) + mark(doSmth1()) + call(doSmth1, doSmth1) + jmp(L4 [afterCatches]) NEXT:[jmp(L6 [skipFinallyToErrorBlock])] L5 [catch 0]: - v(e: Exception) PREV:[jmp?(L5 [catch 0])] - w(e) - call(doSmth2, doSmth2) - jmp(L4 [afterCatches]) + v(e: Exception) PREV:[jmp?(L5 [catch 0])] + w(e) + mark({ doSmth2() }) + mark(doSmth2()) + call(doSmth2, doSmth2) + jmp(L4 [afterCatches]) L4 [afterCatches]: - jmp(L6 [skipFinallyToErrorBlock]) NEXT:[call(cond, cond)] PREV:[jmp(L4 [afterCatches]), jmp(L4 [afterCatches]), jmp(L4 [afterCatches])] + 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])] + mark(while (cond())) L8 [loop entry point]: L11 [condition entry point]: - call(cond, cond) PREV:[jmp?(L3 [onExceptionToFinallyBlock]), jmp(L8 [loop entry point])] - jf(L9 [loop exit point]) NEXT:[read (Unit), jmp(L8 [loop entry point])] + mark(cond()) PREV:[mark(while (cond())), jmp(L8 [loop entry point])] + call(cond, cond) + jf(L9 [loop exit point]) NEXT:[read (Unit), jmp(L8 [loop entry point])] L10 [body entry point]: - jmp(L8 [loop entry point]) NEXT:[call(cond, cond)] + jmp(L8 [loop entry point]) NEXT:[mark(cond())] L9 [loop exit point]: - read (Unit) PREV:[jf(L9 [loop exit point])] + read (Unit) PREV:[jf(L9 [loop exit point])] L12 [finish finally]: - jmp(error) NEXT:[] + jmp(error) NEXT:[] L6 [skipFinallyToErrorBlock]: - call(cond, cond) PREV:[jmp(L6 [skipFinallyToErrorBlock]), jmp(copy L8 [loop entry point])] - jf(copy L9 [loop exit point]) NEXT:[read (Unit), jmp(copy L8 [loop entry point])] - jmp(copy L8 [loop entry point]) NEXT:[call(cond, cond)] - read (Unit) PREV:[jf(copy L9 [loop exit point])] + 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) + jf(copy L9 [loop exit point]) NEXT:[read (Unit), jmp(copy L8 [loop entry point])] + jmp(copy L8 [loop entry point]) NEXT:[mark(cond())] + read (Unit) PREV:[jf(copy L9 [loop exit point])] L1: - NEXT:[] + NEXT:[] error: - PREV:[jmp(error)] + PREV:[jmp(error)] sink: - PREV:[, ] + PREV:[, ] ===================== == doTestCopy4 == fun doTestCopy4(list: List?) : Int { @@ -242,37 +287,49 @@ fun doTestCopy4(list: List?) : Int { } --------------------- L0: - - v(list: List?) - w(list) - jmp?(L2 [onExceptionToFinallyBlock]) NEXT:[r(list), call(doSmth, doSmth)] - call(doSmth, doSmth) - jmp(L3 [skipFinallyToErrorBlock]) NEXT:[r(list)] + + v(list: List?) + w(list) + 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() }) + mark(doSmth()) + call(doSmth, doSmth) + jmp(L3 [skipFinallyToErrorBlock]) NEXT:[mark({ if(list != null) { } })] L2 [onExceptionToFinallyBlock]: L4 [start finally]: - r(list) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] - r(null) - call(list != null, equals) - jf(L5) NEXT:[read (Unit), read (Unit)] - read (Unit) - jmp(L6) NEXT:[jmp(error)] + mark({ if(list != null) { } }) PREV:[jmp?(L2 [onExceptionToFinallyBlock])] + mark(if(list != null) { }) + mark(list != null) + r(list) + r(null) + call(list != null, equals) + jf(L5) NEXT:[read (Unit), mark({ })] + mark({ }) + read (Unit) + jmp(L6) NEXT:[jmp(error)] L5: - read (Unit) PREV:[jf(L5)] + read (Unit) PREV:[jf(L5)] L6: L7 [finish finally]: - jmp(error) NEXT:[] PREV:[jmp(L6), read (Unit)] + jmp(error) NEXT:[] PREV:[jmp(L6), read (Unit)] L3 [skipFinallyToErrorBlock]: - r(list) PREV:[jmp(L3 [skipFinallyToErrorBlock])] - r(null) - call(list != null, equals) - jf(copy L5) NEXT:[read (Unit), read (Unit)] - read (Unit) - jmp(copy L6) NEXT:[] - read (Unit) PREV:[jf(copy L5)] + mark({ if(list != null) { } }) PREV:[jmp(L3 [skipFinallyToErrorBlock])] + mark(if(list != null) { }) + mark(list != null) + r(list) + r(null) + call(list != null, equals) + jf(copy L5) NEXT:[read (Unit), mark({ })] + mark({ }) + read (Unit) + jmp(copy L6) NEXT:[] + read (Unit) PREV:[jf(copy L5)] L1: - NEXT:[] PREV:[jmp(copy L6), read (Unit)] + NEXT:[] PREV:[jmp(copy L6), read (Unit)] error: - PREV:[jmp(error)] + PREV:[jmp(error)] sink: - PREV:[, ] + PREV:[, ] ===================== diff --git a/compiler/testData/cfg/For.instructions b/compiler/testData/cfg/For.instructions index b170c1550de..79732fcbce7 100644 --- a/compiler/testData/cfg/For.instructions +++ b/compiler/testData/cfg/For.instructions @@ -6,27 +6,32 @@ fun t1() { } --------------------- L0: - - r(1) - r(2) - call(.., rangeTo) - v(i) - w(i) + + mark({ for (i in 1..2) { doSmth(i) } }) + mark(for (i in 1..2) { doSmth(i) }) + mark(1..2) + r(1) + r(2) + call(.., rangeTo) + v(i) + w(i) L3: - jmp?(L2) NEXT:[read (Unit), r(i)] + jmp?(L2) NEXT:[read (Unit), mark({ doSmth(i) })] L4 [loop entry point]: L5 [body entry point]: - r(i) PREV:[jmp?(L2), jmp?(L4 [loop entry point])] - call(doSmth, doSmth) - jmp?(L4 [loop entry point]) NEXT:[r(i), read (Unit)] + 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)] L2: - read (Unit) PREV:[jmp?(L2), jmp?(L4 [loop entry point])] + read (Unit) PREV:[jmp?(L2), jmp?(L4 [loop entry point])] L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== == doSmth == fun doSmth(i: Int) {} @@ -35,6 +40,7 @@ L0: v(i: Int) w(i) + mark({}) read (Unit) L1: NEXT:[] diff --git a/compiler/testData/cfg/If.instructions b/compiler/testData/cfg/If.instructions index 4648f638190..1e4e23f2750 100644 --- a/compiler/testData/cfg/If.instructions +++ b/compiler/testData/cfg/If.instructions @@ -17,38 +17,49 @@ fun t1(b: Boolean) { } --------------------- L0: - - v(b: Boolean) - w(b) - v(var u: String) - r(b) - jf(L2) NEXT:[read (Unit), r("s")] - r("s") - w(u) - jmp(L3) NEXT:[r(u)] + + 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) }) + v(var u: String) + mark(if (b) { u = "s" }) + r(b) + jf(L2) NEXT:[read (Unit), mark({ u = "s" })] + mark({ u = "s" }) + mark("s") + r("s") + w(u) + jmp(L3) NEXT:[mark(doSmth(u))] L2: - read (Unit) PREV:[jf(L2)] + read (Unit) PREV:[jf(L2)] L3: - r(u) PREV:[jmp(L3), read (Unit)] - call(doSmth, doSmth) - v(var r: String) - r(b) - jf(L4) NEXT:[r("t"), r("s")] - r("s") - w(r) - jmp(L5) NEXT:[r(r)] + mark(doSmth(u)) PREV:[jmp(L3), read (Unit)] + r(u) + call(doSmth, doSmth) + v(var r: String) + mark(if (b) { r = "s" } else { r = "t" }) + r(b) + jf(L4) NEXT:[mark({ r = "t" }), mark({ r = "s" })] + mark({ r = "s" }) + mark("s") + r("s") + w(r) + jmp(L5) NEXT:[mark(doSmth(r))] L4: - r("t") PREV:[jf(L4)] - w(r) + mark({ r = "t" }) PREV:[jf(L4)] + mark("t") + r("t") + w(r) L5: - r(r) PREV:[jmp(L5), w(r)] - call(doSmth, doSmth) + mark(doSmth(r)) PREV:[jmp(L5), w(r)] + r(r) + call(doSmth, doSmth) L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== == t2 == fun t2(b: Boolean) { @@ -63,34 +74,41 @@ fun t2(b: Boolean) { } --------------------- L0: - - v(b: Boolean) - w(b) - v(val i = 3) - r(3) - w(i) - r(b) - jf(L2) NEXT:[read (Unit), ret L1] - ret L1 NEXT:[] -- jmp(L3) NEXT:[r(i)] PREV:[] + + v(b: Boolean) + w(b) + 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; }) + ret L1 NEXT:[] +- jmp(L3) NEXT:[mark(doSmth(i))] PREV:[] L2: - read (Unit) PREV:[jf(L2)] + read (Unit) PREV:[jf(L2)] L3: - r(i) - call(doSmth, doSmth) - r(i) - jf(L4) NEXT:[read (Unit), ret L1] - ret L1 NEXT:[] -- jmp(L5) NEXT:[] PREV:[] + mark(doSmth(i)) + r(i) + call(doSmth, doSmth) + mark(if (i is Int) { return; }) + mark(i is Int) + r(i) + jf(L4) NEXT:[read (Unit), mark({ return; })] + mark({ return; }) + ret L1 NEXT:[] +- jmp(L5) NEXT:[] PREV:[] L4: - read (Unit) PREV:[jf(L4)] + read (Unit) PREV:[jf(L4)] L1: L5: - NEXT:[] PREV:[ret L1, ret L1, read (Unit)] + NEXT:[] PREV:[ret L1, ret L1, read (Unit)] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== == doSmth == fun doSmth(s: String) {} @@ -99,6 +117,7 @@ L0: v(s: String) w(s) + mark({}) read (Unit) L1: NEXT:[] diff --git a/compiler/testData/cfg/LazyBooleans.instructions b/compiler/testData/cfg/LazyBooleans.instructions index 73588bc7980..f937676407e 100644 --- a/compiler/testData/cfg/LazyBooleans.instructions +++ b/compiler/testData/cfg/LazyBooleans.instructions @@ -18,61 +18,69 @@ fun lazyBooleans(a : Boolean, b : Boolean) : Unit { } --------------------- L0: - - v(a : Boolean) - w(a) - v(b : Boolean) - w(b) - r(a) - jf(L2) NEXT:[r(2), r(1)] - r(1) - jmp(L3) NEXT:[r(3)] + + 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 }) + mark(if (a) { 1 } else { 2 }) + r(a) + jf(L2) NEXT:[mark({ 2 }), mark({ 1 })] + mark({ 1 }) + r(1) + jmp(L3) NEXT:[r(3)] L2: - r(2) PREV:[jf(L2)] + mark({ 2 }) PREV:[jf(L2)] + r(2) L3: - r(3) PREV:[jmp(L3), r(2)] - r(a) - jf(L4) NEXT:[jf(L5), r(b)] - r(b) + r(3) PREV:[jmp(L3), r(2)] + mark(if (a && b) 5 else 6) + r(a) + jf(L4) NEXT:[jf(L5), r(b)] + r(b) L4: - jf(L5) NEXT:[r(6), r(5)] PREV:[jf(L4), r(b)] - r(5) - jmp(L6) NEXT:[r(7)] + jf(L5) NEXT:[r(6), r(5)] PREV:[jf(L4), r(b)] + r(5) + jmp(L6) NEXT:[r(7)] L5: - r(6) PREV:[jf(L5)] + r(6) PREV:[jf(L5)] L6: - r(7) PREV:[jmp(L6), r(6)] - r(a) - jt(L7) NEXT:[r(b), jf(L8)] - r(b) + r(7) PREV:[jmp(L6), r(6)] + mark(if (a || b) 8 else 9) + r(a) + jt(L7) NEXT:[r(b), jf(L8)] + r(b) L7: - jf(L8) NEXT:[r(9), r(8)] PREV:[jt(L7), r(b)] - r(8) - jmp(L9) NEXT:[r(10)] + jf(L8) NEXT:[r(9), r(8)] PREV:[jt(L7), r(b)] + r(8) + jmp(L9) NEXT:[r(10)] L8: - r(9) PREV:[jf(L8)] + r(9) PREV:[jf(L8)] L9: - r(10) PREV:[jmp(L9), r(9)] - r(a) - jf(L10) NEXT:[read (Unit), r(11)] - r(11) - jmp(L11) NEXT:[r(12)] + r(10) PREV:[jmp(L9), r(9)] + mark(if (a) 11) + r(a) + jf(L10) NEXT:[read (Unit), r(11)] + r(11) + jmp(L11) NEXT:[r(12)] L10: - read (Unit) PREV:[jf(L10)] + read (Unit) PREV:[jf(L10)] L11: - r(12) PREV:[jmp(L11), read (Unit)] - r(a) - jf(L12) NEXT:[r(13), read (Unit)] - read (Unit) - jmp(L13) NEXT:[r(14)] + r(12) PREV:[jmp(L11), read (Unit)] + mark(if (a) else 13) + r(a) + jf(L12) NEXT:[r(13), read (Unit)] + read (Unit) + jmp(L13) NEXT:[r(14)] L12: - r(13) PREV:[jf(L12)] + r(13) PREV:[jf(L12)] L13: - r(14) PREV:[jmp(L13), r(13)] + r(14) PREV:[jmp(L13), r(13)] L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== diff --git a/compiler/testData/cfg/LocalDeclarations.instructions b/compiler/testData/cfg/LocalDeclarations.instructions index 8542450d83b..b8f5863ca76 100644 --- a/compiler/testData/cfg/LocalDeclarations.instructions +++ b/compiler/testData/cfg/LocalDeclarations.instructions @@ -36,6 +36,7 @@ L0: v(i: Int) w(i) + mark({}) read (Unit) L1: NEXT:[] @@ -55,19 +56,22 @@ fun test1() { } --------------------- L0: - - v(val a = object { val x : Int { $x = 1 } }) - v(val x : Int) - r(1) - w($x) - r(object { val x : Int { $x = 1 } }) - w(a) + + 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 }) + r(1) + w($x) + r(object { val x : Int { $x = 1 } }) + w(a) L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== == O == object O { @@ -78,16 +82,17 @@ object O { } --------------------- L0: - - v(val x : Int) - r(1) - w($x) + + v(val x : Int) + mark({ $x = 1 }) + r(1) + w($x) L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== == test2 == fun test2() { @@ -98,22 +103,24 @@ fun test2() { } --------------------- L0: - - v(val b = 1) - r(1) - w(b) - v(val a = object { val x = b }) - v(val x = b) - r(b) - w(x) - r(object { val x = b }) - w(a) + + mark({ val b = 1 val a = object { val x = b } }) + v(val b = 1) + r(1) + w(b) + v(val a = object { val x = b }) + mark(object { val x = b }) + v(val x = b) + r(b) + w(x) + r(object { val x = b }) + w(a) L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== == test3 == fun test3() { @@ -126,30 +133,33 @@ fun test3() { } --------------------- L0: - - v(val a = object { val y : Int fun inner_bar() { y = 10 } }) - v(val y : Int) - jmp?(L2) NEXT:[r(object { val y : Int fun inner_bar() { y = 10 } }), d(fun inner_bar() { y = 10 })] - d(fun inner_bar() { y = 10 }) NEXT:[] + + 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) + jmp?(L2) NEXT:[r(object { val y : Int fun inner_bar() { y = 10 } }), d(fun inner_bar() { y = 10 })] + d(fun inner_bar() { y = 10 }) NEXT:[] L2: - r(object { val y : Int fun inner_bar() { y = 10 } }) PREV:[jmp?(L2)] - w(a) + r(object { val y : Int fun inner_bar() { y = 10 } }) PREV:[jmp?(L2)] + w(a) L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, , d(fun inner_bar() { y = 10 })] + PREV:[, , d(fun inner_bar() { y = 10 })] L3: - - r(10) - w(y) + + mark({ y = 10 }) + r(10) + w(y) L4: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== == inner_bar == fun inner_bar() { @@ -157,15 +167,16 @@ fun inner_bar() { } --------------------- L3: - - r(10) - w(y) + + mark({ y = 10 }) + r(10) + w(y) L4: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== == test4 == fun test4() { @@ -182,33 +193,37 @@ fun test4() { } --------------------- L0: - - v(val a = object { val x : Int val y : Int { $x = 1 } fun ggg() { y = 10 } }) - v(val x : Int) - v(val y : Int) - 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 })] - d(fun ggg() { y = 10 }) NEXT:[] + + 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 }) + 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 })] + 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) + r(object { val x : Int val y : Int { $x = 1 } fun ggg() { y = 10 } }) PREV:[jmp?(L2)] + w(a) L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, , d(fun ggg() { y = 10 })] + PREV:[, , d(fun ggg() { y = 10 })] L3: - - r(10) - w(y) + + mark({ y = 10 }) + r(10) + w(y) L4: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== == ggg == fun ggg() { @@ -216,15 +231,16 @@ fun ggg() { } --------------------- L3: - - r(10) - w(y) + + mark({ y = 10 }) + r(10) + w(y) L4: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== == test5 == fun test5() { @@ -243,47 +259,52 @@ fun test5() { } --------------------- L0: - - v(val a = object { var x = 1 { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) - v(var x = 1) - r(1) - w(x) - r(2) - w($x) - jmp?(L2) NEXT:[jmp?(L5), d(fun foo() { x = 3 })] - d(fun foo() { x = 3 }) NEXT:[] + + 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 }) + r(2) + w($x) + 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)] - d(fun bar() { x = 4 }) NEXT:[] + 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)] + d(fun bar() { x = 4 }) NEXT:[] L5: - r(object { var x = 1 { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) PREV:[jmp?(L5)] - w(a) + r(object { var x = 1 { $x = 2 } fun foo() { x = 3 } fun bar() { x = 4 } }) PREV:[jmp?(L5)] + w(a) L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, , d(fun foo() { x = 3 }), d(fun bar() { x = 4 })] + PREV:[, , d(fun foo() { x = 3 }), d(fun bar() { x = 4 })] L3: - - r(3) - w(x) + + mark({ x = 3 }) + r(3) + w(x) L4: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] L6: - - r(4) - w(x) + + mark({ x = 4 }) + r(4) + w(x) L7: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== == foo == fun foo() { @@ -291,15 +312,16 @@ fun foo() { } --------------------- L3: - - r(3) - w(x) + + mark({ x = 3 }) + r(3) + w(x) L4: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== == bar == fun bar() { @@ -307,13 +329,14 @@ fun bar() { } --------------------- L6: - - r(4) - w(x) + + mark({ x = 4 }) + r(4) + w(x) L7: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== diff --git a/compiler/testData/cfg/MultiDecl.instructions b/compiler/testData/cfg/MultiDecl.instructions index 1fd49674642..2b38aee15d2 100644 --- a/compiler/testData/cfg/MultiDecl.instructions +++ b/compiler/testData/cfg/MultiDecl.instructions @@ -20,23 +20,24 @@ fun test(c: C) { } --------------------- L0: - - v(c: C) - w(c) - r(c) - v(a) - call(a, component1) - w(a) - v(b) - call(b, component2) - w(b) - v(val d = 1) - r(1) - w(d) + + v(c: C) + w(c) + mark({ val (a, b) = c val d = 1 }) + r(c) + v(a) + call(a, component1) + w(a) + v(b) + call(b, component2) + w(b) + v(val d = 1) + r(1) + w(d) L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== diff --git a/compiler/testData/cfg/ObjectExpression.instructions b/compiler/testData/cfg/ObjectExpression.instructions index e7469555c36..bfbe0e9b06c 100644 --- a/compiler/testData/cfg/ObjectExpression.instructions +++ b/compiler/testData/cfg/ObjectExpression.instructions @@ -34,20 +34,24 @@ fun foo(b: B) : Int { } --------------------- L0: - - v(b: B) - w(b) - v(val o = object : A by b {}) - r(b) - r(object : A by b {}) - w(o) - r(o) - call(foo, foo) - ret(*) L1 + + v(b: B) + w(b) + mark({ val o = object : A by b {} return o.foo() }) + v(val o = object : A by b {}) + mark(object : A by b {}) + r(b) + r(object : A by b {}) + w(o) + mark(o.foo()) + mark(foo()) + r(o) + call(foo, foo) + ret(*) L1 L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== diff --git a/compiler/testData/cfg/OnlyWhileInFunctionBody.instructions b/compiler/testData/cfg/OnlyWhileInFunctionBody.instructions index 0828caa9711..63a7ce6b096 100644 --- a/compiler/testData/cfg/OnlyWhileInFunctionBody.instructions +++ b/compiler/testData/cfg/OnlyWhileInFunctionBody.instructions @@ -6,24 +6,28 @@ fun main() { } --------------------- L0: - + + mark({ while(1 > 0) { 2 } }) + mark(while(1 > 0) { 2 }) L2 [loop entry point]: L5 [condition entry point]: - r(1) PREV:[, jmp(L2 [loop entry point])] - r(0) - call(>, compareTo) - jf(L3 [loop exit point]) NEXT:[read (Unit), r(2)] + mark(1 > 0) PREV:[mark(while(1 > 0) { 2 }), jmp(L2 [loop entry point])] + r(1) + r(0) + call(>, compareTo) + jf(L3 [loop exit point]) NEXT:[read (Unit), mark({ 2 })] L4 [body entry point]: - r(2) - jmp(L2 [loop entry point]) NEXT:[r(1)] + mark({ 2 }) + r(2) + jmp(L2 [loop entry point]) NEXT:[mark(1 > 0)] L3 [loop exit point]: - read (Unit) PREV:[jf(L3 [loop exit point])] + read (Unit) PREV:[jf(L3 [loop exit point])] L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== == dowhile == fun dowhile() { @@ -32,21 +36,25 @@ fun dowhile() { } --------------------- L0: - + + mark({ do {return} while(1 > 0) }) + mark(do {return} while(1 > 0)) L2 [loop entry point]: L4 [body entry point]: - ret L1 NEXT:[] + mark({return}) + ret L1 NEXT:[] L5 [condition entry point]: -- r(1) PREV:[] -- r(0) PREV:[] -- call(>, compareTo) PREV:[] -- jt(L2 [loop entry point]) NEXT:[read (Unit), ret L1] PREV:[] +- mark(1 > 0) PREV:[] +- r(1) PREV:[] +- r(0) PREV:[] +- call(>, compareTo) PREV:[] +- jt(L2 [loop entry point]) NEXT:[read (Unit), mark({return})] PREV:[] L3 [loop exit point]: -- read (Unit) PREV:[] +- read (Unit) PREV:[] L1: - NEXT:[] PREV:[ret L1] + NEXT:[] PREV:[ret L1] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== diff --git a/compiler/testData/cfg/ReturnFromExpression.instructions b/compiler/testData/cfg/ReturnFromExpression.instructions index e032c49d8a8..0099234e922 100644 --- a/compiler/testData/cfg/ReturnFromExpression.instructions +++ b/compiler/testData/cfg/ReturnFromExpression.instructions @@ -4,17 +4,19 @@ fun blockAndAndMismatch() : Boolean { } --------------------- L0: - - r(false) - jt(L2) NEXT:[r(false), r(false || (return false))] - r(false) - ret(*) L1 NEXT:[] + + mark({ false || (return false) }) + r(false) + jt(L2) NEXT:[mark((return false)), r(false || (return false))] + mark((return false)) + r(false) + ret(*) L1 NEXT:[] L2: - r(false || (return false)) PREV:[jt(L2)] + r(false || (return false)) PREV:[jt(L2)] L1: - NEXT:[] PREV:[ret(*) L1, r(false || (return false))] + NEXT:[] PREV:[ret(*) L1, r(false || (return false))] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== diff --git a/compiler/testData/cfg/arrayAccessExpression.instructions b/compiler/testData/cfg/arrayAccessExpression.instructions index 85133769ba4..40eb60c4fbc 100644 --- a/compiler/testData/cfg/arrayAccessExpression.instructions +++ b/compiler/testData/cfg/arrayAccessExpression.instructions @@ -21,6 +21,10 @@ L0: v(ab: Ab) w(ab) + mark({ ab.getArray()[1] }) + mark(ab.getArray()[1]) + mark(ab.getArray()) + mark(getArray()) r(ab) call(getArray, getArray) r(1) diff --git a/compiler/testData/cfg/arraySet.instructions b/compiler/testData/cfg/arraySet.instructions index 576272d849a..459a4912544 100644 --- a/compiler/testData/cfg/arraySet.instructions +++ b/compiler/testData/cfg/arraySet.instructions @@ -4,17 +4,19 @@ fun foo(a: Array) { } --------------------- L0: - - v(a: Array) - w(a) - r(a) - r(1) - r(2) - call(a[1], set) + + v(a: Array) + w(a) + mark({ a[1] = 2 }) + mark(a[1]) + r(a) + r(1) + r(2) + call(a[1], set) L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== diff --git a/compiler/testData/cfg/arraySetPlusAssign.instructions b/compiler/testData/cfg/arraySetPlusAssign.instructions index aacc0a6277f..aeb21075064 100644 --- a/compiler/testData/cfg/arraySetPlusAssign.instructions +++ b/compiler/testData/cfg/arraySetPlusAssign.instructions @@ -4,22 +4,25 @@ fun foo(a: Array) { } --------------------- L0: - - v(a: Array) - w(a) - r(a) - r(0) - call(a[0], get) - r(1) - call(+=, plus) - r(a) - r(0) - r(1) - call(a[0], set) + + v(a: Array) + w(a) + mark({ a[0] += 1 }) + mark(a[0] += 1) + mark(a[0]) + r(a) + r(0) + call(a[0], get) + r(1) + call(+=, plus) + r(a) + r(0) + r(1) + call(a[0], set) L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== diff --git a/compiler/testData/cfg/assignmentToThis.instructions b/compiler/testData/cfg/assignmentToThis.instructions index a98dddff448..f8d83fda136 100644 --- a/compiler/testData/cfg/assignmentToThis.instructions +++ b/compiler/testData/cfg/assignmentToThis.instructions @@ -7,6 +7,7 @@ L0: v(c: C) w(c) + mark({ this = c }) r(c) unsupported(BINARY_EXPRESSION : this = c) L1: diff --git a/compiler/testData/cfg/backingFieldAccess.instructions b/compiler/testData/cfg/backingFieldAccess.instructions index af1f5720d64..92b380a0c75 100644 --- a/compiler/testData/cfg/backingFieldAccess.instructions +++ b/compiler/testData/cfg/backingFieldAccess.instructions @@ -11,12 +11,13 @@ class C { L0: v(val a: Int get() = 1) - jmp?(L2) NEXT:[r($a), d(get() = 1)] - d(get() = 1) NEXT:[] + jmp?(L2) NEXT:[mark({ $a }), d(get() = 1)] + d(get() = 1) NEXT:[] L2: - r($a) PREV:[jmp?(L2)] + mark({ $a }) PREV:[jmp?(L2)] + r($a) L1: - NEXT:[] + NEXT:[] error: PREV:[] sink: diff --git a/compiler/testData/cfg/deadCode/DeadCode.instructions b/compiler/testData/cfg/deadCode/DeadCode.instructions index d1010a922d1..4d8f362750b 100644 --- a/compiler/testData/cfg/deadCode/DeadCode.instructions +++ b/compiler/testData/cfg/deadCode/DeadCode.instructions @@ -5,14 +5,18 @@ fun test() { } --------------------- L0: - - call(Exception, ) - throw (throw Exception()) NEXT:[] -- call(test, test) PREV:[] + + mark({ throw Exception() test() }) + mark(throw Exception()) + mark(Exception()) + call(Exception, ) + throw (throw Exception()) NEXT:[] +- mark(test()) PREV:[] +- call(test, test) PREV:[] L1: - NEXT:[] PREV:[] + NEXT:[] PREV:[] error: - PREV:[throw (throw Exception())] + PREV:[throw (throw Exception())] sink: - PREV:[, ] + PREV:[, ] ===================== diff --git a/compiler/testData/cfg/deadCode/returnInElvis.instructions b/compiler/testData/cfg/deadCode/returnInElvis.instructions index d213112ed8d..af8ad57021a 100644 --- a/compiler/testData/cfg/deadCode/returnInElvis.instructions +++ b/compiler/testData/cfg/deadCode/returnInElvis.instructions @@ -4,15 +4,16 @@ fun foo() { } --------------------- L0: - - ret L1 NEXT:[] -- jt(L2) NEXT:[r(null), ] PREV:[] -- r(null) PREV:[] + + mark({ return ?: null }) + ret L1 NEXT:[] +- jt(L2) NEXT:[r(null), ] PREV:[] +- r(null) PREV:[] L1: L2: - NEXT:[] PREV:[ret L1] + NEXT:[] PREV:[ret L1] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== diff --git a/compiler/testData/cfg/equals.instructions b/compiler/testData/cfg/equals.instructions index bf813f6c95b..bcdc48ad7c0 100644 --- a/compiler/testData/cfg/equals.instructions +++ b/compiler/testData/cfg/equals.instructions @@ -5,24 +5,28 @@ fun foo(a: Int, b: Int) { } --------------------- L0: - - v(a: Int) - w(a) - v(b: Int) - w(b) - r(a) - r(b) - call(a == b, equals) - jf(L2) NEXT:[read (Unit), read (Unit)] - read (Unit) - jmp(L3) NEXT:[] + + v(a: Int) + w(a) + v(b: Int) + w(b) + mark({ if (a == b) { } }) + mark(if (a == b) { }) + mark(a == b) + r(a) + r(b) + call(a == b, equals) + jf(L2) NEXT:[read (Unit), mark({ })] + mark({ }) + read (Unit) + jmp(L3) NEXT:[] L2: - read (Unit) PREV:[jf(L2)] + read (Unit) PREV:[jf(L2)] L1: L3: - NEXT:[] PREV:[jmp(L3), read (Unit)] + NEXT:[] PREV:[jmp(L3), read (Unit)] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== diff --git a/compiler/testData/cfg/expressionAsFunction.instructions b/compiler/testData/cfg/expressionAsFunction.instructions index d79d77a5dd5..dd09b4ef22f 100644 --- a/compiler/testData/cfg/expressionAsFunction.instructions +++ b/compiler/testData/cfg/expressionAsFunction.instructions @@ -7,6 +7,9 @@ L0: v(f: () -> Unit) w(f) + mark({ (f)() }) + mark((f)()) + mark((f)) r(f) call((f), ) L1: diff --git a/compiler/testData/cfg/incrementAtTheEnd.instructions b/compiler/testData/cfg/incrementAtTheEnd.instructions index 9d32dbe7902..cf8740a3f97 100644 --- a/compiler/testData/cfg/incrementAtTheEnd.instructions +++ b/compiler/testData/cfg/incrementAtTheEnd.instructions @@ -5,17 +5,19 @@ fun foo() { } --------------------- L0: - - v(var i = 1) - r(1) - w(i) - r(i) - call(++, inc) - w(i) + + mark({ var i = 1 i++ }) + v(var i = 1) + r(1) + w(i) + mark(i++) + r(i) + call(++, inc) + w(i) L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== diff --git a/compiler/testData/cfg/invoke.instructions b/compiler/testData/cfg/invoke.instructions index 80a1a5d49a9..f5ac0267840 100644 --- a/compiler/testData/cfg/invoke.instructions +++ b/compiler/testData/cfg/invoke.instructions @@ -7,6 +7,8 @@ L0: v(f: () -> Unit) w(f) + mark({ f() }) + mark(f()) r(f) call(f, invoke) L1: diff --git a/compiler/testData/cfg/multiDeclarationWithError.instructions b/compiler/testData/cfg/multiDeclarationWithError.instructions index a4733029e6f..29e073a7b17 100644 --- a/compiler/testData/cfg/multiDeclarationWithError.instructions +++ b/compiler/testData/cfg/multiDeclarationWithError.instructions @@ -5,19 +5,20 @@ fun foo(x: Int) { } --------------------- L0: - - v(x: Int) - w(x) - r(x) - v(a) - w(a) - v(b) - w(b) - r(a) + + v(x: Int) + w(x) + mark({ val (a, b) = x a }) + r(x) + v(a) + w(a) + v(b) + w(b) + r(a) L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== diff --git a/compiler/testData/cfg/notEqual.instructions b/compiler/testData/cfg/notEqual.instructions index 3d1d565f512..571dbbf58c2 100644 --- a/compiler/testData/cfg/notEqual.instructions +++ b/compiler/testData/cfg/notEqual.instructions @@ -4,24 +4,28 @@ fun neq(a: Int, b: Int) { } --------------------- L0: - - v(a: Int) - w(a) - v(b: Int) - w(b) - r(a) - r(b) - call(a != b, equals) - jf(L2) NEXT:[read (Unit), read (Unit)] - read (Unit) - jmp(L3) NEXT:[] + + v(a: Int) + w(a) + v(b: Int) + w(b) + mark({ if (a != b) {} }) + mark(if (a != b) {}) + mark(a != b) + r(a) + r(b) + call(a != b, equals) + jf(L2) NEXT:[read (Unit), mark({})] + mark({}) + read (Unit) + jmp(L3) NEXT:[] L2: - read (Unit) PREV:[jf(L2)] + read (Unit) PREV:[jf(L2)] L1: L3: - NEXT:[] PREV:[jmp(L3), read (Unit)] + NEXT:[] PREV:[jmp(L3), read (Unit)] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== diff --git a/compiler/testData/cfg/propertySafeCall.instructions b/compiler/testData/cfg/propertySafeCall.instructions index a26bd6cf7c0..72533c5cab1 100644 --- a/compiler/testData/cfg/propertySafeCall.instructions +++ b/compiler/testData/cfg/propertySafeCall.instructions @@ -4,15 +4,17 @@ fun test(s: String?) { } --------------------- L0: - - v(s: String?) - w(s) - r(s) - r(length) + + v(s: String?) + w(s) + mark({ s?.length }) + mark(s?.length) + r(s) + r(length) L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, ] + PREV:[, ] ===================== diff --git a/compiler/testData/cfg/returnsInWhen.instructions b/compiler/testData/cfg/returnsInWhen.instructions index e5aeff8370e..6f213a558da 100644 --- a/compiler/testData/cfg/returnsInWhen.instructions +++ b/compiler/testData/cfg/returnsInWhen.instructions @@ -6,17 +6,17 @@ fun illegalWhenBlock(a: Any): Any { } --------------------- L0: - - v(a: Any) - w(a) + + v(a: Any) + w(a) mark({ when(a) { is Int -> return a } }) - mark(when(a) { is Int -> return a }) - r(a) - mark(is Int -> return a) - jmp?(L4) NEXT:[, r(a)] + mark(when(a) { is Int -> return a }) + r(a) + mark(is Int -> return a) + jmp?(L4) NEXT:[, r(a)] L3: - r(a) - ret(*) L1 NEXT:[] + r(a) + ret(*) L1 NEXT:[] - jmp(L2) PREV:[] L1: L2: diff --git a/compiler/testData/cfg/thisExpression.instructions b/compiler/testData/cfg/thisExpression.instructions index 2563c2e8375..af0f3d5448f 100644 --- a/compiler/testData/cfg/thisExpression.instructions +++ b/compiler/testData/cfg/thisExpression.instructions @@ -5,6 +5,8 @@ fun Function0.foo() { --------------------- L0: + mark({ this() }) + mark(this()) r(this) call(this, ) L1: diff --git a/compiler/testData/cfg/typeParameter.instructions b/compiler/testData/cfg/typeParameter.instructions index 28ae5b25733..e180ded48ce 100644 --- a/compiler/testData/cfg/typeParameter.instructions +++ b/compiler/testData/cfg/typeParameter.instructions @@ -5,6 +5,7 @@ fun foo() { --------------------- L0: + mark({ T }) error(T, No resolved call) L1: NEXT:[] diff --git a/compiler/testData/cfg/unresolved.instructions b/compiler/testData/cfg/unresolved.instructions index 1aec2e37bf4..e06d6898ed7 100644 --- a/compiler/testData/cfg/unresolved.instructions +++ b/compiler/testData/cfg/unresolved.instructions @@ -7,6 +7,9 @@ L0: v(a: Any) w(a) + mark({ a.foo() }) + mark(a.foo()) + mark(foo()) error(foo, No resolved call) error(foo, No resolved call) r(a) diff --git a/compiler/testData/cfg/unusedFunctionLiteral.instructions b/compiler/testData/cfg/unusedFunctionLiteral.instructions index de64b6babfa..c5bc2889d5f 100644 --- a/compiler/testData/cfg/unusedFunctionLiteral.instructions +++ b/compiler/testData/cfg/unusedFunctionLiteral.instructions @@ -4,19 +4,22 @@ fun foo() { } --------------------- L0: - - jmp?(L2) NEXT:[r({}), d({})] - d({}) NEXT:[] + + mark({ {} }) + mark({}) + jmp?(L2) NEXT:[r({}), d({})] + d({}) NEXT:[] L2: - r({}) PREV:[jmp?(L2)] + r({}) PREV:[jmp?(L2)] L1: - NEXT:[] + NEXT:[] error: - PREV:[] + PREV:[] sink: - PREV:[, , d({})] + PREV:[, , d({})] L3: + mark() read (Unit) L4: NEXT:[] @@ -30,6 +33,7 @@ sink: --------------------- L3: + mark() read (Unit) L4: NEXT:[]