Refactoring of CompileTimeConstant, introduce flag to represent a constant being referenced by a variable
This commit is contained in:
@@ -1,25 +1,25 @@
|
||||
== main ==
|
||||
fun main() {
|
||||
while(1 > 0) {
|
||||
while(0 > 1) {
|
||||
2
|
||||
}
|
||||
}
|
||||
---------------------
|
||||
L0:
|
||||
1 <START>
|
||||
2 mark({ while(1 > 0) { 2 } })
|
||||
mark(while(1 > 0) { 2 })
|
||||
2 mark({ while(0 > 1) { 2 } })
|
||||
mark(while(0 > 1) { 2 })
|
||||
L2 [loop entry point]:
|
||||
L5 [condition entry point]:
|
||||
mark(1 > 0) PREV:[mark(while(1 > 0) { 2 }), jmp(L2 [loop entry point])]
|
||||
r(1)
|
||||
mark(0 > 1) PREV:[mark(while(0 > 1) { 2 }), jmp(L2 [loop entry point])]
|
||||
r(0)
|
||||
r(1)
|
||||
call(>, compareTo)
|
||||
jf(L3 [loop exit point]) NEXT:[read (Unit), mark({ 2 })]
|
||||
L4 [body entry point]:
|
||||
3 mark({ 2 })
|
||||
r(2)
|
||||
2 jmp(L2 [loop entry point]) NEXT:[mark(1 > 0)]
|
||||
2 jmp(L2 [loop entry point]) NEXT:[mark(0 > 1)]
|
||||
L3 [loop exit point]:
|
||||
read (Unit) PREV:[jf(L3 [loop exit point])]
|
||||
L1:
|
||||
@@ -32,21 +32,21 @@ sink:
|
||||
== dowhile ==
|
||||
fun dowhile() {
|
||||
do {return}
|
||||
while(1 > 0)
|
||||
while(0 > 1)
|
||||
}
|
||||
---------------------
|
||||
L0:
|
||||
1 <START>
|
||||
2 mark({ do {return} while(1 > 0) })
|
||||
3 mark(do {return} while(1 > 0))
|
||||
2 mark({ do {return} while(0 > 1) })
|
||||
3 mark(do {return} while(0 > 1))
|
||||
L2 [loop entry point]:
|
||||
L4 [body entry point]:
|
||||
mark({return})
|
||||
ret L1 NEXT:[<END>]
|
||||
L5 [condition entry point]:
|
||||
- mark(1 > 0) PREV:[]
|
||||
- r(1) PREV:[]
|
||||
- mark(0 > 1) PREV:[]
|
||||
- r(0) PREV:[]
|
||||
- r(1) PREV:[]
|
||||
- call(>, compareTo) PREV:[]
|
||||
- jt(L2 [loop entry point]) NEXT:[read (Unit), mark({return})] PREV:[]
|
||||
L3 [loop exit point]:
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
fun main() {
|
||||
while(1 > 0) {
|
||||
while(0 > 1) {
|
||||
2
|
||||
}
|
||||
}
|
||||
|
||||
fun dowhile() {
|
||||
do {return}
|
||||
while(1 > 0)
|
||||
while(0 > 1)
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
fun test() {
|
||||
[ann]
|
||||
while (1 < 2) {}
|
||||
while (2 < 1) {}
|
||||
|
||||
[ann]
|
||||
do {} while (1 < 2)
|
||||
do {} while (2 < 1)
|
||||
|
||||
[ann]
|
||||
for (i in 1..2) {}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
fun test() {
|
||||
[ann]
|
||||
while (2 > 1) {}
|
||||
|
||||
[ann]
|
||||
<!UNREACHABLE_CODE!>do {} while (2 > 1)<!>
|
||||
|
||||
[ann]
|
||||
<!UNREACHABLE_CODE!>for (i in 1..2) {}<!>
|
||||
}
|
||||
|
||||
annotation class ann
|
||||
@@ -0,0 +1,11 @@
|
||||
package test
|
||||
|
||||
val x = 1
|
||||
val y = "a"
|
||||
|
||||
// val prop1: true
|
||||
val prop1 = x
|
||||
|
||||
// val prop2: true
|
||||
val prop2 = y
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package test
|
||||
|
||||
enum class MyEnum { A;B }
|
||||
|
||||
fun foo(): Boolean = true
|
||||
|
||||
val x = 1
|
||||
|
||||
// val prop1: null
|
||||
val prop1 = MyEnum.A
|
||||
|
||||
// val prop2: null
|
||||
val prop2 = foo()
|
||||
|
||||
// val prop3: true
|
||||
val prop3 = "$x"
|
||||
@@ -0,0 +1,29 @@
|
||||
package test
|
||||
|
||||
val x = 1
|
||||
val y = true
|
||||
|
||||
// val prop1: false
|
||||
val prop1 = 1 > 2
|
||||
|
||||
// val prop2: false
|
||||
val prop2 = 2 + 3
|
||||
|
||||
// val prop3: true
|
||||
val prop3 = 2 + x
|
||||
|
||||
// val prop4: true
|
||||
val prop4 = x < 2
|
||||
|
||||
// val prop5: true
|
||||
val prop5 = y && true
|
||||
|
||||
// val prop6: false
|
||||
val prop6 = true && false || 2 > 1
|
||||
|
||||
// val prop7: true
|
||||
val prop7 = x == 1
|
||||
|
||||
// val prop8: true
|
||||
val prop8 = 1 / x
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package test
|
||||
|
||||
// val prop1: false
|
||||
val prop1 = 1
|
||||
|
||||
// val prop2: false
|
||||
val prop2 = "hello"
|
||||
|
||||
// val prop3: false
|
||||
val prop3 = true
|
||||
|
||||
// val prop4: false
|
||||
val prop4 = false
|
||||
|
||||
// val prop5: false
|
||||
val prop5 = -7453
|
||||
|
||||
// val prop6: false
|
||||
val prop6 = 3.56
|
||||
|
||||
// val prop7: false
|
||||
val prop7 = 5464564L
|
||||
|
||||
Reference in New Issue
Block a user