Revert "Debugger: Fix breakpoints and stepping for inline-only function lambda arguments (#KT-23064)"
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
package org.jetbrains.kotlin.codegen.inline
|
||||
|
||||
import org.jetbrains.kotlin.backend.jvm.codegen.IrExpressionLambda
|
||||
import org.jetbrains.kotlin.builtins.isFunctionType
|
||||
import org.jetbrains.kotlin.codegen.AsmUtil
|
||||
import org.jetbrains.kotlin.codegen.ClosureCodegen
|
||||
import org.jetbrains.kotlin.codegen.StackValue
|
||||
@@ -370,14 +369,7 @@ class MethodInliner(
|
||||
)
|
||||
|
||||
val transformationVisitor = object : MethodVisitor(API, transformedNode) {
|
||||
/*
|
||||
Ignore simple @InlineOnly functions such as 'error()' or 'assert()' without lambda parameters,
|
||||
as we likely to want to have a line number from the call site in a stack trace.
|
||||
*/
|
||||
private val GENERATE_LINE_NUMBERS = GENERATE_SMAP && (inlineOnlySmapSkipper == null || run {
|
||||
val callableDescriptor = inliningContext.root.sourceCompilerForInline.callableDescriptor
|
||||
callableDescriptor != null && callableDescriptor.valueParameters.any { it.type.isFunctionType }
|
||||
})
|
||||
private val GENERATE_DEBUG_INFO = GENERATE_SMAP && inlineOnlySmapSkipper == null
|
||||
|
||||
private val isInliningLambda = nodeRemapper.isInsideInliningLambda
|
||||
|
||||
@@ -409,7 +401,7 @@ class MethodInliner(
|
||||
}
|
||||
|
||||
override fun visitLineNumber(line: Int, start: Label) {
|
||||
if (isInliningLambda || GENERATE_LINE_NUMBERS) {
|
||||
if (isInliningLambda || GENERATE_DEBUG_INFO) {
|
||||
super.visitLineNumber(line, start)
|
||||
}
|
||||
}
|
||||
@@ -437,7 +429,7 @@ class MethodInliner(
|
||||
override fun visitLocalVariable(
|
||||
name: String, desc: String, signature: String?, start: Label, end: Label, index: Int
|
||||
) {
|
||||
if (isInliningLambda || (GENERATE_SMAP && inlineOnlySmapSkipper == null)) {
|
||||
if (isInliningLambda || GENERATE_DEBUG_INFO) {
|
||||
val varSuffix = if (inliningContext.isRoot && !isFakeLocalVariableForInline(name)) INLINE_FUN_VAR_SUFFIX else ""
|
||||
val varName = if (!varSuffix.isEmpty() && name == "this") name + "_" else name
|
||||
super.visitLocalVariable(varName + varSuffix, desc, signature, start, end, getNewIndex(index))
|
||||
|
||||
@@ -37,8 +37,6 @@ interface SourceCompilerForInline {
|
||||
|
||||
val callElement: Any
|
||||
|
||||
val callableDescriptor: CallableDescriptor?
|
||||
|
||||
val lookupLocation: LookupLocation
|
||||
|
||||
val callElementText: String
|
||||
@@ -94,8 +92,6 @@ class PsiSourceCompilerForInline(private val codegen: ExpressionCodegen, overrid
|
||||
|
||||
override val lookupLocation = KotlinLookupLocation(callElement)
|
||||
|
||||
override val callableDescriptor: CallableDescriptor?
|
||||
get() = (this.context as? MethodContext)?.functionDescriptor
|
||||
|
||||
override val callElementText by lazy {
|
||||
callElement.text
|
||||
|
||||
-4
@@ -21,7 +21,6 @@ import org.jetbrains.kotlin.codegen.OwnerKind
|
||||
import org.jetbrains.kotlin.codegen.SourceInfo
|
||||
import org.jetbrains.kotlin.codegen.inline.*
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||
@@ -54,9 +53,6 @@ class IrSourceCompilerForInline(
|
||||
override val callElementText: String
|
||||
get() = callElement.toString()
|
||||
|
||||
override val callableDescriptor: CallableDescriptor
|
||||
get() = callElement.descriptor
|
||||
|
||||
override val callsiteFile: PsiFile?
|
||||
get() = TODO("not implemented")
|
||||
|
||||
|
||||
@@ -87,32 +87,22 @@ Kotlin
|
||||
*F
|
||||
+ 1 2.kt
|
||||
_2Kt
|
||||
+ 2 Standard.kt
|
||||
kotlin/StandardKt__StandardKt
|
||||
+ 3 ContractBuilder.kt
|
||||
kotlin/internal/contracts/ContractBuilderKt
|
||||
+ 4 1.kt
|
||||
+ 2 1.kt
|
||||
test/_1Kt
|
||||
+ 5 1.kt
|
||||
+ 3 1.kt
|
||||
test/_1Kt$lParams$1
|
||||
*L
|
||||
1#1,10:1
|
||||
39#2:11
|
||||
42#2:13
|
||||
32#3:12
|
||||
31#4,5:14
|
||||
29#4:20
|
||||
32#5:19
|
||||
31#2,5:11
|
||||
29#2:17
|
||||
32#3:16
|
||||
*E
|
||||
*S KotlinDebug
|
||||
*F
|
||||
+ 1 2.kt
|
||||
_2Kt
|
||||
*L
|
||||
5#1:11
|
||||
5#1:13
|
||||
5#1:12
|
||||
5#1,5:14
|
||||
5#1:20
|
||||
5#1:19
|
||||
5#1,5:11
|
||||
5#1:17
|
||||
5#1:16
|
||||
*E
|
||||
+10
-20
@@ -123,24 +123,17 @@ Kotlin
|
||||
*F
|
||||
+ 1 2.kt
|
||||
_2Kt
|
||||
+ 2 Standard.kt
|
||||
kotlin/StandardKt__StandardKt
|
||||
+ 3 ContractBuilder.kt
|
||||
kotlin/internal/contracts/ContractBuilderKt
|
||||
+ 4 1.kt
|
||||
+ 2 1.kt
|
||||
test/_1Kt
|
||||
+ 5 1.kt
|
||||
+ 3 1.kt
|
||||
test/_1Kt$lParams$1
|
||||
*L
|
||||
1#1,10:1
|
||||
39#2:11
|
||||
42#2:13
|
||||
32#3:12
|
||||
31#4:14
|
||||
70#4,2:15
|
||||
29#4:18
|
||||
50#5:17
|
||||
68#5:19
|
||||
31#2:11
|
||||
70#2,2:12
|
||||
29#2:15
|
||||
50#3:14
|
||||
68#3:16
|
||||
*E
|
||||
*S KotlinDebug
|
||||
*F
|
||||
@@ -148,11 +141,8 @@ test/_1Kt$lParams$1
|
||||
_2Kt
|
||||
*L
|
||||
5#1:11
|
||||
5#1:13
|
||||
5#1:12
|
||||
5#1,2:12
|
||||
5#1:15
|
||||
5#1:14
|
||||
5#1,2:15
|
||||
5#1:18
|
||||
5#1:17
|
||||
5#1:19
|
||||
5#1:16
|
||||
*E
|
||||
+16
-36
@@ -112,34 +112,24 @@ Kotlin
|
||||
*F
|
||||
+ 1 2.kt
|
||||
_2Kt
|
||||
+ 2 Standard.kt
|
||||
kotlin/StandardKt__StandardKt
|
||||
+ 3 ContractBuilder.kt
|
||||
kotlin/internal/contracts/ContractBuilderKt
|
||||
+ 4 1.kt
|
||||
+ 2 1.kt
|
||||
test/_1Kt
|
||||
+ 5 1.kt
|
||||
+ 3 1.kt
|
||||
test/_1Kt$lParams$1
|
||||
*L
|
||||
1#1,10:1
|
||||
39#2:11
|
||||
42#2:13
|
||||
32#3:12
|
||||
31#4,5:14
|
||||
29#4:20
|
||||
32#5:19
|
||||
31#2,5:11
|
||||
29#2:17
|
||||
32#3:16
|
||||
*E
|
||||
*S KotlinDebug
|
||||
*F
|
||||
+ 1 2.kt
|
||||
_2Kt
|
||||
*L
|
||||
5#1:11
|
||||
5#1:13
|
||||
5#1:12
|
||||
5#1,5:14
|
||||
5#1:20
|
||||
5#1:19
|
||||
5#1,5:11
|
||||
5#1:17
|
||||
5#1:16
|
||||
*E
|
||||
|
||||
// FILE: 2.smap-separate-compilation
|
||||
@@ -150,34 +140,24 @@ Kotlin
|
||||
*F
|
||||
+ 1 2.kt
|
||||
_2Kt
|
||||
+ 2 Standard.kt
|
||||
kotlin/StandardKt__StandardKt
|
||||
+ 3 ContractBuilder.kt
|
||||
kotlin/internal/contracts/ContractBuilderKt
|
||||
+ 4 1.kt
|
||||
+ 2 1.kt
|
||||
test/_1Kt
|
||||
+ 5 1.kt
|
||||
+ 3 1.kt
|
||||
test/_1Kt$lParams$1
|
||||
*L
|
||||
1#1,10:1
|
||||
39#2:11
|
||||
42#2:13
|
||||
32#3:12
|
||||
31#4,5:14
|
||||
29#4:20
|
||||
32#5:19
|
||||
31#2,5:11
|
||||
29#2:17
|
||||
32#3:16
|
||||
*E
|
||||
*S KotlinDebug
|
||||
*F
|
||||
+ 1 2.kt
|
||||
_2Kt
|
||||
*L
|
||||
5#1:11
|
||||
5#1:13
|
||||
5#1:12
|
||||
5#1,5:14
|
||||
5#1:20
|
||||
5#1:19
|
||||
5#1,5:11
|
||||
5#1:17
|
||||
5#1:16
|
||||
*E
|
||||
|
||||
SMAP
|
||||
|
||||
@@ -76,30 +76,20 @@ Kotlin
|
||||
*F
|
||||
+ 1 2.kt
|
||||
_2Kt
|
||||
+ 2 Standard.kt
|
||||
kotlin/StandardKt__StandardKt
|
||||
+ 3 ContractBuilder.kt
|
||||
kotlin/internal/contracts/ContractBuilderKt
|
||||
+ 4 1.kt
|
||||
+ 2 1.kt
|
||||
test/_1Kt
|
||||
+ 5 1.kt
|
||||
+ 3 1.kt
|
||||
test/_1Kt$lParams$1
|
||||
*L
|
||||
1#1,10:1
|
||||
39#2:11
|
||||
42#2:13
|
||||
32#3:12
|
||||
30#4,5:14
|
||||
31#5:19
|
||||
30#2,5:11
|
||||
31#3:16
|
||||
*E
|
||||
*S KotlinDebug
|
||||
*F
|
||||
+ 1 2.kt
|
||||
_2Kt
|
||||
*L
|
||||
5#1:11
|
||||
5#1:13
|
||||
5#1:12
|
||||
5#1,5:14
|
||||
5#1:19
|
||||
5#1,5:11
|
||||
5#1:16
|
||||
*E
|
||||
@@ -1,49 +0,0 @@
|
||||
package inlineOnlyLambdas
|
||||
|
||||
class Test
|
||||
fun test() {}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val data = Test()
|
||||
|
||||
//Breakpoint! (lambdaOrdinal = 1)
|
||||
data.onelinerApply { test() }
|
||||
|
||||
//Breakpoint! (lambdaOrdinal = 1)
|
||||
data.multiLineApply { test() }
|
||||
|
||||
//Breakpoint! (lambdaOrdinal = 1)
|
||||
data.onelinerApply2 { test() }
|
||||
|
||||
//Breakpoint! (lambdaOrdinal = 1)
|
||||
data.multiLineApply2 { test() }
|
||||
|
||||
//Breakpoint!
|
||||
data.withoutLambdaParams()
|
||||
}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.InlineOnly
|
||||
inline fun <T> T.withoutLambdaParams(): T {
|
||||
return this
|
||||
}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.InlineOnly
|
||||
inline fun <T> T.onelinerApply(block: T.() -> Unit): T { block(); return this }
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.InlineOnly
|
||||
inline fun <T> T.multiLineApply(block: T.() -> Unit): T {
|
||||
block();
|
||||
return this
|
||||
}
|
||||
|
||||
inline fun <T> T.onelinerApply2(block: T.() -> Unit): T { block(); return this }
|
||||
|
||||
inline fun <T> T.multiLineApply2(block: T.() -> Unit): T {
|
||||
block();
|
||||
return this
|
||||
}
|
||||
|
||||
// RESUME: 5
|
||||
@@ -1,15 +0,0 @@
|
||||
LineBreakpoint created at inlineOnlyLambdas.kt:10 lambdaOrdinal = 1
|
||||
LineBreakpoint created at inlineOnlyLambdas.kt:13 lambdaOrdinal = 1
|
||||
LineBreakpoint created at inlineOnlyLambdas.kt:16 lambdaOrdinal = 1
|
||||
LineBreakpoint created at inlineOnlyLambdas.kt:19 lambdaOrdinal = 1
|
||||
LineBreakpoint created at inlineOnlyLambdas.kt:22
|
||||
Run Java
|
||||
Connected to the target VM
|
||||
inlineOnlyLambdas.kt:10
|
||||
inlineOnlyLambdas.kt:13
|
||||
inlineOnlyLambdas.kt:16
|
||||
inlineOnlyLambdas.kt:19
|
||||
inlineOnlyLambdas.kt:22
|
||||
Disconnected from the target VM
|
||||
|
||||
Process finished with exit code 0
|
||||
-38
@@ -1,38 +0,0 @@
|
||||
package inlineOnlyLambdasStepping
|
||||
|
||||
class Test
|
||||
fun test() {}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val data = Test()
|
||||
|
||||
// STEP_OVER: 2
|
||||
//Breakpoint! (lambdaOrdinal = 1)
|
||||
data.onelinerApply { test() }
|
||||
|
||||
data.multiLineApply { test() }
|
||||
|
||||
// STEP_OVER: 3
|
||||
//Breakpoint! (lambdaOrdinal = 1)
|
||||
data.onelinerApply2 { test() }
|
||||
|
||||
data.multiLineApply2 { test() }
|
||||
}
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.InlineOnly
|
||||
inline fun <T> T.onelinerApply(block: T.() -> Unit): T { block(); return this }
|
||||
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.InlineOnly
|
||||
inline fun <T> T.multiLineApply(block: T.() -> Unit): T {
|
||||
block();
|
||||
return this
|
||||
}
|
||||
|
||||
inline fun <T> T.onelinerApply2(block: T.() -> Unit): T { block(); return this }
|
||||
|
||||
inline fun <T> T.multiLineApply2(block: T.() -> Unit): T {
|
||||
block();
|
||||
return this
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
LineBreakpoint created at inlineOnlyLambdasStepping.kt:11 lambdaOrdinal = 1
|
||||
LineBreakpoint created at inlineOnlyLambdasStepping.kt:17 lambdaOrdinal = 1
|
||||
Run Java
|
||||
Connected to the target VM
|
||||
inlineOnlyLambdasStepping.kt:11
|
||||
inlineOnlyLambdasStepping.kt:13
|
||||
inlineOnlyLambdasStepping.kt:17
|
||||
inlineOnlyLambdasStepping.kt:17
|
||||
inlineOnlyLambdasStepping.kt:19
|
||||
inlineOnlyLambdasStepping.kt:20
|
||||
Disconnected from the target VM
|
||||
|
||||
Process finished with exit code 0
|
||||
+1
-4
@@ -6,10 +6,7 @@ smartStepIntoInlinedFunLiteral.kt:11
|
||||
smartStepIntoInlinedFunLiteral.kt:12
|
||||
smartStepIntoInlinedFunLiteral.kt:17
|
||||
smartStepIntoInlinedFunLiteral.kt:18
|
||||
smartStepIntoInlinedFunLiteral.kt:24
|
||||
smartStepIntoInlinedFunLiteral.kt:26
|
||||
smartStepIntoInlinedFunLiteral.kt:32
|
||||
smartStepIntoInlinedFunLiteral.kt:32
|
||||
smartStepIntoInlinedFunLiteral.kt:1
|
||||
Disconnected from the target VM
|
||||
|
||||
Process finished with exit code 0
|
||||
|
||||
Vendored
+1
-4
@@ -6,10 +6,7 @@ smartStepIntoInlinedFunctionalExpression.kt:11
|
||||
smartStepIntoInlinedFunctionalExpression.kt:12
|
||||
smartStepIntoInlinedFunctionalExpression.kt:17
|
||||
smartStepIntoInlinedFunctionalExpression.kt:18
|
||||
smartStepIntoInlinedFunctionalExpression.kt:24
|
||||
smartStepIntoInlinedFunctionalExpression.kt:26
|
||||
smartStepIntoInlinedFunctionalExpression.kt:31
|
||||
smartStepIntoInlinedFunctionalExpression.kt:31
|
||||
smartStepIntoInlinedFunctionalExpression.kt:1
|
||||
Disconnected from the target VM
|
||||
|
||||
Process finished with exit code 0
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@ LineBreakpoint created at stepOutInlineFunctionStdlib.kt:6
|
||||
Run Java
|
||||
Connected to the target VM
|
||||
stepOutInlineFunctionStdlib.kt:6
|
||||
_Collections.!EXT!
|
||||
stepOutInlineFunctionStdlib.kt:9
|
||||
stepOutInlineFunctionStdlib.kt:1
|
||||
Thread.!EXT!
|
||||
Disconnected from the target VM
|
||||
|
||||
Process finished with exit code 0
|
||||
|
||||
@@ -2,7 +2,7 @@ LineBreakpoint created at stepIntoStdlib.kt:6
|
||||
Run Java
|
||||
Connected to the target VM
|
||||
stepIntoStdlib.kt:6
|
||||
_Arrays.!EXT!
|
||||
ArraysKt.!EXT!
|
||||
Disconnected from the target VM
|
||||
|
||||
Process finished with exit code 0
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ LineBreakpoint created at stepIntoStdlibFacadeClass.kt:6
|
||||
Run Java
|
||||
Connected to the target VM
|
||||
stepIntoStdlibFacadeClass.kt:6
|
||||
_Arrays.!EXT!
|
||||
ArraysKt.!EXT!
|
||||
Iterables.!EXT!
|
||||
Disconnected from the target VM
|
||||
|
||||
|
||||
@@ -27,5 +27,5 @@ inline fun forEach(s: () -> Unit) {
|
||||
}
|
||||
}
|
||||
|
||||
// STEP_INTO: 15
|
||||
// STEP_INTO: 9
|
||||
// TRACING_FILTERS_ENABLED: false
|
||||
@@ -3,20 +3,14 @@ Run Java
|
||||
Connected to the target VM
|
||||
inlineOnly.kt:5
|
||||
inlineOnly.kt:7
|
||||
inlineOnly.kt:25
|
||||
inlineOnly.kt:26
|
||||
inlineOnly.kt:13
|
||||
inlineOnly.kt:14
|
||||
inlineOnly.kt:7
|
||||
inlineOnly.kt:13
|
||||
inlineOnly.kt:14
|
||||
inlineOnly.kt:7
|
||||
inlineOnly.kt:25
|
||||
inlineOnly.kt:26
|
||||
inlineOnly.kt:7
|
||||
inlineOnly.kt:13
|
||||
inlineOnly.kt:14
|
||||
inlineOnly.kt:7
|
||||
inlineOnly.kt:25
|
||||
inlineOnly.kt:28
|
||||
inlineOnly.kt:9
|
||||
PrintStream.!EXT!
|
||||
Disconnected from the target VM
|
||||
|
||||
Process finished with exit code 0
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ LineBreakpoint created at stepIntoStdLibInlineFun.kt:6
|
||||
Run Java
|
||||
Connected to the target VM
|
||||
stepIntoStdLibInlineFun.kt:6
|
||||
_Collections.!EXT!
|
||||
stepIntoStdLibInlineFun.kt:1
|
||||
resuming stepIntoStdLibInlineFun.kt:6
|
||||
Disconnected from the target VM
|
||||
|
||||
|
||||
-10
@@ -1067,16 +1067,6 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
|
||||
runTest("idea/testData/debugger/tinyApp/src/stepping/custom/inlineInObjectSameFileDex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineOnlyLambdas.kt")
|
||||
public void testInlineOnlyLambdas() throws Exception {
|
||||
runTest("idea/testData/debugger/tinyApp/src/stepping/custom/inlineOnlyLambdas.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineOnlyLambdasStepping.kt")
|
||||
public void testInlineOnlyLambdasStepping() throws Exception {
|
||||
runTest("idea/testData/debugger/tinyApp/src/stepping/custom/inlineOnlyLambdasStepping.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineProperties.kt")
|
||||
public void testInlineProperties() throws Exception {
|
||||
runTest("idea/testData/debugger/tinyApp/src/stepping/custom/inlineProperties.kt");
|
||||
|
||||
Reference in New Issue
Block a user