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