IC mangling: Use old mangling scheme for stdlib

This way, new stdlib can still be usable in 1.4.20
This commit is contained in:
Ilmir Usmanov
2020-11-11 09:49:35 +01:00
parent 488d4ab018
commit 2829d37cf5
8 changed files with 122 additions and 8 deletions
@@ -59,6 +59,8 @@ object InlineClassAbi {
return irClass.primaryConstructor!!.valueParameters[0].type
}
private fun IrFunction.isFunctionFromStdlib(): Boolean = fqNameForIrSerialization.startsWith(Name.identifier("kotlin"))
/**
* Returns a mangled name for a function taking inline class arguments
* to avoid clashes between overloaded methods.
@@ -72,10 +74,10 @@ object InlineClassAbi {
return Name.identifier("constructor-impl")
}
val suffix = if (useOldMangleRules) {
val suffix = if (useOldMangleRules || irFunction.isFunctionFromStdlib()) {
when {
irFunction.fullValueParameterList.any { it.type.requiresMangling } ->
hashSuffix(irFunction, false, useOldMangleRules)
hashSuffix(irFunction, mangleReturnTypes = false, useOldMangleRules = true)
mangleReturnTypes && irFunction.hasMangledReturnType ->
returnHashSuffix(irFunction)
(irFunction.parent as? IrClass)?.isInline == true &&
@@ -87,7 +89,7 @@ object InlineClassAbi {
} else {
when {
irFunction.fullValueParameterList.any { it.type.requiresMangling } || (mangleReturnTypes && irFunction.hasMangledReturnType) ->
hashSuffix(irFunction, mangleReturnTypes, useOldMangleRules)
hashSuffix(irFunction, mangleReturnTypes, false)
(irFunction.parent as? IrClass)?.isInline == true &&
irFunction.origin != IrDeclarationOrigin.IR_BUILTINS_STUB ->
"impl"