Keep $continuation in LVT

in case of suspend functions and `this` is case of lambdas, since they
are used in async stack trace generation.
Update tests.
 #KT-40661 Open
This commit is contained in:
Ilmir Usmanov
2020-07-28 12:49:38 +02:00
parent db40808186
commit 4fb5f8603a
23 changed files with 128 additions and 104 deletions
@@ -5,12 +5,15 @@ suspend fun main() {
val b = 7
none()
foo()
val dead1 = a
val dead2 = b
}
suspend fun foo() {
val x = "foo"
none()
bar()
val dead = x
}
suspend fun bar() {
@@ -19,6 +22,7 @@ suspend fun bar() {
val z = "bar"
//Breakpoint!
val a = 5
val dead = y
}
suspend fun none() {}
@@ -1,11 +1,11 @@
LineBreakpoint created at asyncFunctions.kt:21
LineBreakpoint created at asyncFunctions.kt:24
Run Java
Connected to the target VM
asyncFunctions.kt:21
asyncFunctions.kt:24
Async stack trace:
asyncFunctions.AsyncFunctionsKt:18
asyncFunctions.AsyncFunctionsKt:21
y = "zoo"
asyncFunctions.AsyncFunctionsKt:13
asyncFunctions.AsyncFunctionsKt:15
x = "foo"
asyncFunctions.AsyncFunctionsKt:7
a = 5
@@ -19,7 +19,7 @@ suspend fun test1(i: Int): Int {
suspend fun a(aParam: String) {
val a = "a"
b(a)
a + 1
a + aParam
}
suspend fun b(bParam: String) {
@@ -9,7 +9,7 @@ fun main() {
runBlocking {
val rootCoroutineVal = mainTestVal
TestSuspendA().a()
print("")
print(rootCoroutineVal)
}
}
@@ -18,7 +18,7 @@ class TestSuspendA {
suspend fun a() {
val methodVal = ""
InClassB().b()
print("")
print(methodVal)
}
class InClassB {
@@ -27,7 +27,7 @@ class TestSuspendA {
suspend fun b() {
val inClassBMethodVal = ""
InClassC().c()
print("")
print(inClassBMethodVal)
}
inner class InClassC {
@@ -37,7 +37,7 @@ class TestSuspendA {
yield()
val inClassCMethodVal = ""
//Breakpoint!
print("")
print(inClassCMethodVal)
}
}
}
@@ -4,12 +4,12 @@ Connected to the target VM
suspendFunWithInner.kt:40
Thread stack trace:
CoroutinePreflightFrame c:!LINE_NUMBER!, TestSuspendA$InClassB$InClassC (continuation)
($completion, $continuation, $result, inClassCMethodVal, this)
($completion, $continuation, $result, inClassCMethodVal)
CoroutineInfo: 1 coroutine RUNNING
CoroutineStackFrame b:!LINE_NUMBER!, TestSuspendA$InClassB (continuation)
(inClassBMethodVal, this)
(inClassBMethodVal)
CoroutineStackFrame a:!LINE_NUMBER!, TestSuspendA (continuation)
(methodVal, this)
(methodVal)
CoroutineStackFrame invokeSuspend:!LINE_NUMBER!, SuspendFunWithInnerKt$main$1 (continuation)
(rootCoroutineVal)
CoroutineStackFrame resumeWith:!LINE_NUMBER!, BaseContinuationImpl (kotlin.coroutines.jvm.internal)
@@ -4,7 +4,7 @@ suspend fun main() {
val a = 5
foo()
//Breakpoint!
val b = 4
val b = a
}
suspend fun foo() {}
@@ -14,16 +14,18 @@ fun main() {
suspend fun a() {
val a = "a"
b(a)
val aLate = "a" // to prevent stackFrame to collapse
val aLate = a // to prevent stackFrame to collapse
}
suspend fun b(paramA: String) {
yield()
val b = "b"
c(b)
val dead = paramA
}
suspend fun c(paramB: String) {
val c = "c"
//Breakpoint!
val dead = paramB
}
@@ -1,7 +1,7 @@
LineBreakpoint created at coroutineSuspendFun.kt:29
LineBreakpoint created at coroutineSuspendFun.kt:30
Run Java
Connected to the target VM
coroutineSuspendFun.kt:29
coroutineSuspendFun.kt:30
Thread stack trace:
KotlinStackFrame c:!LINE_NUMBER!, CoroutineSuspendFunKt (continuation)
($completion, c, paramB)
@@ -14,16 +14,18 @@ fun main() {
suspend fun a() {
val a = "a"
b(a)
val aLate = "a" // to prevent stackFrame to collapse
val aLate = a // to prevent stackFrame to collapse
}
suspend fun b(paramA: String) {
yield()
val b = "b"
c(b)
val dead = paramA
}
suspend fun c(paramB: String) {
val c = "c"
//Breakpoint!
val dead = paramB
}
@@ -1,7 +1,7 @@
LineBreakpoint created at coroutineSuspendFun136.kt:29
LineBreakpoint created at coroutineSuspendFun136.kt:30
Run Java
Connected to the target VM
coroutineSuspendFun136.kt:29
coroutineSuspendFun136.kt:30
Thread stack trace:
KotlinStackFrame c:!LINE_NUMBER!, CoroutineSuspendFun136Kt (continuation)
($completion, c, paramB)
@@ -4,7 +4,7 @@ Connected to the target VM
suspendMain.kt:15
Thread stack trace:
CoroutinePreflightFrame invokeSuspend:!LINE_NUMBER!, SuspendMainKt$main$2 (continuation)
($result, $this$coroutineScope, this)
($result, this)
CoroutineInfo: -1 coroutine UNKNOWN
CoroutineStackFrame startUndispatchedOrReturn:!LINE_NUMBER!, UndispatchedKt (kotlinx.coroutines.intrinsics)
($i$a$-undispatchedResult-UndispatchedKt$startUndispatchedOrReturn$2, $i$f$undispatchedResult, $this$startUndispatchedOrReturn, $this$undispatchedResult$iv, block, receiver)