JVM IR: Box arguments in abstract method stubs for "remove" bridges
This commit is contained in:
committed by
Georgy Bronnikov
parent
86f9cb6eef
commit
3881220386
+3
-5
@@ -224,7 +224,7 @@ private class BridgeLowering(val context: JvmBackendContext) : FileLoweringPass,
|
|||||||
bridgeTarget = when {
|
bridgeTarget = when {
|
||||||
irFunction.isJvmAbstract -> {
|
irFunction.isJvmAbstract -> {
|
||||||
irClass.declarations.remove(irFunction)
|
irClass.declarations.remove(irFunction)
|
||||||
irClass.addAbstractMethodStub(irFunction)
|
irClass.addAbstractMethodStub(irFunction, specialBridge.methodInfo?.needsArgumentBoxing == true)
|
||||||
}
|
}
|
||||||
irFunction.modality != Modality.FINAL -> {
|
irFunction.modality != Modality.FINAL -> {
|
||||||
val superTarget = irFunction.overriddenSymbols.first { !it.owner.parentAsClass.isInterface }.owner
|
val superTarget = irFunction.overriddenSymbols.first { !it.owner.parentAsClass.isInterface }.owner
|
||||||
@@ -332,7 +332,7 @@ private class BridgeLowering(val context: JvmBackendContext) : FileLoweringPass,
|
|||||||
it.specialBridgeOrNull?.signature?.takeIf { bridgeSignature -> bridgeSignature != it.jvmMethod }
|
it.specialBridgeOrNull?.signature?.takeIf { bridgeSignature -> bridgeSignature != it.jvmMethod }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun IrClass.addAbstractMethodStub(irFunction: IrSimpleFunction) =
|
private fun IrClass.addAbstractMethodStub(irFunction: IrSimpleFunction, needsArgumentBoxing: Boolean) =
|
||||||
addFunction {
|
addFunction {
|
||||||
updateFrom(irFunction)
|
updateFrom(irFunction)
|
||||||
modality = Modality.ABSTRACT
|
modality = Modality.ABSTRACT
|
||||||
@@ -340,9 +340,7 @@ private class BridgeLowering(val context: JvmBackendContext) : FileLoweringPass,
|
|||||||
name = irFunction.name
|
name = irFunction.name
|
||||||
returnType = irFunction.returnType
|
returnType = irFunction.returnType
|
||||||
}.apply {
|
}.apply {
|
||||||
dispatchReceiverParameter = thisReceiver?.copyTo(this, type = defaultType)
|
copyParametersWithErasure(this@addAbstractMethodStub, irFunction, needsArgumentBoxing)
|
||||||
extensionReceiverParameter = irFunction.extensionReceiverParameter?.copyTo(this)
|
|
||||||
valueParameters = irFunction.valueParameters.map { it.copyTo(this) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun IrClass.addBridge(bridge: Bridge, target: IrSimpleFunction): IrSimpleFunction =
|
private fun IrClass.addBridge(bridge: Bridge, target: IrSimpleFunction): IrSimpleFunction =
|
||||||
|
|||||||
Reference in New Issue
Block a user