Add a key to enable spilling of all variables in a suspending context

This commit adds a new key that will allow users to enhance their
debugging experience in suspending contexts when using the IR backend.
After the key is enabled, the following things are changed:
1. All variables in a suspending context are spilled regardless their
liveness.
2. Their LVT records are not shrunk.
3. ACONST_NULL is not spilled to dead variables.

#KT-48678 In progress

(cherry picked from commit 38d97d0621)
This commit is contained in:
Nikita Nazarov
2022-06-11 16:36:09 +03:00
parent 6c6717da5a
commit 2ab92bcb7e
5 changed files with 31 additions and 9 deletions
@@ -511,6 +511,13 @@ Also sets `-jvm-target` value equal to the selected JDK version"""
)
var linkViaSignatures: Boolean by FreezableVar(false)
@Argument(
value = "-Xdebug",
description = "Enable debug mode for compilation.\n" +
"Currently this includes spilling all variables in a suspending context regardless their liveness."
)
var enableDebugMode: Boolean by FreezableVar(false)
override fun configureAnalysisFlags(collector: MessageCollector, languageVersion: LanguageVersion): MutableMap<AnalysisFlag<*>, Any> {
val result = super.configureAnalysisFlags(collector, languageVersion)
result[JvmAnalysisFlags.strictMetadataVersionSemantics] = strictMetadataVersionSemantics