mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
JVM_IR KT-47984 allow noinline functional inplace args
This commit is contained in:
committed by
TeamCityServer
parent
9be941def2
commit
7a99f9ff2e
@@ -18252,6 +18252,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/inlineArgsInPlace/mutableCollectionPlusAssign.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noinlineParameter.kt")
|
||||
public void testNoinlineParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineArgsInPlace/noinlineParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspensionPointInsideArgument.kt")
|
||||
public void testSuspensionPointInsideArgument() throws Exception {
|
||||
|
||||
@@ -58,7 +58,7 @@ class IrInlineCodegen(
|
||||
}
|
||||
if (actualParametersCount == 0)
|
||||
return false
|
||||
if (function.valueParameters.any { it.isFunctionOrSuspendFunction() })
|
||||
if (function.valueParameters.any { !it.isNoinline && it.isFunctionOrSuspendFunction() })
|
||||
return false
|
||||
|
||||
return canInlineArgumentsInPlace(sourceCompiler.compileInlineFunction(jvmSignature).node)
|
||||
|
||||
30
compiler/testData/codegen/box/inlineArgsInPlace/inlineCircularDedepency.kt
vendored
Normal file
30
compiler/testData/codegen/box/inlineArgsInPlace/inlineCircularDedepency.kt
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
// IGNORE_BACKEND: WASM
|
||||
// FULL_JDK
|
||||
// WITH_RUNTIME
|
||||
|
||||
val z = ArrayList<String>()
|
||||
|
||||
inline fun a(body: () -> Unit) {
|
||||
body()
|
||||
z += "a"
|
||||
}
|
||||
|
||||
inline fun b(body: () -> Unit) {
|
||||
z += "b"
|
||||
body()
|
||||
a { z += "from b" }
|
||||
}
|
||||
|
||||
fun test() {
|
||||
b { z += "test" }
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
test()
|
||||
|
||||
if (z != listOf("b", "test", "from b", "a"))
|
||||
return z.toString()
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
20
compiler/testData/codegen/box/inlineArgsInPlace/noinlineParameter.kt
vendored
Normal file
20
compiler/testData/codegen/box/inlineArgsInPlace/noinlineParameter.kt
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// IGNORE_BACKEND: WASM
|
||||
// WITH_RUNTIME
|
||||
|
||||
// CHECK_BYTECODE_TEXT
|
||||
// JVM_IR_TEMPLATES
|
||||
// 1 ASTORE 1
|
||||
// 12 ALOAD 1
|
||||
// JVM_TEMPLATES
|
||||
// 2 ASTORE 1
|
||||
// 13 ALOAD 1
|
||||
|
||||
@Suppress("DEPRECATION_ERROR")
|
||||
fun box(): String {
|
||||
val seq = buildSequence {
|
||||
yield("O")
|
||||
yield("K")
|
||||
}
|
||||
val it = seq.iterator()
|
||||
return it.next() + it.next()
|
||||
}
|
||||
@@ -18108,6 +18108,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/inlineArgsInPlace/mutableCollectionPlusAssign.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noinlineParameter.kt")
|
||||
public void testNoinlineParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineArgsInPlace/noinlineParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspensionPointInsideArgument.kt")
|
||||
public void testSuspensionPointInsideArgument() throws Exception {
|
||||
|
||||
@@ -18252,6 +18252,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/inlineArgsInPlace/mutableCollectionPlusAssign.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("noinlineParameter.kt")
|
||||
public void testNoinlineParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineArgsInPlace/noinlineParameter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspensionPointInsideArgument.kt")
|
||||
public void testSuspensionPointInsideArgument() throws Exception {
|
||||
|
||||
@@ -15009,6 +15009,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/inlineArgsInPlace/mutableCollectionPlusAssign.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noinlineParameter.kt")
|
||||
public void testNoinlineParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineArgsInPlace/noinlineParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspensionPointInsideArgument.kt")
|
||||
public void testSuspensionPointInsideArgument() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineArgsInPlace/suspensionPointInsideArgument.kt");
|
||||
|
||||
@@ -13098,6 +13098,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
runTest("compiler/testData/codegen/box/inlineArgsInPlace/mutableCollectionPlusAssign.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noinlineParameter.kt")
|
||||
public void testNoinlineParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineArgsInPlace/noinlineParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspensionPointInsideArgument.kt")
|
||||
public void testSuspensionPointInsideArgument() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineArgsInPlace/suspensionPointInsideArgument.kt");
|
||||
|
||||
@@ -12504,6 +12504,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inlineArgsInPlace/mutableCollectionPlusAssign.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noinlineParameter.kt")
|
||||
public void testNoinlineParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineArgsInPlace/noinlineParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspensionPointInsideArgument.kt")
|
||||
public void testSuspensionPointInsideArgument() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineArgsInPlace/suspensionPointInsideArgument.kt");
|
||||
|
||||
@@ -12569,6 +12569,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/inlineArgsInPlace/mutableCollectionPlusAssign.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noinlineParameter.kt")
|
||||
public void testNoinlineParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineArgsInPlace/noinlineParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspensionPointInsideArgument.kt")
|
||||
public void testSuspensionPointInsideArgument() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineArgsInPlace/suspensionPointInsideArgument.kt");
|
||||
|
||||
@@ -6659,6 +6659,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
runTest("compiler/testData/codegen/box/inlineArgsInPlace/mutableCollectionPlusAssign.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noinlineParameter.kt")
|
||||
public void testNoinlineParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineArgsInPlace/noinlineParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("suspensionPointInsideArgument.kt")
|
||||
public void testSuspensionPointInsideArgument() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineArgsInPlace/suspensionPointInsideArgument.kt");
|
||||
|
||||
Reference in New Issue
Block a user