Pseudocode: Add debug information to magic instructions
This commit is contained in:
@@ -7,10 +7,10 @@ tailRecursive fun sum(x: Long, sum: Long): Long {
|
||||
L0:
|
||||
1 <START>
|
||||
v(x: Long)
|
||||
magic(x: Long) -> <v0>
|
||||
magic[FAKE_INITIALIZER](x: Long) -> <v0>
|
||||
w(x|<v0>)
|
||||
v(sum: Long)
|
||||
magic(sum: Long) -> <v1>
|
||||
magic[FAKE_INITIALIZER](sum: Long) -> <v1>
|
||||
w(sum|<v1>)
|
||||
2 mark({ if (x == 0.toLong()) return sum return sum(x - 1, sum + x) })
|
||||
mark(if (x == 0.toLong()) return sum)
|
||||
|
||||
@@ -4,19 +4,19 @@ tailRecursive fun sum(x: Long, sum: Long): Long {
|
||||
return sum(x - 1, sum + x)
|
||||
}
|
||||
---------------------
|
||||
<v0>: Long NEW: magic(x: Long) -> <v0>
|
||||
<v1>: Long NEW: magic(sum: Long) -> <v1>
|
||||
x <v2>: OR{{<: Any}, {<: Any}} NEW: r(x) -> <v2>
|
||||
0 <v3>: {<: Number} NEW: r(0) -> <v3>
|
||||
toLong() <v4>: {<: Any?} NEW: call(toLong(), toLong|<v3>) -> <v4>
|
||||
0.toLong() <v4>: {<: Any?} COPY
|
||||
x == 0.toLong() <v5>: Boolean NEW: call(x == 0.toLong(), equals|<v2>, <v4>) -> <v5>
|
||||
sum <v6>: Long NEW: r(sum) -> <v6>
|
||||
x <v7>: Long NEW: r(x) -> <v7>
|
||||
1 <v8>: Int NEW: r(1) -> <v8>
|
||||
x - 1 <v9>: Long NEW: call(x - 1, minus|<v7>, <v8>) -> <v9>
|
||||
sum <v10>: Long NEW: r(sum) -> <v10>
|
||||
x <v11>: Long NEW: r(x) -> <v11>
|
||||
sum + x <v12>: Long NEW: call(sum + x, plus|<v10>, <v11>) -> <v12>
|
||||
<v0>: Long NEW: magic[FAKE_INITIALIZER](x: Long) -> <v0>
|
||||
<v1>: Long NEW: magic[FAKE_INITIALIZER](sum: Long) -> <v1>
|
||||
x <v2>: OR{{<: Any}, {<: Any}} NEW: r(x) -> <v2>
|
||||
0 <v3>: {<: Number} NEW: r(0) -> <v3>
|
||||
toLong() <v4>: {<: Any?} NEW: call(toLong(), toLong|<v3>) -> <v4>
|
||||
0.toLong() <v4>: {<: Any?} COPY
|
||||
x == 0.toLong() <v5>: Boolean NEW: call(x == 0.toLong(), equals|<v2>, <v4>) -> <v5>
|
||||
sum <v6>: Long NEW: r(sum) -> <v6>
|
||||
x <v7>: Long NEW: r(x) -> <v7>
|
||||
1 <v8>: Int NEW: r(1) -> <v8>
|
||||
x - 1 <v9>: Long NEW: call(x - 1, minus|<v7>, <v8>) -> <v9>
|
||||
sum <v10>: Long NEW: r(sum) -> <v10>
|
||||
x <v11>: Long NEW: r(x) -> <v11>
|
||||
sum + x <v12>: Long NEW: call(sum + x, plus|<v10>, <v11>) -> <v12>
|
||||
sum(x - 1, sum + x) <v13>: Long NEW: call(sum(x - 1, sum + x), sum|<v9>, <v12>) -> <v13>
|
||||
=====================
|
||||
=====================
|
||||
|
||||
@@ -19,7 +19,7 @@ L0:
|
||||
- 2 jmp(L3 [afterCatches]) NEXT:[<END>] PREV:[]
|
||||
L2 [onException]:
|
||||
3 v(e: Throwable) PREV:[jmp?(L2 [onException])]
|
||||
magic(e: Throwable) -> <v1>
|
||||
magic[FAKE_INITIALIZER](e: Throwable) -> <v1>
|
||||
w(e|<v1>)
|
||||
4 mark({ })
|
||||
read (Unit)
|
||||
|
||||
@@ -7,6 +7,6 @@ tailRecursive fun foo() {
|
||||
}
|
||||
}
|
||||
---------------------
|
||||
<v1>: {<: Throwable} NEW: magic(e: Throwable) -> <v1>
|
||||
foo() <v0>: Unit NEW: call(foo(), foo) -> <v0>
|
||||
=====================
|
||||
<v1>: {<: Throwable} NEW: magic[FAKE_INITIALIZER](e: Throwable) -> <v1>
|
||||
foo() <v0>: Unit NEW: call(foo(), foo) -> <v0>
|
||||
=====================
|
||||
|
||||
@@ -21,7 +21,7 @@ L0:
|
||||
2 jmp(L4 [afterCatches]) NEXT:[jmp(L5 [skipFinallyToErrorBlock])]
|
||||
L2 [onException]:
|
||||
3 v(any : Exception) PREV:[jmp?(L2 [onException])]
|
||||
magic(any : Exception) -> <v1>
|
||||
magic[FAKE_INITIALIZER](any : Exception) -> <v1>
|
||||
w(any|<v1>)
|
||||
4 mark({ test() })
|
||||
mark(test())
|
||||
|
||||
@@ -9,13 +9,13 @@ fun test() : Unit {
|
||||
}
|
||||
}
|
||||
---------------------
|
||||
<v1>: {<: Exception} NEW: magic(any : Exception) -> <v1>
|
||||
test() <v0>: * NEW: call(test(), test) -> <v0>
|
||||
{ test() } <v0>: * COPY
|
||||
test() <v2>: * NEW: call(test(), test) -> <v2>
|
||||
{ test() } <v2>: * COPY
|
||||
test() <v3>: * NEW: call(test(), test) -> <v3>
|
||||
{ test() } <v3>: * COPY
|
||||
<v1>: {<: Exception} NEW: magic[FAKE_INITIALIZER](any : Exception) -> <v1>
|
||||
test() <v0>: * NEW: call(test(), test) -> <v0>
|
||||
{ test() } <v0>: * COPY
|
||||
test() <v2>: * NEW: call(test(), test) -> <v2>
|
||||
{ test() } <v2>: * COPY
|
||||
test() <v3>: * NEW: call(test(), test) -> <v3>
|
||||
{ test() } <v3>: * COPY
|
||||
try { test() } catch (any : Exception) { test() } finally { test() } <v4>: * NEW: merge(try { test() } catch (any : Exception) { test() } finally { test() }|<v0>, <v2>) -> <v4>
|
||||
{ try { test() } catch (any : Exception) { test() } finally { test() } } <v4>: * COPY
|
||||
=====================
|
||||
{ try { test() } catch (any : Exception) { test() } finally { test() } } <v4>: * COPY
|
||||
=====================
|
||||
|
||||
Reference in New Issue
Block a user