[Wasm] Boolean boxed instances are the same
Fixed #KT-65411
This commit is contained in:
committed by
Space Team
parent
a171f774be
commit
a5ef668e3c
@@ -224,6 +224,8 @@ class WasmSymbols(
|
||||
symbolTable.descriptorExtension.referenceSimpleFunction(it)
|
||||
}
|
||||
|
||||
val getBoxedBoolean: IrSimpleFunctionSymbol = getInternalFunction("getBoxedBoolean")
|
||||
val boxBoolean: IrSimpleFunctionSymbol = getInternalFunction("boxBoolean")
|
||||
val boxIntrinsic: IrSimpleFunctionSymbol = getInternalFunction("boxIntrinsic")
|
||||
val unboxIntrinsic: IrSimpleFunctionSymbol = getInternalFunction("unboxIntrinsic")
|
||||
|
||||
|
||||
+13
-2
@@ -78,12 +78,23 @@ internal class WasmUsefulDeclarationProcessor(
|
||||
context.wasmSymbols.wasmTypeId,
|
||||
context.wasmSymbols.refCastNull,
|
||||
context.wasmSymbols.refTest,
|
||||
context.wasmSymbols.boxIntrinsic,
|
||||
context.wasmSymbols.wasmArrayCopy -> {
|
||||
call.getTypeArgument(0)?.enqueueRuntimeClassOrAny(from, "intrinsic ${call.symbol.owner.name}")
|
||||
true
|
||||
}
|
||||
|
||||
context.wasmSymbols.boxIntrinsic -> {
|
||||
val type = call.getTypeArgument(0)!!
|
||||
if (type == context.irBuiltIns.booleanType) {
|
||||
context.wasmSymbols.getBoxedBoolean.owner.enqueue(from, "intrinsic boxIntrinsic")
|
||||
} else {
|
||||
type.enqueueRuntimeClassOrAny(from, "intrinsic boxIntrinsic")
|
||||
}
|
||||
true
|
||||
}
|
||||
context.wasmSymbols.boxBoolean -> {
|
||||
context.irBuiltIns.booleanType.enqueueRuntimeClassOrAny(from, "intrinsic boxBoolean")
|
||||
true
|
||||
}
|
||||
else -> false
|
||||
}
|
||||
|
||||
|
||||
+11
-1
@@ -377,8 +377,18 @@ class BodyGenerator(
|
||||
|
||||
// Box intrinsic has an additional klass ID argument.
|
||||
// Processing it separately
|
||||
if (call.symbol == wasmSymbols.boxBoolean) {
|
||||
generateBox(call.getValueArgument(0)!!, irBuiltIns.booleanType)
|
||||
return
|
||||
}
|
||||
if (call.symbol == wasmSymbols.boxIntrinsic) {
|
||||
generateBox(call.getValueArgument(0)!!, call.getTypeArgument(0)!!)
|
||||
val type = call.getTypeArgument(0)!!
|
||||
if (type == irBuiltIns.booleanType) {
|
||||
generateExpression(call.getValueArgument(0)!!)
|
||||
body.buildCall(context.referenceFunction(context.backendContext.wasmSymbols.getBoxedBoolean), location)
|
||||
} else {
|
||||
generateBox(call.getValueArgument(0)!!, type)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user