diff --git a/generators/builtins/primitives/WasmPrimitivesGenerator.kt b/generators/builtins/primitives/WasmPrimitivesGenerator.kt index 8652ccdde3b..afa901ab94b 100644 --- a/generators/builtins/primitives/WasmPrimitivesGenerator.kt +++ b/generators/builtins/primitives/WasmPrimitivesGenerator.kt @@ -237,8 +237,7 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri override fun MethodBuilder.modifyGeneratedEquals(thisKind: PrimitiveType) { val additionalCheck = when (thisKind) { PrimitiveType.LONG -> "wasm_i64_eq(this, $parameterName)" - PrimitiveType.FLOAT -> "this.equals(other)" - PrimitiveType.DOUBLE -> "this.toBits() == other.toBits()" + PrimitiveType.FLOAT, PrimitiveType.DOUBLE -> "this.toBits() == other.toBits()" else -> { "wasm_i32_eq(this${thisKind.castToIfNecessary(PrimitiveType.INT)}, $parameterName${thisKind.castToIfNecessary(PrimitiveType.INT)})" } @@ -255,7 +254,6 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri } override fun ClassBuilder.generateAdditionalMethods(thisKind: PrimitiveType) { - generateCustomEquals(thisKind) generateHashCode(thisKind) when { thisKind == PrimitiveType.BYTE || thisKind == PrimitiveType.SHORT -> generateReinterpret(PrimitiveType.INT) @@ -283,25 +281,6 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri } } - private fun ClassBuilder.generateCustomEquals(thisKind: PrimitiveType) { - method { - annotations += "kotlin.internal.IntrinsicConstEvaluation" - signature { - isInline = thisKind in PrimitiveType.floatingPoint - methodName = "equals" - parameter { - name = "other" - type = thisKind.capitalized - } - returnType = PrimitiveType.BOOLEAN.capitalized - } - when (thisKind) { - in PrimitiveType.floatingPoint -> "toBits() == other.toBits()".addAsSingleLineBody(bodyOnNewLine = false) - else -> implementAsIntrinsic(thisKind, methodName) - } - } - } - private fun ClassBuilder.generateReinterpret(otherKind: PrimitiveType) { method { annotations += "WasmNoOpCast" diff --git a/libraries/stdlib/wasm/builtins/kotlin/Primitives.kt b/libraries/stdlib/wasm/builtins/kotlin/Primitives.kt index 086dd2c01c2..fad817170a7 100644 --- a/libraries/stdlib/wasm/builtins/kotlin/Primitives.kt +++ b/libraries/stdlib/wasm/builtins/kotlin/Primitives.kt @@ -429,11 +429,6 @@ public class Byte private constructor(private val value: Byte) : Number(), Compa public override fun equals(other: Any?): Boolean = other is Byte && wasm_i32_eq(this.toInt(), other.toInt()) - @kotlin.internal.IntrinsicConstEvaluation - @WasmOp(WasmOp.I32_EQ) - public fun equals(other: Byte): Boolean = - implementedAsIntrinsic - public override fun hashCode(): Int = this.toInt() @WasmNoOpCast @@ -858,11 +853,6 @@ public class Short private constructor(private val value: Short) : Number(), Com public override fun equals(other: Any?): Boolean = other is Short && wasm_i32_eq(this.toInt(), other.toInt()) - @kotlin.internal.IntrinsicConstEvaluation - @WasmOp(WasmOp.I32_EQ) - public fun equals(other: Short): Boolean = - implementedAsIntrinsic - public override fun hashCode(): Int = this.toInt() @WasmNoOpCast @@ -1351,11 +1341,6 @@ public class Int private constructor(private val value: Int) : Number(), Compara public override fun equals(other: Any?): Boolean = other is Int && wasm_i32_eq(this, other) - @kotlin.internal.IntrinsicConstEvaluation - @WasmOp(WasmOp.I32_EQ) - public fun equals(other: Int): Boolean = - implementedAsIntrinsic - public override fun hashCode(): Int = this @WasmNoOpCast @@ -1858,11 +1843,6 @@ public class Long private constructor(private val value: Long) : Number(), Compa public override fun equals(other: Any?): Boolean = other is Long && wasm_i64_eq(this, other) - @kotlin.internal.IntrinsicConstEvaluation - @WasmOp(WasmOp.I64_EQ) - public fun equals(other: Long): Boolean = - implementedAsIntrinsic - public override fun hashCode(): Int = ((this ushr 32) xor this).toInt() } @@ -2254,10 +2234,7 @@ public class Float private constructor(private val value: Float) : Number(), Com @kotlin.internal.IntrinsicConstEvaluation public override fun equals(other: Any?): Boolean = - other is Float && this.equals(other) - - @kotlin.internal.IntrinsicConstEvaluation - public inline fun equals(other: Float): Boolean = toBits() == other.toBits() + other is Float && this.toBits() == other.toBits() public override fun hashCode(): Int = toBits() } @@ -2654,8 +2631,5 @@ public class Double private constructor(private val value: Double) : Number(), C public override fun equals(other: Any?): Boolean = other is Double && this.toBits() == other.toBits() - @kotlin.internal.IntrinsicConstEvaluation - public inline fun equals(other: Double): Boolean = toBits() == other.toBits() - public override fun hashCode(): Int = toBits().hashCode() }