Pseudocode: don't write full label name when jump on it

This commit is contained in:
Svetlana Isakova
2014-09-03 16:00:41 +04:00
parent 3a9b7bbade
commit 976d5ab030
89 changed files with 482 additions and 480 deletions
@@ -18,12 +18,12 @@ L0:
r(2) -> <v1>
mark(1 < 2)
call(1 < 2, compareTo|<v0>, <v1>) -> <v2>
jf(L2 [else branch]|<v2>)
jf(L2|<v2>)
3 mark({ use(b) }) USE: in: {b=READ} out: {b=READ}
r(b) -> <v3> USE: in: {} out: {b=READ}
mark(use(b))
call(use(b), use|<v3>) -> <v4>
2 jmp(L3 ['if' expression result]) USE: in: {} out: {}
2 jmp(L3) USE: in: {} out: {}
L2 [else branch]:
3 mark({ b = true })
r(true) -> <v5> USE: in: {b=ONLY_WRITTEN_NEVER_READ} out: {b=ONLY_WRITTEN_NEVER_READ}
@@ -19,4 +19,4 @@ error:
<ERROR> INIT: in: {} out: {}
sink:
<SINK> INIT: in: {x=ID} out: {x=ID} USE: in: {} out: {}
=====================
=====================
@@ -15,7 +15,7 @@ L0:
w(a|<v0>) INIT: in: {a=D} out: {a=ID}
v(val f = { (x: Int) -> val y = x + a use(a) }) INIT: in: {a=ID} out: {a=ID, f=D}
mark({ (x: Int) -> val y = x + a use(a) }) INIT: in: {a=ID, f=D} out: {a=ID, f=D}
jmp?(L2 [after local declaration])
jmp?(L2)
d({ (x: Int) -> val y = x + a use(a) }) USE: in: {a=READ} out: {a=READ}
L2 [after local declaration]:
r({ (x: Int) -> val y = x + a use(a) }) -> <v1>
@@ -72,4 +72,4 @@ error:
<ERROR> INIT: in: {} out: {}
sink:
<SINK> INIT: in: {a=ID} out: {a=ID} USE: in: {} out: {}
=====================
=====================
@@ -64,4 +64,4 @@ error:
<ERROR> INIT: in: {} out: {}
sink:
<SINK> INIT: in: {c=D} out: {c=D} USE: in: {} out: {}
=====================
=====================
@@ -62,4 +62,4 @@ error:
<ERROR> INIT: in: {} out: {}
sink:
<SINK> INIT: in: {a=ID} out: {a=ID} USE: in: {} out: {}
=====================
=====================
@@ -9,7 +9,7 @@ L0:
1 <START> INIT: in: {} out: {}
v(val sum: (Int)->Int = { (x: Int) -> sum(x - 1) + x }) INIT: in: {} out: {sum=D}
mark({ (x: Int) -> sum(x - 1) + x }) INIT: in: {sum=D} out: {sum=D}
jmp?(L2 [after local declaration])
jmp?(L2)
d({ (x: Int) -> sum(x - 1) + x }) USE: in: {sum=READ} out: {sum=READ}
L2 [after local declaration]:
r({ (x: Int) -> sum(x - 1) + x }) -> <v0>
@@ -91,7 +91,7 @@ L0:
magic[IMPLICIT_RECEIVER](obj) -> <v3> INIT: in: {obj=D, x=D} out: {obj=D, x=D}
r(obj|<v3>) -> <v4>
w(x|<v4>) INIT: in: {obj=D, x=D} out: {obj=D, x=ID}
1 jmp?(L2 [after local declaration]) INIT: in: {obj=D} out: {obj=D}
1 jmp?(L2) INIT: in: {obj=D} out: {obj=D}
d(fun foo() { val y = obj }) USE: in: {obj=READ} out: {obj=READ}
L2 [after local declaration]:
r(object: A(obj) { { val x = obj } fun foo() { val y = obj } }) -> <v5>
@@ -19,11 +19,11 @@ L0:
r(2) -> <v1>
mark(1 < 2)
call(1 < 2, compareTo|<v0>, <v1>) -> <v2>
jf(L2 [else branch]|<v2>)
jf(L2|<v2>)
3 mark({ b = false })
r(false) -> <v3> USE: in: {b=WRITTEN_AFTER_READ} out: {b=WRITTEN_AFTER_READ}
w(b|<v3>) INIT: in: {b=D} out: {b=ID} USE: in: {b=READ} out: {b=WRITTEN_AFTER_READ}
2 jmp(L3 ['if' expression result]) INIT: in: {b=ID} out: {b=ID} USE: in: {b=READ} out: {b=READ}
2 jmp(L3) INIT: in: {b=ID} out: {b=ID} USE: in: {b=READ} out: {b=READ}
L2 [else branch]:
3 mark({ b = true }) INIT: in: {b=D} out: {b=D}
r(true) -> <v5> USE: in: {b=WRITTEN_AFTER_READ} out: {b=WRITTEN_AFTER_READ}
@@ -23,7 +23,7 @@ L0:
v(i) INIT: in: {numbers=ID} out: {i=D, numbers=ID}
L2 [loop entry point]:
L6 [condition entry point]:
jmp?(L3 [loop exit point]) INIT: in: {i=D, numbers=ID} out: {i=D, numbers=ID}
jmp?(L3) INIT: in: {i=D, numbers=ID} out: {i=D, numbers=ID}
magic[LOOP_RANGE_ITERATION](numbers|<v1>) -> <v2>
w(i|<v2>) INIT: in: {i=D, numbers=ID} out: {i=ID, numbers=ID}
mark(for (i in numbers) { val b: Boolean if (1 < 2) { b = false } else { b = true } use(b) continue }) INIT: in: {i=ID, numbers=ID} out: {i=ID, numbers=ID} USE: in: {} out: {}
@@ -35,11 +35,11 @@ L4 [body entry point]:
r(2) -> <v4>
mark(1 < 2)
call(1 < 2, compareTo|<v3>, <v4>) -> <v5>
jf(L7 [else branch]|<v5>)
jf(L7|<v5>)
5 mark({ b = false })
r(false) -> <v6> USE: in: {b=WRITTEN_AFTER_READ} out: {b=WRITTEN_AFTER_READ}
w(b|<v6>) INIT: in: {b=D, i=ID, numbers=ID} out: {b=ID, i=ID, numbers=ID} USE: in: {b=READ} out: {b=WRITTEN_AFTER_READ}
4 jmp(L8 ['if' expression result]) INIT: in: {b=ID, i=ID, numbers=ID} out: {b=ID, i=ID, numbers=ID} USE: in: {b=READ} out: {b=READ}
4 jmp(L8) INIT: in: {b=ID, i=ID, numbers=ID} out: {b=ID, i=ID, numbers=ID} USE: in: {b=READ} out: {b=READ}
L7 [else branch]:
5 mark({ b = true }) INIT: in: {b=D, i=ID, numbers=ID} out: {b=D, i=ID, numbers=ID}
r(true) -> <v8> USE: in: {b=WRITTEN_AFTER_READ} out: {b=WRITTEN_AFTER_READ}
@@ -49,8 +49,8 @@ L8 ['if' expression result]:
r(b) -> <v11> USE: in: {} out: {b=READ}
mark(use(b))
call(use(b), use|<v11>) -> <v12>
jmp(L6 [condition entry point]) USE: in: {} out: {}
- 3 jmp(L2 [loop entry point])
jmp(L6) USE: in: {} out: {}
- 3 jmp(L2)
L3 [loop exit point]:
L5 [body exit point]:
read (Unit) INIT: in: {i=D, numbers=ID} out: {i=D, numbers=ID}
@@ -77,4 +77,4 @@ error:
<ERROR> INIT: in: {} out: {}
sink:
<SINK> INIT: in: {a=ID} out: {a=ID} USE: in: {} out: {}
=====================
=====================
@@ -25,7 +25,7 @@ L6 [condition entry point]:
r(0) -> <v3>
mark(a > 0)
call(a > 0, compareTo|<v2>, <v3>) -> <v4>
jt(L2 [loop entry point]|<v4>) USE: in: {a=READ} out: {a=READ}
jt(L2|<v4>) USE: in: {a=READ} out: {a=READ}
L3 [loop exit point]:
read (Unit)
2 mark("after") INIT: in: {} out: {}
@@ -36,4 +36,4 @@ error:
<ERROR>
sink:
<SINK> USE: in: {} out: {}
=====================
=====================
@@ -19,7 +19,7 @@ L0:
v(i) INIT: in: {} out: {i=D}
L2 [loop entry point]:
L6 [condition entry point]:
jmp?(L3 [loop exit point]) INIT: in: {i=D} out: {i=D}
jmp?(L3) INIT: in: {i=D} out: {i=D}
magic[LOOP_RANGE_ITERATION](1..10|<v3>) -> <v4>
w(i|<v4>) INIT: in: {i=D} out: {i=ID}
mark(for (i in 1..10) { val a = i }) INIT: in: {i=ID} out: {i=ID}
@@ -28,7 +28,7 @@ L4 [body entry point]:
v(val a = i) INIT: in: {i=ID} out: {a=D, i=ID}
r(i) -> <v5> INIT: in: {a=D, i=ID} out: {a=D, i=ID}
w(a|<v5>) INIT: in: {a=D, i=ID} out: {a=ID, i=ID}
3 jmp(L2 [loop entry point]) INIT: in: {i=ID} out: {i=ID} USE: in: {i=READ} out: {i=READ}
3 jmp(L2) INIT: in: {i=ID} out: {i=ID} USE: in: {i=READ} out: {i=READ}
L3 [loop exit point]:
L5 [body exit point]:
read (Unit) INIT: in: {i=D} out: {i=D}
@@ -40,4 +40,4 @@ error:
<ERROR>
sink:
<SINK> USE: in: {} out: {}
=====================
=====================
@@ -18,7 +18,7 @@ L0:
w(b|<v1>) INIT: in: {b=D} out: {b=ID}
v(val f = { (x: Int) -> val a = x + b }) INIT: in: {b=ID} out: {b=ID, f=D}
mark({ (x: Int) -> val a = x + b }) INIT: in: {b=ID, f=D} out: {b=ID, f=D}
jmp?(L2 [after local declaration])
jmp?(L2)
d({ (x: Int) -> val a = x + b }) USE: in: {b=READ} out: {b=READ}
L2 [after local declaration]:
r({ (x: Int) -> val a = x + b }) -> <v2>
@@ -17,12 +17,12 @@ L0:
r("before") -> <v0>
mark(if (true) { val a = 1 } else { val b = 2 })
r(true) -> <v1>
jf(L2 [else branch]|<v1>)
jf(L2|<v1>)
3 mark({ val a = 1 })
v(val a = 1) INIT: in: {} out: {a=D}
r(1) -> <v2> INIT: in: {a=D} out: {a=D}
w(a|<v2>) INIT: in: {a=D} out: {a=ID}
2 jmp(L3 ['if' expression result]) INIT: in: {} out: {}
2 jmp(L3) INIT: in: {} out: {}
L2 [else branch]:
3 mark({ val b = 2 })
v(val b = 2) INIT: in: {} out: {b=D}
@@ -25,7 +25,7 @@ L0:
magic[IMPLICIT_RECEIVER](x) -> <v2> INIT: in: {a=D, x=ID} out: {a=D, x=ID}
r(x|<v2>) -> <v3>
w(a|<v3>) INIT: in: {a=D, x=ID} out: {a=ID, x=ID}
2 jmp?(L2 [after local declaration]) INIT: in: {x=ID} out: {x=ID}
2 jmp?(L2) INIT: in: {x=ID} out: {x=ID}
d(fun foo() { val b = x }) USE: in: {x=READ} out: {x=READ}
L2 [after local declaration]:
mark("after")
@@ -16,7 +16,7 @@ L0:
v(val b = 1) INIT: in: {} out: {b=D}
r(1) -> <v1> INIT: in: {b=D} out: {b=D}
w(b|<v1>) INIT: in: {b=D} out: {b=ID}
jmp?(L2 [after local declaration]) INIT: in: {b=ID} out: {b=ID}
jmp?(L2) INIT: in: {b=ID} out: {b=ID}
d(fun local(x: Int) { val a = x + b }) USE: in: {b=READ} out: {b=READ}
L2 [after local declaration]:
mark("after")
@@ -14,7 +14,7 @@ L0:
v(val b = 1) INIT: in: {} out: {b=D}
r(1) -> <v1> INIT: in: {b=D} out: {b=D}
w(b|<v1>) INIT: in: {b=D} out: {b=ID}
jmp?(L2 [after local declaration]) INIT: in: {b=ID} out: {b=ID}
jmp?(L2) INIT: in: {b=ID} out: {b=ID}
d(fun local(x: Int) = x + b) USE: in: {b=READ} out: {b=READ}
L2 [after local declaration]:
mark("after")
@@ -21,7 +21,7 @@ L0:
v(val a = 1) INIT: in: {} out: {a=D}
r(1) -> <v1> INIT: in: {a=D} out: {a=D}
w(a|<v1>) INIT: in: {a=D} out: {a=ID}
2 jmp?(L2 [after local declaration]) INIT: in: {} out: {}
2 jmp?(L2) INIT: in: {} out: {}
d(fun foo() { val b = 2 })
L2 [after local declaration]:
mark("after")
@@ -23,7 +23,7 @@ L0:
v(val x = 1) INIT: in: {bar=D} out: {bar=D, x=D}
r(1) -> <v1> INIT: in: {bar=D, x=D} out: {bar=D, x=D}
w(x|<v1>) INIT: in: {bar=D, x=D} out: {bar=D, x=ID}
2 jmp?(L2 [after local declaration]) INIT: in: {bar=D} out: {bar=D}
2 jmp?(L2) INIT: in: {bar=D} out: {bar=D}
d(fun foo() { val a = 2 })
L2 [after local declaration]:
r(object { { val x = 1 } fun foo() { val a = 2 } }) -> <v2>
@@ -15,10 +15,10 @@ L0:
1 <START> INIT: in: {} out: {} USE: in: {} out: {}
2 mark({ class A { var a : Int get() { return $a } set(v: Int) { $a = v } } })
v(var a : Int get() { return $a } set(v: Int) { $a = v }) INIT: in: {} out: {a=D}
jmp?(L2 [after local declaration]) INIT: in: {a=D} out: {a=D}
jmp?(L2) INIT: in: {a=D} out: {a=D}
d(get() { return $a }) USE: in: {a=READ} out: {a=READ}
L2 [after local declaration]:
jmp?(L5 [after local declaration])
jmp?(L5)
d(set(v: Int) { $a = v }) USE: in: {a=ONLY_WRITTEN_NEVER_READ} out: {a=ONLY_WRITTEN_NEVER_READ}
L1:
L5 [after local declaration]:
@@ -19,12 +19,12 @@ L0:
mark("before")
r("before") -> <v0>
mark(try { foo() } catch (e: Exception) { val a = e } finally { val a = 1 })
jmp?(L2 [onException])
jmp?(L3 [onExceptionToFinallyBlock])
jmp?(L2)
jmp?(L3)
3 mark({ foo() })
mark(foo())
call(foo(), foo) -> <v1>
2 jmp(L4 [afterCatches]) USE: in: {} out: {}
2 jmp(L4) USE: in: {} out: {}
L2 [onException]:
3 v(e: Exception) INIT: in: {} out: {e=D}
magic[FAKE_INITIALIZER](e: Exception) -> <v2> INIT: in: {e=D} out: {e=D}
@@ -33,9 +33,9 @@ L2 [onException]:
v(val a = e) INIT: in: {e=ID} out: {a=D, e=ID} USE: in: {e=READ} out: {e=READ}
r(e) -> <v3> INIT: in: {a=D, e=ID} out: {a=D, e=ID} USE: in: {} out: {e=READ}
w(a|<v3>) INIT: in: {a=D, e=ID} out: {a=ID, e=ID}
3 jmp(L4 [afterCatches]) INIT: in: {e=ID} out: {e=ID}
3 jmp(L4) INIT: in: {e=ID} out: {e=ID}
L4 [afterCatches]:
2 jmp(L5 [skipFinallyToErrorBlock]) INIT: in: {} out: {}
2 jmp(L5) INIT: in: {} out: {}
L3 [onExceptionToFinallyBlock]:
L6 [start finally]:
3 mark({ val a = 1 })
@@ -45,6 +45,7 @@ L6 [start finally]:
L7 [finish finally]:
2 jmp(error) INIT: in: {} out: {}
L5 [skipFinallyToErrorBlock]:
L8 [copy of L3, onExceptionToFinallyBlock]:
3 mark({ val a = 1 })
v(val a = 1) INIT: in: {} out: {a=D}
r(1) -> <v4> INIT: in: {a=D} out: {a=D}
@@ -58,4 +59,4 @@ error:
<ERROR>
sink:
<SINK> USE: in: {} out: {}
=====================
=====================
@@ -20,7 +20,7 @@ L6 [condition entry point]:
L4 [body entry point]:
3 mark({ val a: Int })
v(val a: Int) INIT: in: {} out: {a=D}
2 jmp(L2 [loop entry point]) INIT: in: {} out: {} USE: in: {} out: {}
2 jmp(L2) INIT: in: {} out: {} USE: in: {} out: {}
L3 [loop exit point]:
L5 [body exit point]:
- read (Unit)
@@ -32,4 +32,4 @@ error:
<ERROR>
sink:
<SINK> USE: in: {} out: {}
=====================
=====================