== myRun == inline fun myRun(block: () -> T): T { contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } return block() } --------------------- L0: 1 v(block: () -> T) magic[FAKE_INITIALIZER](block: () -> T) -> w(block|) 2 mark({ contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } return block() }) mark({ callsInPlace(block, InvocationKind.EXACTLY_ONCE) }) jmp?(L2) NEXT:[r({ callsInPlace(block, InvocationKind.EXACTLY_ONCE) }) -> , d({ callsInPlace(block, InvocationKind.EXACTLY_ONCE) })] d({ callsInPlace(block, InvocationKind.EXACTLY_ONCE) }) NEXT:[] L2 [after local declaration]: r({ callsInPlace(block, InvocationKind.EXACTLY_ONCE) }) -> PREV:[jmp?(L2)] mark(contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }) call(contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }, contract|) -> r(block) -> mark(block()) call(block(), invoke|) -> ret(*|) L1 L1: 1 NEXT:[] error: PREV:[] sink: PREV:[, , d({ callsInPlace(block, InvocationKind.EXACTLY_ONCE) })] ===================== == anonymous_0 == { callsInPlace(block, InvocationKind.EXACTLY_ONCE) } --------------------- L3: 3 4 mark(callsInPlace(block, InvocationKind.EXACTLY_ONCE)) magic[IMPLICIT_RECEIVER](callsInPlace(block, InvocationKind.EXACTLY_ONCE)) -> r(block) -> mark(InvocationKind.EXACTLY_ONCE) r(EXACTLY_ONCE) -> mark(callsInPlace(block, InvocationKind.EXACTLY_ONCE)) call(callsInPlace(block, InvocationKind.EXACTLY_ONCE), callsInPlace|, , ) -> L4: 3 NEXT:[] error: PREV:[] sink: PREV:[, ] ===================== == someComputation == fun someComputation(): Int = 42 --------------------- L0: 1 r(42) -> ret(*|) L1 L1: NEXT:[] error: PREV:[] sink: PREV:[, ] ===================== == report == fun report(x: Int) = Unit --------------------- L0: 1 v(x: Int) magic[FAKE_INITIALIZER](x: Int) -> w(x|) r(Unit) -> ret(*|) L1 L1: NEXT:[] error: PREV:[] sink: PREV:[, ] ===================== == innerTryCatchFinally == fun innerTryCatchFinally() { val x: Int myRun { try { x = someComputation() report(x) } catch (e: java.lang.Exception) { x = 42 report(x) } finally { x = 0 } } x.inc() } --------------------- L0: 1 2 mark({ val x: Int myRun { try { x = someComputation() report(x) } catch (e: java.lang.Exception) { x = 42 report(x) } finally { x = 0 } } x.inc() }) v(val x: Int) mark({ try { x = someComputation() report(x) } catch (e: java.lang.Exception) { x = 42 report(x) } finally { x = 0 } }) r({ try { x = someComputation() report(x) } catch (e: java.lang.Exception) { x = 42 report(x) } finally { x = 0 } }) -> mark(myRun { try { x = someComputation() report(x) } catch (e: java.lang.Exception) { x = 42 report(x) } finally { x = 0 } }) call(myRun { try { x = someComputation() report(x) } catch (e: java.lang.Exception) { x = 42 report(x) } finally { x = 0 } }, myRun|) -> L2 [before inlined declaration]: inlined({ try { x = someComputation() report(x) } catch (e: java.lang.Exception) { x = 42 report(x) } finally { x = 0 } }) L3 [after inlined declaration]: mark(x.inc()) r(x) -> mark(inc()) call(inc(), inc|) -> L1: 1 NEXT:[] error: PREV:[] sink: PREV:[, ] ===================== == inlined anonymous_1 == { try { x = someComputation() report(x) } catch (e: java.lang.Exception) { x = 42 report(x) } finally { x = 0 } } --------------------- L4: 3 4 mark(try { x = someComputation() report(x) } catch (e: java.lang.Exception) { x = 42 report(x) } finally { x = 0 }) mark(try { x = someComputation() report(x) } catch (e: java.lang.Exception) { x = 42 report(x) } finally { x = 0 }) jmp?(L6) NEXT:[v(e: java.lang.Exception), jmp?(L7)] jmp?(L7) NEXT:[mark({ x = 0 }), mark({ x = someComputation() report(x) })] 5 mark({ x = someComputation() report(x) }) mark(someComputation()) call(someComputation(), someComputation) -> w(x|) r(x) -> mark(report(x)) call(report(x), report|) -> 4 jmp?(L6) NEXT:[v(e: java.lang.Exception), jmp?(L7)] jmp?(L7) NEXT:[mark({ x = 0 }), jmp(L8)] jmp(L8) NEXT:[jmp(L9)] L6 [onException]: 5 v(e: java.lang.Exception) PREV:[jmp?(L6), jmp?(L6)] magic[FAKE_INITIALIZER](e: java.lang.Exception) -> w(e|) 6 mark({ x = 42 report(x) }) r(42) -> w(x|) r(x) -> mark(report(x)) call(report(x), report|) -> 5 jmp(L8) L8 [afterCatches]: 4 jmp(L9) NEXT:[mark({ x = 0 })] PREV:[jmp(L8), jmp(L8)] L7 [onExceptionToFinallyBlock]: L10 [start finally]: 5 mark({ x = 0 }) PREV:[jmp?(L7), jmp?(L7)] r(0) -> w(x|) L11 [finish finally]: 4 jmp(error) NEXT:[] L9 [skipFinallyToErrorBlock]: L12 [copy of L7, onExceptionToFinallyBlock]: 5 mark({ x = 0 }) PREV:[jmp(L9)] r(0) -> w(x|) 4 merge(try { x = someComputation() report(x) } catch (e: java.lang.Exception) { x = 42 report(x) } finally { x = 0 }|, ) -> L5: 3 NEXT:[] error: PREV:[jmp(error)] sink: PREV:[, ] =====================