[codegeneration][debug info] enchance debugger behaviour for paramterless when
- generates tramboline like a11b07f6c3 on -Xg-generate-when-marker=enable
- fixes issue KT-33364
This commit is contained in:
@@ -178,6 +178,15 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
|
|||||||
null
|
null
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
putIfNotNull(GENERATE_WHEN_MARKER, when (val it = arguments.generateWhenMarkerString) {
|
||||||
|
"enable" -> true
|
||||||
|
"disable" -> false
|
||||||
|
null -> null
|
||||||
|
else -> {
|
||||||
|
configuration.report(ERROR, "Unsupported -Xg-generate-when-marker= value: $it. Possible values are 'enable'/'disable'")
|
||||||
|
null
|
||||||
|
}
|
||||||
|
})
|
||||||
put(STATIC_FRAMEWORK, selectFrameworkType(configuration, arguments, outputKind))
|
put(STATIC_FRAMEWORK, selectFrameworkType(configuration, arguments, outputKind))
|
||||||
put(OVERRIDE_CLANG_OPTIONS, arguments.clangOptions.toNonNullList())
|
put(OVERRIDE_CLANG_OPTIONS, arguments.clangOptions.toNonNullList())
|
||||||
put(ALLOCATION_MODE, arguments.allocator)
|
put(ALLOCATION_MODE, arguments.allocator)
|
||||||
|
|||||||
+6
@@ -171,6 +171,12 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
|
|||||||
description = """generates marker of inlined function body on call site to make debugger breakpoint resolution more accurate"""
|
description = """generates marker of inlined function body on call site to make debugger breakpoint resolution more accurate"""
|
||||||
)
|
)
|
||||||
var generateInlinedFunctionMarkerString: String? = null
|
var generateInlinedFunctionMarkerString: String? = null
|
||||||
|
@Argument(
|
||||||
|
value = "-Xg-generate-when-marker",
|
||||||
|
valueDescription = "{disable|enable}",
|
||||||
|
description = """generates marker of when to make debugger breakpoint resolution more accurate"""
|
||||||
|
)
|
||||||
|
var generateWhenMarkerString: String? = null
|
||||||
|
|
||||||
|
|
||||||
@Argument(
|
@Argument(
|
||||||
|
|||||||
+1
@@ -44,6 +44,7 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
|
|||||||
val lightDebug: Boolean = configuration.get(KonanConfigKeys.LIGHT_DEBUG)
|
val lightDebug: Boolean = configuration.get(KonanConfigKeys.LIGHT_DEBUG)
|
||||||
?: target.family.isAppleFamily // Default is true for Apple targets.
|
?: target.family.isAppleFamily // Default is true for Apple targets.
|
||||||
val generateInlinedBodyTrampoline = debug && configuration.get(KonanConfigKeys.GENERATE_INLINED_FUNCTION_BODY_MARKER) ?: false
|
val generateInlinedBodyTrampoline = debug && configuration.get(KonanConfigKeys.GENERATE_INLINED_FUNCTION_BODY_MARKER) ?: false
|
||||||
|
val generateWhenTrampoline = debug && configuration.get(KonanConfigKeys.GENERATE_WHEN_MARKER) ?: false
|
||||||
|
|
||||||
val memoryModel: MemoryModel get() = configuration.get(KonanConfigKeys.MEMORY_MODEL)!!
|
val memoryModel: MemoryModel get() = configuration.get(KonanConfigKeys.MEMORY_MODEL)!!
|
||||||
val destroyRuntimeMode: DestroyRuntimeMode get() = configuration.get(KonanConfigKeys.DESTROY_RUNTIME_MODE)!!
|
val destroyRuntimeMode: DestroyRuntimeMode get() = configuration.get(KonanConfigKeys.DESTROY_RUNTIME_MODE)!!
|
||||||
|
|||||||
+2
@@ -58,6 +58,8 @@ class KonanConfigKeys {
|
|||||||
= CompilerConfigurationKey.create("add light debug information")
|
= CompilerConfigurationKey.create("add light debug information")
|
||||||
val GENERATE_INLINED_FUNCTION_BODY_MARKER: CompilerConfigurationKey<Boolean?>
|
val GENERATE_INLINED_FUNCTION_BODY_MARKER: CompilerConfigurationKey<Boolean?>
|
||||||
= CompilerConfigurationKey.create("generates inlined function body marker on call site")
|
= CompilerConfigurationKey.create("generates inlined function body marker on call site")
|
||||||
|
val GENERATE_WHEN_MARKER: CompilerConfigurationKey<Boolean?>
|
||||||
|
= CompilerConfigurationKey.create("generates when marker on call site")
|
||||||
val LINKER_ARGS: CompilerConfigurationKey<List<String>>
|
val LINKER_ARGS: CompilerConfigurationKey<List<String>>
|
||||||
= CompilerConfigurationKey.create("additional linker arguments")
|
= CompilerConfigurationKey.create("additional linker arguments")
|
||||||
val LIST_PHASES: CompilerConfigurationKey<Boolean>
|
val LIST_PHASES: CompilerConfigurationKey<Boolean>
|
||||||
|
|||||||
+6
@@ -1177,6 +1177,12 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|
|||||||
|
|
||||||
val whenEmittingContext = WhenEmittingContext(expression)
|
val whenEmittingContext = WhenEmittingContext(expression)
|
||||||
|
|
||||||
|
val generationContext = (currentCodeContext.functionScope() as? FunctionScope)?.functionGenerationContext
|
||||||
|
.takeIf { context.config.generateWhenTrampoline }
|
||||||
|
generationContext?.basicBlock("when", expression.startLocation)?.let {
|
||||||
|
generationContext.br(it)
|
||||||
|
generationContext.positionAtEnd(it)
|
||||||
|
}
|
||||||
expression.branches.forEach {
|
expression.branches.forEach {
|
||||||
val bbNext = if (it == expression.branches.last())
|
val bbNext = if (it == expression.branches.last())
|
||||||
null
|
null
|
||||||
|
|||||||
Reference in New Issue
Block a user