Update bytecode text tests in JVM_IR
This commit is contained in:
@@ -1,12 +0,0 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
class A {
|
|
||||||
fun test(x: String?, a: String?, b: String?){}
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
test(x = "x", b = "K", a = "O")
|
|
||||||
return "OK"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Test argument reordering when call site argument order differs from declaration one
|
|
||||||
// 4 LOAD
|
|
||||||
// 2 STORE
|
|
||||||
-15
@@ -1,15 +0,0 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
class A {
|
|
||||||
fun test(x: String? = "x", a: String?, b: String?, y: String? = "y") {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun box(): String {
|
|
||||||
test(b = "K", a = "O")
|
|
||||||
return "OK"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Test argument reordering when call site argument order differs from declaration one
|
|
||||||
// 12 LOAD
|
|
||||||
// 5 STORE
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
// TODO KT-36645 Don't box primitive values in string template and string concatenation in JVM_IR
|
||||||
|
|
||||||
// FILE: list.kt
|
// FILE: list.kt
|
||||||
|
|
||||||
|
|||||||
+2
@@ -1,4 +1,6 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
// TODO KT-36646 Don't box primitive values in equality comparison with nullable primitive values in JVM_IR
|
||||||
|
|
||||||
fun Long.id() = this
|
fun Long.id() = this
|
||||||
|
|
||||||
fun String.drop2() = if (length >= 2) subSequence(2, length) else null
|
fun String.drop2() = if (length >= 2) subSequence(2, length) else null
|
||||||
|
|||||||
+2
@@ -1,4 +1,6 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
// TODO KT-36651 Avoid boxing in safe call / elvis chains in JVM_IR
|
||||||
|
|
||||||
class A(val x : Int, val y : A?)
|
class A(val x : Int, val y : A?)
|
||||||
|
|
||||||
fun check(a : A?) : Int {
|
fun check(a : A?) : Int {
|
||||||
|
|||||||
Vendored
+2
@@ -1,4 +1,6 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
// TODO KT-36648 Captured variables not optimized in JVM_IR
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
var x = 0
|
var x = 0
|
||||||
run {
|
run {
|
||||||
|
|||||||
+2
@@ -1,4 +1,6 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
// TODO KT-36648 Captured variables not optimized in JVM_IR
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
var x = 0
|
var x = 0
|
||||||
run { ++x }
|
run { ++x }
|
||||||
|
|||||||
+1
@@ -1,5 +1,6 @@
|
|||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// IGNORE_BACKEND: JVM_IR
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
// TODO KT-36648 Captured variables not optimized in JVM_IR
|
||||||
|
|
||||||
// In JVM IR, SharedVariablesLowering transforms `x` into a shared variable to be able to update it from a lambda,
|
// In JVM IR, SharedVariablesLowering transforms `x` into a shared variable to be able to update it from a lambda,
|
||||||
// which is a separate function (...$lambda-0).
|
// which is a separate function (...$lambda-0).
|
||||||
|
|||||||
+2
@@ -1,4 +1,6 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
// TODO KT-36648 Captured variables not optimized in JVM_IR
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
var xl = 0L // Long, size 2
|
var xl = 0L // Long, size 2
|
||||||
var xi = 0 // Int, size 1
|
var xi = 0 // Int, size 1
|
||||||
|
|||||||
Vendored
+2
@@ -1,4 +1,6 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
// TODO KT-36648 Captured variables not optimized in JVM_IR
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
run {
|
run {
|
||||||
run {
|
run {
|
||||||
|
|||||||
+2
@@ -1,4 +1,6 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
// TODO KT-36648 Captured variables not optimized in JVM_IR
|
||||||
|
|
||||||
fun add(x: Int, y: Int) = x + y
|
fun add(x: Int, y: Int) = x + y
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
// TODO KT-36650 Don't generate CHECKCAST on null values in JVM_IR
|
||||||
// KT-15411 Unnecessary CHECKCAST bytecode when dealing with null
|
// KT-15411 Unnecessary CHECKCAST bytecode when dealing with null
|
||||||
|
|
||||||
fun test1(): String? {
|
fun test1(): String? {
|
||||||
|
|||||||
+6
-1
@@ -1,4 +1,5 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
// TODO KT-36654 Generate more compact bytecode for safe call in JVM_IR
|
||||||
|
|
||||||
interface A {
|
interface A {
|
||||||
fun foo()
|
fun foo()
|
||||||
}
|
}
|
||||||
@@ -7,5 +8,9 @@ fun test(x: A?) {
|
|||||||
x?.foo()
|
x?.foo()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// JVM_TEMPLATES
|
||||||
// 1 POP
|
// 1 POP
|
||||||
// 0 ACONST_NULL
|
// 0 ACONST_NULL
|
||||||
|
|
||||||
|
// JVM_IR_TEMPLATES
|
||||||
|
// 0 ACONST_NULL
|
||||||
|
|||||||
Vendored
+7
-1
@@ -1,4 +1,5 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
// TODO KT-36654 Generate more compact bytecode for safe call in JVM_IR
|
||||||
|
|
||||||
interface A {
|
interface A {
|
||||||
fun foo(): Any
|
fun foo(): Any
|
||||||
}
|
}
|
||||||
@@ -7,5 +8,10 @@ fun test(x: A?) {
|
|||||||
x?.foo()
|
x?.foo()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// JVM_TEMPLATES
|
||||||
// 2 POP
|
// 2 POP
|
||||||
// 0 ACONST_NULL
|
// 0 ACONST_NULL
|
||||||
|
|
||||||
|
// JVM_IR_TEMPLATES
|
||||||
|
// 1 POP
|
||||||
|
// 0 ACONST_NULL
|
||||||
+10
-1
@@ -1,4 +1,6 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
// TODO KT-36650 Don't generate CHECKCAST on null values in JVM_IR
|
||||||
|
// TODO KT-36654 Generate more compact bytecode for safe call in JVM_IR
|
||||||
|
|
||||||
fun test(ss: List<String?>) {
|
fun test(ss: List<String?>) {
|
||||||
val shortStrings = hashSetOf<String>()
|
val shortStrings = hashSetOf<String>()
|
||||||
val longStrings = hashSetOf<String>()
|
val longStrings = hashSetOf<String>()
|
||||||
@@ -14,7 +16,14 @@ fun test(ss: List<String?>) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// JVM_TEMPLATES
|
||||||
// 2 POP
|
// 2 POP
|
||||||
// 0 INVOKESTATIC java/lang/Boolean\.valueOf
|
// 0 INVOKESTATIC java/lang/Boolean\.valueOf
|
||||||
// 0 CHECKCAST java/lang/Boolean
|
// 0 CHECKCAST java/lang/Boolean
|
||||||
// 0 ACONST_NULL
|
// 0 ACONST_NULL
|
||||||
|
|
||||||
|
// JVM_IR_TEMPLATES
|
||||||
|
// 2 POP
|
||||||
|
// 0 INVOKESTATIC java/lang/Boolean\.valueOf
|
||||||
|
// 1 CHECKCAST java/lang/Boolean
|
||||||
|
// 1 ACONST_NULL
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
// TODO KT-36637 Trivial closure optimizatin in JVM_IR
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
|
|
||||||
fun local(){
|
fun local(){
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
val a : Int? = 10
|
val a : Int? = 10
|
||||||
|
|
||||||
fun foo() = a?.toString()
|
fun foo() = a?.toString()
|
||||||
|
|
||||||
|
// JVM_TEMPLATES
|
||||||
// 1 IFNULL
|
// 1 IFNULL
|
||||||
|
|
||||||
|
// JVM_IR_TEMPLATES
|
||||||
|
// 1 IFNONNULL
|
||||||
|
|||||||
+14
-3
@@ -1,7 +1,6 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
var encl1 = "fail";
|
var encl1 = "fail"
|
||||||
var encl2 = "fail";
|
var encl2 = "fail"
|
||||||
test {
|
test {
|
||||||
{
|
{
|
||||||
encl1 = "OK"
|
encl1 = "OK"
|
||||||
@@ -18,6 +17,18 @@ inline fun test(s: () -> Unit) {
|
|||||||
s()
|
s()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// JVM_TEMPLATES
|
||||||
// 2 INNERCLASS Kt10259Kt\$box\$\$inlined\$test\$lambda\$1\s
|
// 2 INNERCLASS Kt10259Kt\$box\$\$inlined\$test\$lambda\$1\s
|
||||||
// 2 INNERCLASS Kt10259Kt\$box\$\$inlined\$test\$lambda\$1\$1
|
// 2 INNERCLASS Kt10259Kt\$box\$\$inlined\$test\$lambda\$1\$1
|
||||||
// 4 INNERCLASS
|
// 4 INNERCLASS
|
||||||
|
|
||||||
|
// NB: JVM_IR generates 'INNERCLASS Kt10259Kt$box$1$1' in 'Kt10259Kt'.
|
||||||
|
// Although Oracle JVM doesn't check for consistency of InnerClasses attributes,
|
||||||
|
// this behavior is equivalent to javac and seems to be correct.
|
||||||
|
|
||||||
|
// JVM_IR_TEMPLATES
|
||||||
|
// 3 INNERCLASS Kt10259Kt\$box\$1\$1\s
|
||||||
|
// 2 INNERCLASS Kt10259Kt\$box\$1\$1\$1
|
||||||
|
// 5 INNERCLASS
|
||||||
|
// 1 class Kt10259Kt\$box\$1\$1\ extends
|
||||||
|
// 1 class Kt10259Kt\$box\$1\$1\$1 extends
|
||||||
+17
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
var encl1 = "fail";
|
var encl1 = "fail";
|
||||||
test {
|
test {
|
||||||
@@ -20,6 +19,7 @@ inline fun test(crossinline s: () -> Unit) {
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// JVM_TEMPLATES
|
||||||
// 3 INNERCLASS Kt10259_3Kt\$test\$1 null
|
// 3 INNERCLASS Kt10259_3Kt\$test\$1 null
|
||||||
// 2 INNERCLASS Kt10259_3Kt\$test\$1\$1
|
// 2 INNERCLASS Kt10259_3Kt\$test\$1\$1
|
||||||
// 2 INNERCLASS Kt10259_3Kt\$box\$\$inlined\$test\$1\s
|
// 2 INNERCLASS Kt10259_3Kt\$box\$\$inlined\$test\$1\s
|
||||||
@@ -28,3 +28,19 @@ inline fun test(crossinline s: () -> Unit) {
|
|||||||
// 2 INNERCLASS Kt10259_3Kt\$box\$\$inlined\$test\$1\$1\$lambda\$1\s
|
// 2 INNERCLASS Kt10259_3Kt\$box\$\$inlined\$test\$1\$1\$lambda\$1\s
|
||||||
// 2 INNERCLASS Kt10259_3Kt\$box\$\$inlined\$test\$1\$1\$lambda\$1\$1\s
|
// 2 INNERCLASS Kt10259_3Kt\$box\$\$inlined\$test\$1\$1\$lambda\$1\$1\s
|
||||||
// 13 INNERCLASS
|
// 13 INNERCLASS
|
||||||
|
|
||||||
|
// NB JVM_IR generates
|
||||||
|
// final static INNERCLASS Kt10259_3Kt$box$1$1 null null
|
||||||
|
// public final static INNERCLASS Kt10259_3Kt$test$1 null null
|
||||||
|
// in Kt10259_3Kt.
|
||||||
|
// Although Oracle JVM doesn't check for consistency of InnerClasses attributes,
|
||||||
|
// this behavior is equivalent to javac and seems to be correct.
|
||||||
|
|
||||||
|
// JVM_IR_TEMPLATES
|
||||||
|
// 3 INNERCLASS Kt10259_3Kt\$box\$1\$1\s
|
||||||
|
// 2 INNERCLASS Kt10259_3Kt\$box\$1\$1\$1\s
|
||||||
|
// 3 INNERCLASS Kt10259_3Kt\$test\$1\s
|
||||||
|
// 2 INNERCLASS Kt10259_3Kt\$test\$1\$1\s
|
||||||
|
// 2 INNERCLASS Kt10259_3Kt\$box\$\$inlined\$test\$1\s
|
||||||
|
// 2 INNERCLASS Kt10259_3Kt\$box\$\$inlined\$test\$1\$1\s
|
||||||
|
// 14 INNERCLASS
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
// TODO KT-36638 Use 'java/lang/StringBuilder.append (C)Ljava/lang/StringBuilder;' when appending single character in JVM_IR
|
||||||
|
|
||||||
// KT-5016 wrong StringBuilder append method invoked
|
// KT-5016 wrong StringBuilder append method invoked
|
||||||
class kt5016 {
|
class kt5016 {
|
||||||
fun f1(name : String) : String {
|
fun f1(name : String) : String {
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
// TODO KT-36638 Use 'java/lang/StringBuilder.append (C)Ljava/lang/StringBuilder;' when appending single character in JVM_IR
|
||||||
|
|
||||||
// KT-5016 wrong StringBuilder append method invoked
|
// KT-5016 wrong StringBuilder append method invoked
|
||||||
class kt5016int {
|
class kt5016int {
|
||||||
fun f1(num : Int) : String {
|
fun f1(num : Int) : String {
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
// TODO KT-36638 Use 'java/lang/StringBuilder.append (C)Ljava/lang/StringBuilder;' when appending single character in JVM_IR
|
||||||
|
|
||||||
// KT-5016 wrong StringBuilder append method invoked
|
// KT-5016 wrong StringBuilder append method invoked
|
||||||
class kt5016intOrNull {
|
class kt5016intOrNull {
|
||||||
fun f1(num : Int?) : String {
|
fun f1(num : Int?) : String {
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
// IGNORE_BACKEND: JVM_IR
|
// IGNORE_BACKEND: JVM_IR
|
||||||
|
// KT-36641 TODO Generate IINC instruction for prefix increment in JVM_IR
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
var i = 10
|
var i = 10
|
||||||
++i
|
++i
|
||||||
|
|||||||
@@ -391,16 +391,6 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/argumentOrder"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/argumentOrder"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("argumentReorder.kt")
|
|
||||||
public void testArgumentReorder() throws Exception {
|
|
||||||
runTest("compiler/testData/codegen/bytecodeText/argumentOrder/argumentReorder.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("argumentReorderWithDefault.kt")
|
|
||||||
public void testArgumentReorderWithDefault() throws Exception {
|
|
||||||
runTest("compiler/testData/codegen/bytecodeText/argumentOrder/argumentReorderWithDefault.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("sameOrder.kt")
|
@TestMetadata("sameOrder.kt")
|
||||||
public void testSameOrder() throws Exception {
|
public void testSameOrder() throws Exception {
|
||||||
runTest("compiler/testData/codegen/bytecodeText/argumentOrder/sameOrder.kt");
|
runTest("compiler/testData/codegen/bytecodeText/argumentOrder/sameOrder.kt");
|
||||||
|
|||||||
-1
@@ -6670,7 +6670,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt", "kotlin.coroutines");
|
runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/inlineSuspendFinally.kt", "kotlin.coroutines");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@TestMetadata("interfaceMethodWithBody.kt")
|
@TestMetadata("interfaceMethodWithBody.kt")
|
||||||
public void testInterfaceMethodWithBody() throws Exception {
|
public void testInterfaceMethodWithBody() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/coroutines/featureIntersection/interfaceMethodWithBody.kt");
|
runTest("compiler/testData/codegen/box/coroutines/featureIntersection/interfaceMethodWithBody.kt");
|
||||||
|
|||||||
-10
@@ -391,16 +391,6 @@ public class IrBytecodeTextTestGenerated extends AbstractIrBytecodeTextTest {
|
|||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/argumentOrder"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/argumentOrder"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("argumentReorder.kt")
|
|
||||||
public void testArgumentReorder() throws Exception {
|
|
||||||
runTest("compiler/testData/codegen/bytecodeText/argumentOrder/argumentReorder.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("argumentReorderWithDefault.kt")
|
|
||||||
public void testArgumentReorderWithDefault() throws Exception {
|
|
||||||
runTest("compiler/testData/codegen/bytecodeText/argumentOrder/argumentReorderWithDefault.kt");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("sameOrder.kt")
|
@TestMetadata("sameOrder.kt")
|
||||||
public void testSameOrder() throws Exception {
|
public void testSameOrder() throws Exception {
|
||||||
runTest("compiler/testData/codegen/bytecodeText/argumentOrder/sameOrder.kt");
|
runTest("compiler/testData/codegen/bytecodeText/argumentOrder/sameOrder.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user