(Un)mute and add tests for vararg codegen

This commit is contained in:
Steven Schäfer
2019-07-30 15:45:59 +02:00
committed by max-kammerer
parent d22814f6da
commit ac667403ef
10 changed files with 68 additions and 9 deletions
@@ -1,5 +1,3 @@
// IGNORE_BACKEND: JVM_IR
// There is one ANEWARRAY instruction here, to generate the default parameter value.
fun default(vararg s: String = arrayOf("OK")) = s[0]
@@ -9,7 +9,7 @@ inline class UInt(val u: Int)
fun <T> takeVarargs(vararg e: T) {}
fun test(u1: UInt, u2: UInt, us: Array<UInt>) {
takeVarargs(*us) // copy + checkcast
takeVarargs(*us) // copy + checkcast (on non-ir backend)
takeVarargs(u1, u2, *us) // 2 box + ...
}
@@ -17,9 +17,13 @@ fun test(u1: UInt, u2: UInt, us: Array<UInt>) {
// 2 INVOKESTATIC UInt\.box
// 0 INVOKEVIRTUAL UInt.unbox
// 2 CHECKCAST \[LUInt
// 0 CHECKCAST \[Ljava/lang/Integer
// 0 intValue
// 0 valueOf
// 0 valueOf
// JVM_TEMPLATES
// 2 CHECKCAST \[LUInt
// JVM_IR_TEMPLATES
// 1 CHECKCAST \[LUInt
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
fun booleanVararg(vararg xs: Boolean) {}
fun byteVararg(vararg xs: Byte) {}
fun shortVararg(vararg xs: Short) {}
@@ -74,5 +73,6 @@ fun test() {
genericVararg(xs = *arrayOfNulls<Int>(1))
}
// 0 arraycopy
// 0 copyOf
// 0 clone