Provide publicly visible identity hash code. (#3690)

* Provide publicly visible identity hash code.

* Review feedback.
This commit is contained in:
Nikolay Igotti
2019-12-19 16:46:38 +03:00
committed by GitHub
parent a8d32f6181
commit b472f9c35e
5 changed files with 17 additions and 6 deletions
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.resolve.konan.platform
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.resolve.ImportPath
import org.jetbrains.kotlin.resolve.PlatformConfigurator
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
@@ -16,4 +17,9 @@ object NativePlatformAnalyzerServices : PlatformDependentAnalyzerServices() {
}
override val platformConfigurator: PlatformConfigurator = KonanPlatformConfigurator
override val excludedImports: List<FqName> =
listOf("identityHashCode").map {
FqName("kotlin.native.$it")
}
}
+1 -4
View File
@@ -5,6 +5,7 @@
package kotlin
import kotlin.native.identityHashCode
import kotlin.native.internal.ExportTypeInfo
/**
@@ -47,7 +48,3 @@ public open class Any {
return "$className@$hashCodeStr"
}
}
@PublishedApi
@SymbolName("Kotlin_Any_hashCode")
external internal fun Any.identityHashCode(): Int
@@ -51,4 +51,11 @@ public fun setUnhandledExceptionHook(hook: ReportUnhandledExceptionHook): Report
}
@SymbolName("Kotlin_setUnhandledExceptionHook")
external private fun setUnhandledExceptionHook0(hook: ReportUnhandledExceptionHook): ReportUnhandledExceptionHook?
external private fun setUnhandledExceptionHook0(hook: ReportUnhandledExceptionHook): ReportUnhandledExceptionHook?
/**
* Compute stable wrt potential object relocations by the memory manager identity hash code.
* @return 0 for `null` object, identity hash code otherwise.
*/
@SymbolName("Kotlin_Any_hashCode")
public external fun Any?.identityHashCode(): Int
@@ -6,6 +6,7 @@
package kotlin.native.concurrent
import kotlin.native.internal.ExportForCppRuntime
import kotlin.native.identityHashCode
import kotlin.reflect.KClass
import kotlinx.cinterop.*
@@ -205,4 +205,4 @@ internal fun <T> listOfInternal(vararg elements: T): List<T> {
@PublishedApi
@SymbolName("OnUnhandledException")
external internal fun OnUnhandledException(throwable: Throwable)
external internal fun OnUnhandledException(throwable: Throwable)