Update bytecode text tests for JVM_IR

This commit is contained in:
Dmitry Petrov
2020-02-18 18:00:58 +03:00
parent aac72871e7
commit 0b9b1b6945
35 changed files with 89 additions and 112 deletions
@@ -1,5 +1,4 @@
// !LANGUAGE: +ProperIeee754Comparisons
// IGNORE_BACKEND: JVM_IR
fun equals3(a: Byte?, b: Byte?) = a != null && b != null && a == b
fun equals4(a: Byte?, b: Byte?) = if (a is Byte && b is Byte) a == b else null!!
@@ -12,7 +11,17 @@ fun less4(a: Byte?, b: Byte?) = if (a is Byte && b is Byte) a < b else true
fun less5(a: Any?, b: Any?) = if (a is Byte && b is Byte) a < b else true
// JVM_TEMPLATES
// 3 Intrinsics\.areEqual
// 0 Intrinsics\.compare
// 0 IFGE
// 3 IF_ICMPGE
// JVM_IR_TEMPLATES
// 0 Intrinsics\.areEqual
// 0 Intrinsics\.compare
// 8 INVOKEVIRTUAL java/lang/Byte\.byteValue \(\)B
// 4 INVOKEVIRTUAL java/lang/Number\.byteValue \(\)B
// 0 IFGE
// 3 IF_ICMPNE
// 3 IF_ICMPGE
@@ -1,5 +1,4 @@
// !LANGUAGE: -ProperIeee754Comparisons
// IGNORE_BACKEND: JVM_IR
fun equals3(a: Byte?, b: Byte?) = a != null && b != null && a == b
fun equals4(a: Byte?, b: Byte?) = if (a is Byte && b is Byte) a == b else null!!
@@ -12,8 +11,18 @@ fun less4(a: Byte?, b: Byte?) = if (a is Byte && b is Byte) a < b else true
fun less5(a: Any?, b: Any?) = if (a is Byte && b is Byte) a < b else true
// JVM_TEMPLATES
// 3 Intrinsics\.areEqual
// 3 Intrinsics\.compare
// for compare:
// 3 IFGE
// 0 IF_ICMPGE
// JVM_IR_TEMPLATES
// 0 Intrinsics\.areEqual
// 0 Intrinsics\.compare
// 8 INVOKEVIRTUAL java/lang/Byte\.byteValue \(\)B
// 4 INVOKEVIRTUAL java/lang/Number\.byteValue \(\)B
// 0 IFGE
// 3 IF_ICMPGE
// 3 IF_ICMPNE
@@ -1,5 +1,4 @@
// !LANGUAGE: -ProperIeee754Comparisons
// IGNORE_BACKEND: JVM_IR
fun equals3(a: Int?, b: Int?) = a != null && b != null && a == b
fun equals4(a: Int?, b: Int?) = if (a is Int && b is Int) a == b else null!!
@@ -12,8 +11,18 @@ fun less4(a: Int?, b: Int?) = if (a is Int && b is Int) a < b else true
fun less5(a: Any?, b: Any?) = if (a is Int && b is Int) a < b else true
// JVM_TEMPLATES
// 3 Intrinsics\.areEqual
// 3 Intrinsics\.compare
// for compare:
// 3 IFGE
// 0 IF_ICMPGE
// JVM_IR_TEMPLATES
// 3 Intrinsics\.areEqual
// 0 Intrinsics\.compare
// 4 INVOKEVIRTUAL java/lang/Integer\.intValue \(\)
// 2 INVOKEVIRTUAL java/lang/Number\.intValue \(\)I
// 0 IFGE
// 3 IF_ICMPGE
// 0 IF_ICMPNE
@@ -1,5 +1,4 @@
// !LANGUAGE: +ProperIeee754Comparisons
// IGNORE_BACKEND: JVM_IR
fun equals3(a: Short?, b: Short?) = a != null && b != null && a == b
fun equals4(a: Short?, b: Short?) = if (a is Short && b is Short) a == b else null!!
@@ -12,7 +11,17 @@ fun less4(a: Short?, b: Short?) = if (a is Short && b is Short) a < b else true
fun less5(a: Any?, b: Any?) = if (a is Short && b is Short) a < b else true
// JVM_TEMPLATES
// 3 Intrinsics\.areEqual
// 0 Intrinsics\.compare
// 0 IFGE
// 3 IF_ICMPGE
// JVM_IR_TEMPLATES
// 0 Intrinsics\.areEqual
// 0 Intrinsics\.compare
// 8 INVOKEVIRTUAL java/lang/Short\.shortValue \(\)S
// 4 INVOKEVIRTUAL java/lang/Number\.shortValue \(\)S
// 0 IFGE
// 3 IF_ICMPGE
// 3 IF_ICMPNE
@@ -1,5 +1,4 @@
// !LANGUAGE: -ProperIeee754Comparisons
// IGNORE_BACKEND: JVM_IR
fun equals3(a: Short?, b: Short?) = a != null && b != null && a == b
fun equals4(a: Short?, b: Short?) = if (a is Short && b is Short) a == b else null!!
@@ -12,8 +11,17 @@ fun less4(a: Short?, b: Short?) = if (a is Short && b is Short) a < b else true
fun less5(a: Any?, b: Any?) = if (a is Short && b is Short) a < b else true
// JVM_TEMPLATES
// 3 Intrinsics\.areEqual
// 3 Intrinsics\.compare
// for compare:
// 3 IFGE
// 0 IF_ICMPGE
// JVM_IR_TEMPLATES
// 0 Intrinsics\.areEqual
// 0 Intrinsics\.compare
// 8 INVOKEVIRTUAL java/lang/Short\.shortValue \(\)S
// 4 INVOKEVIRTUAL java/lang/Number\.shortValue \(\)S
// 0 IFGE
// 3 IF_ICMPGE
// 3 IF_ICMPNE
@@ -1,17 +0,0 @@
// IGNORE_BACKEND: JVM_IR
open class A {
inline fun test(a: Int = 1, b: Long = 1L, c: String = "123") {
val d = 1
}
}
//
// 1 test\$default\(LA;IJLjava/lang/String;ILjava/lang/Object;\)V\s+L0
// 1 LOCALVARIABLE this LA; L0 L9 0
// 1 LOCALVARIABLE a I L0 L9 1
// 1 LOCALVARIABLE b J L0 L9 2
// 1 LOCALVARIABLE c Ljava/lang/String; L0 L9 4
// 1 LOCALVARIABLE \$i\$f\$test I L6 L9 5
// 1 LOCALVARIABLE d I L8 L9 6
@@ -1,11 +0,0 @@
// IGNORE_BACKEND: JVM_IR
public inline fun <T> Iterable(crossinline iterator: () -> Iterator<T>): Iterable<T> = object : Iterable<T> {
override fun iterator(): Iterator<T> = iterator()
}
public fun IntArray.asIterable(): Iterable<Int> {
return Iterable { this.iterator() }
}
/*Threre are two constuctors so we should be sure that we check required one by checking 'receiver$0$inlined' assign*/
// 1 <init>\(\[I\)V\s+L0\s+ALOAD 0\s+ALOAD 1\s+PUTFIELD InlinedConstuctorKt\$asIterable\$\$inlined\$Iterable\$1\.\$this_asIterable\$inlined : \[I
// 1 LOCALVARIABLE this LInlinedConstuctorKt\$asIterable\$\$inlined\$Iterable\$1; L0 L2 0
@@ -1,18 +0,0 @@
// IGNORE_BACKEND: JVM_IR
open class A(val z: String) {
}
inline fun test(crossinline s: () -> String) {
object : A("123") {
val x = s();
}
}
fun main(args: Array<String>) {
var z = "123";
test { z }
}
/*Threre are two constuctors so we should be sure that we check LOCALVARIABLEs from same method*/
// 1 LOCALVARIABLE this LInlinedConstuctorWithSuperCallParamsKt\$main\$\$inlined\$test\$1; L0 L8 0\s+LOCALVARIABLE \$super_call_param\$1 Ljava/lang/String; L0 L8 1
@@ -1,4 +1,6 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36648 Captured variables not optimized in JVM_IR
// TODO KT-36812 Generate proper lifetime intervals for local variables in JVM_IR
fun test(): java.lang.Integer {
val c: java.lang.Integer
@@ -1,5 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36812 Generate proper lifetime intervals for local variables in JVM_IR
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
@@ -1,5 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36812 Generate proper lifetime intervals for local variables in JVM_IR
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
@@ -22,4 +22,8 @@ fun doIt(block: () -> Unit) {
}
// 0 ISTORE 0
// 1 LOCALVARIABLE c Lkotlin/jvm/internal/Ref\$CharRef; L1 L3 0
// 1 LOCALVARIABLE c Lkotlin/jvm/internal/Ref\$CharRef; L1 L3 0
// JVM_IR_TEMPLATES
// 0 ISTORE 0
// 1 LOCALVARIABLE c Lkotlin/jvm/internal/Ref\$CharRef; L1 L4 0
@@ -1,4 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36812 Generate proper lifetime intervals for local variables in JVM_IR
import kotlin.random.Random
@@ -1,4 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36812 Generate proper lifetime intervals for local variables in JVM_IR
import kotlin.random.Random
@@ -1,4 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36812 Generate proper lifetime intervals for local variables in JVM_IR
import kotlin.random.Random
@@ -1,4 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36812 Generate proper lifetime intervals for local variables in JVM_IR
import kotlin.random.Random
@@ -1,4 +1,6 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36648 Captured variables not optimized in JVM_IR
// TODO KT-36812 Generate proper lifetime intervals for local variables in JVM_IR
fun test(): UInt {
val c: UInt
@@ -1,4 +1,6 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36648 Captured variables not optimized in JVM_IR
// TODO KT-36812 Generate proper lifetime intervals for local variables in JVM_IR
fun test(): UInt {
var c: UInt
@@ -1,4 +1,6 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36648 Captured variables not optimized in JVM_IR
// TODO KT-36812 Generate proper lifetime intervals for local variables in JVM_IR
fun test(): Char {
lateinit var c: Any
@@ -1,4 +1,6 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36648 Captured variables not optimized in JVM_IR
// TODO KT-36812 Generate proper lifetime intervals for local variables in JVM_IR
fun test(): Char {
val c: Char
@@ -1,4 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36812 Generate proper lifetime intervals for local variables in JVM_IR
fun test(): Char {
val c: Char
@@ -1,4 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36812 Generate proper lifetime intervals for local variables in JVM_IR
fun test(): Char {
var c: Char
@@ -1,4 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36812 Generate proper lifetime intervals for local variables in JVM_IR
fun test(i: Int): Char {
val c: Char
@@ -1,4 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36812 Generate proper lifetime intervals for local variables in JVM_IR
fun test(i: Int): Char {
var c: Char
@@ -1,4 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36813 Support code generated by JVM_IR in redundant null check optimization
// FILE: j/J.java
package j;
@@ -1,4 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36813 Support code generated by JVM_IR in redundant null check optimization
// FILE: j/J.java
package j;
@@ -1,4 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36813 Support code generated by JVM_IR in redundant null check optimization
fun almostAlwaysTrue() = true
fun test() {
@@ -1,4 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36813 Support code generated by JVM_IR in redundant null check optimization
fun test() {
lateinit var z: String
run {
@@ -1,5 +1,6 @@
// !API_VERSION: LATEST
// IGNORE_BACKEND: JVM_IR
// TODO KT-36813 Support code generated by JVM_IR in redundant null check optimization
// FILE: j/J.java
package j;
@@ -1,4 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36814 Support optimized delegated properties in JVM_IR
class Provider<T>(val _value: T) {
inline operator fun provideDelegate(thisRef: Any?, kProperty: Any?) =
@@ -1,4 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36814 Support optimized delegated properties in JVM_IR
// MODULE: lib
// FILE: lib.kt
@@ -1,4 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36814 Support optimized delegated properties in JVM_IR
// WITH_RUNTIME
val topLevelLazyVal by lazy { 1 }
@@ -1,4 +1,5 @@
// IGNORE_BACKEND: JVM_IR
// TODO KT-36814 Support optimized delegated properties in JVM_IR
class Provider<T>(val _value: T) {
inline operator fun provideDelegate(thisRef: Any?, kProperty: Any) =
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
class Foo {
private companion object {
lateinit var x: String
@@ -21,5 +20,10 @@ class Foo {
fun consume(s: String) {}
// JVM_TEMPLATES
// There's 1 assertion in Foo.Companion.getX, and 4 in Foo.test2 (see KT-28331)
// 5 throwUninitializedPropertyAccessException
// JVM_IR_TEMPLATES
// JVM_IR invokes getX() (as suggested in KT-28331)
// 1 throwUninitializedPropertyAccessException