Don't write nop for extension lambda during inline
This commit is contained in:
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.codegen.inline
|
||||
|
||||
import org.jetbrains.kotlin.codegen.*
|
||||
import org.jetbrains.kotlin.codegen.coroutines.continuationAsmType
|
||||
import org.jetbrains.kotlin.codegen.coroutines.getOrCreateJvmSuspendFunctionView
|
||||
import org.jetbrains.kotlin.codegen.inline.FieldRemapper.Companion.foldName
|
||||
import org.jetbrains.kotlin.codegen.inline.coroutines.*
|
||||
import org.jetbrains.kotlin.codegen.intrinsics.IntrinsicMethods
|
||||
@@ -260,11 +259,12 @@ class MethodInliner(
|
||||
val invokeParameters = erasedInvokeFunction.valueParameters
|
||||
|
||||
val valueParamShift = max(nextLocalIndex, markerShift)//NB: don't inline cause it changes
|
||||
val parameterTypesFromDesc = info.invokeMethod.argumentTypes
|
||||
putStackValuesIntoLocalsForLambdaOnInvoke(
|
||||
listOf(*info.invokeMethod.argumentTypes), valueParameters, invokeParameters, valueParamShift, this, coroutineDesc
|
||||
listOf(*parameterTypesFromDesc), valueParameters, invokeParameters, valueParamShift, this, coroutineDesc
|
||||
)
|
||||
|
||||
if (info.invokeMethodDescriptor.valueParameters.isEmpty()) {
|
||||
if (parameterTypesFromDesc.isEmpty()) {
|
||||
// There won't be no parameters processing and line call can be left without actual instructions.
|
||||
// Note: if function is called on the line with other instructions like 1 + foo(), 'nop' will still be generated.
|
||||
visitInsn(Opcodes.NOP)
|
||||
|
||||
+15
@@ -487,6 +487,21 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
|
||||
runTest("idea/jvm-debugger/jvm-debugger-test/testData/stepping/stepOver/kt24343.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterExtensionLambdaArgumentCallInInline.kt")
|
||||
public void testNoParameterExtensionLambdaArgumentCallInInline() throws Exception {
|
||||
runTest("idea/jvm-debugger/jvm-debugger-test/testData/stepping/stepOver/noParameterExtensionLambdaArgumentCallInInline.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterExtensionLambdaArgumentCallInInline2.kt")
|
||||
public void testNoParameterExtensionLambdaArgumentCallInInline2() throws Exception {
|
||||
runTest("idea/jvm-debugger/jvm-debugger-test/testData/stepping/stepOver/noParameterExtensionLambdaArgumentCallInInline2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterExtensionLambdaArgumentCallInInline3.kt")
|
||||
public void testNoParameterExtensionLambdaArgumentCallInInline3() throws Exception {
|
||||
runTest("idea/jvm-debugger/jvm-debugger-test/testData/stepping/stepOver/noParameterExtensionLambdaArgumentCallInInline3.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("noParameterLambdaArgumentCallInInline.kt")
|
||||
public void testNoParameterLambdaArgumentCallInInline() throws Exception {
|
||||
runTest("idea/jvm-debugger/jvm-debugger-test/testData/stepping/stepOver/noParameterLambdaArgumentCallInInline.kt");
|
||||
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package noParameterLambdaArgumentCallInInline
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
lookAtMe {
|
||||
val c = "c"
|
||||
}
|
||||
}
|
||||
|
||||
inline fun lookAtMe(f: String.() -> Unit) {
|
||||
val a = "a"
|
||||
//Breakpoint!
|
||||
"123".f()
|
||||
val b = "b"
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
LineBreakpoint created at noParameterExtensionLambdaArgumentCallInInline.kt:12
|
||||
Run Java
|
||||
Connected to the target VM
|
||||
noParameterExtensionLambdaArgumentCallInInline.kt:12
|
||||
noParameterExtensionLambdaArgumentCallInInline.kt:13
|
||||
Disconnected from the target VM
|
||||
|
||||
Process finished with exit code 0
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package noParameterLambdaArgumentCallInInline
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
"123".lookAtMe {
|
||||
val c = "c"
|
||||
}
|
||||
}
|
||||
|
||||
inline fun String.lookAtMe(f: String.() -> Unit) {
|
||||
val a = "a"
|
||||
//Breakpoint!
|
||||
f()
|
||||
val b = "b"
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
LineBreakpoint created at noParameterExtensionLambdaArgumentCallInInline2.kt:12
|
||||
Run Java
|
||||
Connected to the target VM
|
||||
noParameterExtensionLambdaArgumentCallInInline2.kt:12
|
||||
noParameterExtensionLambdaArgumentCallInInline2.kt:13
|
||||
Disconnected from the target VM
|
||||
|
||||
Process finished with exit code 0
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package noParameterLambdaArgumentCallInInline
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
lookAtMe {
|
||||
val c = "c"
|
||||
}
|
||||
}
|
||||
|
||||
inline fun lookAtMe(f: String.() -> Unit) {
|
||||
val a = "a"
|
||||
//Breakpoint!
|
||||
"123".
|
||||
f()
|
||||
val b = "b"
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
LineBreakpoint created at noParameterExtensionLambdaArgumentCallInInline3.kt:12
|
||||
Run Java
|
||||
Connected to the target VM
|
||||
noParameterExtensionLambdaArgumentCallInInline3.kt:12
|
||||
noParameterExtensionLambdaArgumentCallInInline3.kt:5
|
||||
Disconnected from the target VM
|
||||
|
||||
Process finished with exit code 0
|
||||
Reference in New Issue
Block a user