[K/N] Refactor default argument lowering to avoid boxing

Current inline classes API is not compatible between different backends.
So implementing common function required for this optimization
was not possible in Native backend.

So, common default arguments lowering was refactored to make bigger
piece of code replaceable in backends.

^KT-57860
This commit is contained in:
Pavel Kunyavskiy
2023-04-24 12:52:17 +02:00
committed by Space Team
parent 2aea5822b2
commit f55fd481e9
18 changed files with 141 additions and 54 deletions
@@ -369,7 +369,7 @@ private val addMainFunctionCallsLowering = makeCustomWasmModulePhase(
)
private val defaultArgumentStubGeneratorPhase = makeWasmModulePhase(
{ context -> DefaultArgumentStubGenerator(context, skipExternalMethods = true) },
{ context -> DefaultArgumentStubGenerator(context, MaskedDefaultArgumentFunctionFactory(context), skipExternalMethods = true) },
name = "DefaultArgumentStubGenerator",
description = "Generate synthetic stubs for functions with default parameter values"
)
@@ -382,7 +382,7 @@ private val defaultArgumentPatchOverridesPhase = makeWasmModulePhase(
)
private val defaultParameterInjectorPhase = makeWasmModulePhase(
{ context -> DefaultParameterInjector(context, skipExternalMethods = true) },
{ context -> DefaultParameterInjector(context, MaskedDefaultArgumentFunctionFactory(context), skipExternalMethods = true) },
name = "DefaultParameterInjector",
description = "Replace call site with default parameters with corresponding stub function",
prerequisite = setOf(innerClassesLoweringPhase)