'box'/'unbox' methods are called by inline class

This commit is contained in:
Dmitry Petrov
2018-08-30 14:06:15 +03:00
parent 580b782585
commit b1016936b2
20 changed files with 58 additions and 24 deletions
@@ -15,7 +15,7 @@ fun test(u1: UInt, u2: UInt, u3: UInt?) {
}
// @TestKt.class:
// 3 INVOKESTATIC UInt\$Erased.box
// 3 INVOKESTATIC UInt\.box
// 0 INVOKEVIRTUAL UInt.unbox
// 0 valueOf
// 0 intValue
@@ -0,0 +1,12 @@
// !LANGUAGE: +InlineClasses
// FILE: Z.kt
inline class Z(val x: Int)
// FILE: Test.kt
fun test(): Any = Z(42)
// @TestKt.class:
// 0 INVOKESTATIC Z\$Erased\.box
// 0 INVOKESTATIC Z\-Erased\.box
// 1 INVOKESTATIC Z\.box \(I\)LZ;
@@ -15,10 +15,10 @@ fun test() {
}
// @TestKt.class:
// 1 INVOKESTATIC AsInt\$Erased.box
// 1 INVOKESTATIC AsInt\.box
// 0 INVOKEVIRTUAL AsInt.unbox
// 1 INVOKESTATIC AsAny\$Erased.box
// 1 INVOKESTATIC AsAny\.box
// 0 INVOKEVIRTUAL AsAny.unbox
// 1 valueOf
@@ -13,7 +13,7 @@ inline class UInt(val a: Int) {
fun takeNullable(a: UInt?) {}
// 2 INVOKESTATIC UInt\$Erased.box
// 2 INVOKESTATIC UInt\.box
// 0 INVOKEVIRTUAL Foo.unbox
// 1 valueOf
@@ -25,7 +25,7 @@ fun test(f: Foo) {
}
// @TestKt.class:
// 6 INVOKESTATIC Foo\$Erased.box
// 6 INVOKESTATIC Foo\.box
// 4 INVOKEVIRTUAL Foo.unbox
// 0 valueOf
// 0 intValue
@@ -18,6 +18,7 @@ fun test(x: UInt?, y: UInt) {
// @TestKt.class:
// 0 INVOKESTATIC UInt\$Erased.box
// 0 INVOKESTATIC UInt\.box
// 1 INVOKEVIRTUAL UInt.unbox
// 0 valueOf
@@ -17,10 +17,10 @@ fun test() {
}
// @TestKt.class:
// 1 INVOKESTATIC UInt\$Erased.box
// 1 INVOKESTATIC UInt\.box
// 2 INVOKEVIRTUAL UInt.unbox
// 1 INVOKESTATIC ULong\$Erased.box
// 1 INVOKESTATIC ULong\.box
// 2 INVOKEVIRTUAL ULong.unbox
// 0 valueOf
@@ -23,7 +23,7 @@ fun test(f: Foo) {
}
// @TestKt.class:
// 2 INVOKESTATIC Foo\$Erased.box
// 2 INVOKESTATIC Foo\.box
// 1 INVOKEVIRTUAL Foo.unbox
// 0 valueOf
// 0 intValue
@@ -27,7 +27,7 @@ fun labeled(): ULong? {
}
// @TestKt.class:
// 2 INVOKESTATIC ULong\$Erased.box
// 2 INVOKESTATIC ULong\.box
// 0 INVOKEVIRTUAL ULong.unbox
// 0 valueOf
@@ -11,7 +11,7 @@ fun test(a: InlineNotNullPrimitive, b: InlineNotNullReference) {
testNotNullReference(b, b, b, b) // 2 box
}
// 3 INVOKESTATIC InlineNotNullPrimitive\$Erased.box
// 2 INVOKESTATIC InlineNotNullReference\$Erased.box
// 3 INVOKESTATIC InlineNotNullPrimitive\.box
// 2 INVOKESTATIC InlineNotNullReference\.box
// 0 valueOf
@@ -29,7 +29,7 @@ fun takeNullableUInt(y: UInt?) {}
inline fun <T> T.myLet(f: (T) -> Unit) = f(this)
// @TestKt.class:
// 1 INVOKESTATIC UInt\$Erased.box
// 1 INVOKESTATIC UInt\.box
// 5 INVOKEVIRTUAL UInt.unbox
// 0 intValue
@@ -22,9 +22,9 @@ fun transformToNullableTarget(a: AsInt): AsInt? = a as AsInt? // box
fun transformNullableToNullableTarget(a: AsInt?): AsInt? = a as AsInt?
// @ReferenceKt.class:
// 2 INVOKESTATIC AsAny\$Erased.box
// 2 INVOKESTATIC AsAny\.box
// 1 INVOKEVIRTUAL AsAny.unbox
// @PrimitiveKt.class:
// 2 INVOKESTATIC AsInt\$Erased.box
// 2 INVOKESTATIC AsInt\.box
// 1 INVOKEVIRTUAL AsInt.unbox
@@ -10,6 +10,7 @@ fun test1(us: UIntArray) {
// @NoBoxingKt.class:
// 0 INVOKESTATIC kotlin.UInt\$Erased.box
// 0 INVOKESTATIC kotlin.UInt\.box
// 0 INVOKEVIRTUAL kotlin.UInt.unbox
// FILE: Boxing.kt
@@ -21,5 +22,5 @@ fun test2(nullable: UInt?, ns: Array<UInt>) {
}
// @BoxingKt.class:
// 2 INVOKESTATIC kotlin.UInt\$Erased.box
// 2 INVOKESTATIC kotlin.UInt\.box
// 0 INVOKEVIRTUAL kotlin.UInt.unbox
@@ -14,7 +14,7 @@ fun test(u1: UInt, u2: UInt, us: Array<UInt>) {
}
// @TestKt.class:
// 2 INVOKESTATIC UInt\$Erased.box
// 2 INVOKESTATIC UInt\.box
// 0 INVOKEVIRTUAL UInt.unbox
// 2 CHECKCAST \[LUInt
@@ -27,7 +27,7 @@ fun test() {
fun takeUInt(u: UInt) {}
// 1 INVOKESTATIC UInt\$Erased.box
// 1 INVOKESTATIC UInt\.box
// 1 INVOKEVIRTUAL UInt.unbox
// 0 INVOKEVIRTUAL UIntIterator.iterator
@@ -23,5 +23,6 @@ fun UIntArray.swap(i: Int, j: Int) {
// @TestKt.class:
// 0 INVOKEVIRTUAL UInt.unbox
// 0 INVOKESTATIC UInt\$Erased.box
// 0 INVOKESTATIC UInt\.box
// 0 intValue
// 0 valueOf
@@ -0,0 +1,12 @@
// !LANGUAGE: +InlineClasses
// FILE: Z.kt
inline class Z(val x: Int)
// FILE: Test.kt
fun test(xs: List<Z>) = xs[0]
// @TestKt.class:
// 0 INVOKEVIRTUAL Z\$Erased\.unbox
// 0 INVOKEVIRTUAL Z\-Erased\.unbox
// 1 INVOKEVIRTUAL Z\.unbox \(\)I