== 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: {} ===================== == getBoolean == fun getBoolean(): Boolean = false --------------------- L0: 1 INIT: in: {} out: {} r(false) -> ret(*|) L1 L1: error: sink: USE: in: {} out: {} ===================== == test == fun test() { val x: Int if (getBoolean()) myRun { while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } x = 42 } else myRun { x = 42 } x.inc() } --------------------- L0: 1 INIT: in: {} out: {} USE: in: {} out: {} 2 mark({ val x: Int if (getBoolean()) myRun { while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } x = 42 } else myRun { x = 42 } x.inc() }) v(val x: Int) INIT: in: {} out: {x=D} mark(if (getBoolean()) myRun { while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } x = 42 } else myRun { x = 42 }) INIT: in: {x=D} out: {x=D} mark(getBoolean()) call(getBoolean(), getBoolean) -> jf(L2|) mark({ while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } x = 42 }) r({ while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } x = 42 }) -> mark(myRun { while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } x = 42 }) call(myRun { while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } x = 42 }, myRun|) -> L3 [before inlined declaration]: inlined({ while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } x = 42 }) INIT: in: {x=ID} out: {x=ID} USE: in: {x=WRITTEN_AFTER_READ} out: {x=WRITTEN_AFTER_READ} L4 [after inlined declaration]: jmp(L31) USE: in: {x=READ} out: {x=READ} L2 [else branch]: mark({ x = 42 }) INIT: in: {x=D} out: {x=D} r({ x = 42 }) -> mark(myRun { x = 42 }) call(myRun { x = 42 }, myRun|) -> L32 [before inlined declaration]: inlined({ x = 42 }) INIT: in: {x=ID} out: {x=ID} USE: in: {x=WRITTEN_AFTER_READ} out: {x=WRITTEN_AFTER_READ} L31 ['if' expression result]: L33 [after inlined declaration]: merge(if (getBoolean()) myRun { while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } x = 42 } else myRun { x = 42 }|, ) -> 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 == { while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } x = 42 } --------------------- L5: 3 INIT: in: {x=D} out: {x=D} 4 mark(while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break } x = 42) L7 [loop entry point]: L11 [condition entry point]: mark(getBoolean()) call(getBoolean(), getBoolean) -> mark(while (getBoolean()) { do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break }) jf(L8|) L9 [body entry point]: 5 mark({ do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean()) myRun { x.inc() } myRun { x = 42 } break }) 6 mark(do { myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break } while (getBoolean())) L12 [loop entry point]: L14 [body entry point]: mark({ myRun { if (getBoolean()) { x = 42 } else { x = 43 } } break }) mark({ if (getBoolean()) { x = 42 } else { x = 43 } }) r({ if (getBoolean()) { x = 42 } else { x = 43 } }) -> mark(myRun { if (getBoolean()) { x = 42 } else { x = 43 } }) call(myRun { if (getBoolean()) { x = 42 } else { x = 43 } }, myRun|) -> L17 [before inlined declaration]: inlined({ if (getBoolean()) { x = 42 } else { x = 43 } }) INIT: in: {x=ID} out: {x=ID} USE: in: {x=WRITTEN_AFTER_READ} out: {x=WRITTEN_AFTER_READ} L18 [after inlined declaration]: jmp(L13) USE: in: {x=READ} out: {x=READ} L15 [body exit point]: L16 [condition entry point]: - mark(getBoolean()) - call(getBoolean(), getBoolean) -> - 5 jt(L12|) L13 [loop exit point]: read (Unit) INIT: in: {x=ID} out: {x=ID} mark({ x.inc() }) r({ x.inc() }) -> mark(myRun { x.inc() }) call(myRun { x.inc() }, myRun|) -> L23 [before inlined declaration]: inlined({ x.inc() }) USE: in: {x=READ} out: {x=READ} L24 [after inlined declaration]: mark({ x = 42 }) r({ x = 42 }) -> mark(myRun { x = 42 }) call(myRun { x = 42 }, myRun|) -> L27 [before inlined declaration]: inlined({ x = 42 }) L28 [after inlined declaration]: jmp(L8) USE: in: {x=WRITTEN_AFTER_READ} out: {x=WRITTEN_AFTER_READ} - 4 jmp(L7) L8 [loop exit point]: L10 [body exit point]: read (Unit) 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} L6: 3 INIT: in: {x=ID} out: {x=ID} USE: in: {x=READ} out: {x=READ} error: - sink: INIT: in: {x=ID} out: {x=ID} USE: in: {x=READ} out: {x=READ} ===================== == inlined anonymous_2 == { if (getBoolean()) { x = 42 } else { x = 43 } } --------------------- L19: 7 INIT: in: {x=D} out: {x=D} 8 mark(if (getBoolean()) { x = 42 } else { x = 43 }) mark(if (getBoolean()) { x = 42 } else { x = 43 }) mark(getBoolean()) call(getBoolean(), getBoolean) -> jf(L21|) 9 mark({ x = 42 }) r(42) -> 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} 8 jmp(L22) INIT: in: {x=ID} out: {x=ID} USE: in: {x=READ} out: {x=READ} L21 [else branch]: 9 mark({ x = 43 }) INIT: in: {x=D} out: {x=D} r(43) -> 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} L22 ['if' expression result]: 8 merge(if (getBoolean()) { x = 42 } else { x = 43 }|!, !) -> INIT: in: {x=ID} out: {x=ID} L20: 7 USE: in: {x=READ} out: {x=READ} error: - sink: INIT: in: {x=ID} out: {x=ID} USE: in: {x=READ} out: {x=READ} ===================== == inlined anonymous_3 == { x.inc() } --------------------- L25: 6 INIT: in: {x=ID} out: {x=ID} 7 mark(x.inc()) mark(x.inc()) USE: in: {x=READ} out: {x=READ} r(x) -> USE: in: {x=WRITTEN_AFTER_READ} out: {x=READ} mark(inc()) call(inc(), inc|) -> 6 ret(*|) L26 L26: USE: in: {x=WRITTEN_AFTER_READ} out: {x=WRITTEN_AFTER_READ} error: - sink: INIT: in: {x=ID} out: {x=ID} USE: in: {x=WRITTEN_AFTER_READ} out: {x=WRITTEN_AFTER_READ} ===================== == inlined anonymous_4 == { x = 42 } --------------------- L29: 6 INIT: in: {x=ID} out: {x=ID} 7 mark(x = 42) r(42) -> w(x|) L30: 6 USE: in: {x=WRITTEN_AFTER_READ} out: {x=WRITTEN_AFTER_READ} error: - sink: INIT: in: {x=ID} out: {x=ID} USE: in: {x=WRITTEN_AFTER_READ} out: {x=WRITTEN_AFTER_READ} ===================== == inlined anonymous_5 == { x = 42 } --------------------- L34: 3 INIT: in: {x=D} out: {x=D} 4 mark(x = 42) r(42) -> 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} L35: 3 INIT: in: {x=ID} out: {x=ID} USE: in: {x=READ} out: {x=READ} error: - sink: INIT: in: {x=ID} out: {x=ID} USE: in: {x=READ} out: {x=READ} =====================