[K/N] Rename file initializers to static initializers
This commit is contained in:
committed by
Space Team
parent
d09a18c88b
commit
9516094755
+4
-4
@@ -444,10 +444,10 @@ internal val constantInliningPhase = makeKonanFileLoweringPhase(
|
||||
description = "Inline const fields reads",
|
||||
)
|
||||
|
||||
internal val fileInitializersPhase = makeKonanFileLoweringPhase(
|
||||
::FileInitializersLowering,
|
||||
name = "FileInitializers",
|
||||
description = "Add calls to file initializers",
|
||||
internal val staticInitializersPhase = makeKonanFileLoweringPhase(
|
||||
::StaticInitializersLowering,
|
||||
name = "StaticInitializers",
|
||||
description = "Add calls to static initializers",
|
||||
prerequisite = setOf(expressionBodyTransformPhase)
|
||||
)
|
||||
|
||||
|
||||
+5
-5
@@ -293,7 +293,7 @@ internal val allLoweringsPhase = SameTypeNamedCompilerPhase(
|
||||
typeOperatorPhase,
|
||||
expressionBodyTransformPhase,
|
||||
constantInliningPhase,
|
||||
fileInitializersPhase,
|
||||
staticInitializersPhase,
|
||||
bridgesPhase,
|
||||
exportInternalAbiPhase,
|
||||
useInternalAbiPhase,
|
||||
@@ -401,7 +401,7 @@ internal val bitcodePhase = SameTypeNamedCompilerPhase(
|
||||
buildDFGPhase then
|
||||
devirtualizationAnalysisPhase then
|
||||
dcePhase then
|
||||
removeRedundantCallsToFileInitializersPhase then
|
||||
removeRedundantCallsToStaticInitializersPhase then
|
||||
devirtualizationPhase then
|
||||
propertyAccessorInlinePhase then // Have to run after link dependencies phase, because fields
|
||||
// from dependencies can be changed during lowerings.
|
||||
@@ -568,13 +568,13 @@ internal fun PhaseConfig.konanPhasesConfig(config: KonanConfig) {
|
||||
disable(unboxInlinePhase)
|
||||
disable(inlineClassPropertyAccessorsPhase)
|
||||
disable(dcePhase)
|
||||
disable(removeRedundantCallsToFileInitializersPhase)
|
||||
disable(removeRedundantCallsToStaticInitializersPhase)
|
||||
disable(ghaPhase)
|
||||
}
|
||||
disableUnless(verifyBitcodePhase, config.needCompilerVerification || getBoolean(KonanConfigKeys.VERIFY_BITCODE))
|
||||
|
||||
disableUnless(fileInitializersPhase, config.propertyLazyInitialization)
|
||||
disableUnless(removeRedundantCallsToFileInitializersPhase, config.propertyLazyInitialization)
|
||||
disableUnless(staticInitializersPhase, config.propertyLazyInitialization)
|
||||
disableUnless(removeRedundantCallsToStaticInitializersPhase, config.propertyLazyInitialization)
|
||||
|
||||
disableUnless(removeRedundantSafepointsPhase, config.memoryModel == MemoryModel.EXPERIMENTAL)
|
||||
|
||||
|
||||
+4
-4
@@ -170,9 +170,9 @@ internal val dcePhase = makeKonanModuleOpPhase(
|
||||
}
|
||||
)
|
||||
|
||||
internal val removeRedundantCallsToFileInitializersPhase = makeKonanModuleOpPhase(
|
||||
name = "RemoveRedundantCallsToFileInitializersPhase",
|
||||
description = "Redundant file initializers calls removal",
|
||||
internal val removeRedundantCallsToStaticInitializersPhase = makeKonanModuleOpPhase(
|
||||
name = "RemoveRedundantCallsToStaticInitializersPhase",
|
||||
description = "Redundant static initializers calls removal",
|
||||
prerequisite = setOf(devirtualizationAnalysisPhase),
|
||||
op = { context, _ ->
|
||||
val moduleDFG = context.moduleDFG!!
|
||||
@@ -189,7 +189,7 @@ internal val removeRedundantCallsToFileInitializersPhase = makeKonanModuleOpPhas
|
||||
.mapNotNull { it.irFunction }
|
||||
.toSet()
|
||||
|
||||
FileInitializersOptimization.removeRedundantCalls(context, callGraph, rootSet)
|
||||
StaticInitializersOptimization.removeRedundantCalls(context, callGraph, rootSet)
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ internal val IrField.shouldBeInitializedEagerly: Boolean
|
||||
}
|
||||
|
||||
// TODO: ExplicitlyExported for IR proto are not longer needed.
|
||||
internal class FileInitializersLowering(val context: Context) : FileLoweringPass {
|
||||
internal class StaticInitializersLowering(val context: Context) : FileLoweringPass {
|
||||
override fun lower(irFile: IrFile) {
|
||||
var requireGlobalInitializer = false
|
||||
var requireThreadLocalInitializer = false
|
||||
+1
-1
@@ -52,7 +52,7 @@ import java.util.*
|
||||
* set after evaluating that expression.
|
||||
*/
|
||||
|
||||
internal object FileInitializersOptimization {
|
||||
internal object StaticInitializersOptimization {
|
||||
private class AnalysisResult(val functionsRequiringGlobalInitializerCall: Set<IrFunction>,
|
||||
val functionsRequiringThreadLocalInitializerCall: Set<IrFunction>,
|
||||
val callSitesRequiringGlobalInitializerCall: Set<IrFunctionAccessExpression>,
|
||||
Reference in New Issue
Block a user