[K/N] Avoid string copying when setting up bridge debug info.

The name of the function was copied at least 4 times. This reduces
a 56 seconds codegen phase in a non-optimized build by 2 seconds.
This commit is contained in:
Mads Ager
2022-12-20 16:16:40 +01:00
committed by Space
parent ef1e4662f1
commit 6b01886334
3 changed files with 34 additions and 11 deletions
@@ -275,20 +275,17 @@ internal fun setupBridgeDebugInfo(generationState: NativeGenerationState, functi
val file = debugInfo.compilerGeneratedFile
// TODO: can we share the scope among all bridges?
val scope: DIScopeOpaqueRef = DICreateFunction(
val scope: DIScopeOpaqueRef = DICreateBridgeFunction(
builder = debugInfo.builder,
scope = file.reinterpret(),
name = function.name,
linkageName = function.name,
function = function,
file = file,
lineNo = 0,
type = debugInfo.subroutineType(generationState.runtime.targetData, emptyList()), // TODO: use proper type.
isLocal = 0,
isDefinition = 1,
scopeLine = 0
)!!.also {
DIFunctionAddSubprogram(function, it)
}.reinterpret()
)!!.reinterpret()
return LocationInfo(scope, 1, 0)
}