Skip to content

Commit 85ad07a

Browse files
ilmirusSpace Team
authored and
Space Team
committed
stdlib: add function to null out spilled dead variables in suspend
functions. Calls to it are generated by compiler and its implementation is replaced by debugger #KT-63720
1 parent 22bab72 commit 85ad07a

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
3+
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
4+
*/
5+
6+
package kotlin.coroutines.jvm.internal
7+
8+
/**
9+
* This function is called by generated code when visible dead variable is spilled.
10+
*
11+
* By default, it returns `null`, but the debugger is expected to replace it with implementation, which returns the argument.
12+
*
13+
* This way, we avoid memory leaks, and do not hinder debuggability.
14+
*/
15+
@PublishedApi
16+
@Suppress("UNUSED_PARAMETER", "unused")
17+
internal fun nullOutSpilledVariable(value: Any?): Any? = null

libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-stdlib-runtime-merged.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3112,6 +3112,10 @@ public abstract interface class kotlin/coroutines/jvm/internal/CoroutineStackFra
31123112
public abstract fun getStackTraceElement ()Ljava/lang/StackTraceElement;
31133113
}
31143114

3115+
public final class kotlin/coroutines/jvm/internal/SpillingKt {
3116+
public static final fun nullOutSpilledVariable (Ljava/lang/Object;)Ljava/lang/Object;
3117+
}
3118+
31153119
public abstract interface class kotlin/enums/EnumEntries : java/util/List, kotlin/jvm/internal/markers/KMappedMarker {
31163120
}
31173121

0 commit comments

Comments
 (0)