Implement constant folding in the IR backend for JVM

The newly added pass folds the set of constant functions of the
current backend, plus IrBuiltIns.
This commit is contained in:
Ting-Yuan Huang
2019-02-07 16:12:28 -08:00
committed by max-kammerer
parent 7e4d33be24
commit 79fcaae991
28 changed files with 576 additions and 7 deletions

View File

@@ -6,9 +6,9 @@ class A() {
}
fun box() : String {
fun box(a: String, b: String) : String {
val s = "1" + "2" + 3 + 4L + 5.0 + 6F + '7' + A()
val s = a + "1" + "2" + 3 + 4L + b + 5.0 + 6F + '7' + A()
return "OK"
}

View File

@@ -1,3 +1,4 @@
// IGNORE_BACKEND: JVM_IR
fun main() {
false.toString()
1.toByte().toString()

View File

@@ -0,0 +1,14 @@
fun main(a: Boolean, b:Byte, c: Short, d: Int, e: Long, f: Float, g: Double, h: Char) {
a.toString()
b.toString()
c.toString()
d.toString()
e.toString()
f.toString()
g.toString()
h.toString()
}
/*Check that all "valueOf" are String ones and there is no boxing*/
// 8 valueOf
// 8 INVOKESTATIC java/lang/String.valueOf