From deb13257c21ee4a9317ed814ce34cf81387c1cdd Mon Sep 17 00:00:00 2001 From: Alexander Shabalin Date: Wed, 16 Aug 2023 11:08:48 +0200 Subject: [PATCH] [K/N] Make Any.equals simpler --- kotlin-native/runtime/src/main/cpp/Natives.cpp | 5 ----- kotlin-native/runtime/src/main/kotlin/kotlin/Any.kt | 3 +-- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/kotlin-native/runtime/src/main/cpp/Natives.cpp b/kotlin-native/runtime/src/main/cpp/Natives.cpp index 06b836efe01..dbea80ff3cc 100644 --- a/kotlin-native/runtime/src/main/cpp/Natives.cpp +++ b/kotlin-native/runtime/src/main/cpp/Natives.cpp @@ -36,11 +36,6 @@ using namespace kotlin; extern "C" { -// Any.kt -KBoolean Kotlin_Any_equals(KConstRef thiz, KConstRef other) { - return thiz == other; -} - KInt Kotlin_Any_hashCode(KConstRef thiz) { // NOTE: `Any?.identityHashCode()` is used in Blackhole implementations of both kotlinx-benchmark and // K/N's own benchmarks. These usages rely on this being an intrinsic property of the object. diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/Any.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/Any.kt index 94c1568b163..a3791ee21c5 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/Any.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/Any.kt @@ -28,8 +28,7 @@ public open class Any { * * Read more about [equality](https://kotlinlang.org/docs/reference/equality.html) in Kotlin. */ - @GCUnsafeCall("Kotlin_Any_equals") - external public open operator fun equals(other: Any?): Boolean + public open operator fun equals(other: Any?): Boolean = this === other /** * Returns a hash code value for the object. The general contract of `hashCode` is: