[Wasm] Boolean boxed instances are the same

Fixed #KT-65411
This commit is contained in:
Igor Yakovlev
2024-02-09 17:01:12 +01:00
committed by Space Team
parent a171f774be
commit a5ef668e3c
28 changed files with 190 additions and 7 deletions
@@ -63,6 +63,20 @@ internal fun nullableDoubleIeee754Equals(lhs: Double?, rhs: Double?): Boolean {
return wasm_f64_eq(lhs, rhs)
}
private var TRUE: Boolean? = null
private var FALSE: Boolean? = null
internal fun getBoxedBoolean(x: Boolean): Boolean? =
if (x) {
TRUE ?: boxBoolean(true).also { TRUE = it }
} else {
FALSE ?: boxBoolean(false).also { FALSE = it }
}
@ExcludedFromCodegen
internal fun boxBoolean(x: Boolean): Boolean? =
implementedAsIntrinsic
@ExcludedFromCodegen
internal fun <T, R> boxIntrinsic(x: T): R =
implementedAsIntrinsic