diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/Platform.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/Platform.kt index 82108258192..7e8712edfe1 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/Platform.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/Platform.kt @@ -4,6 +4,7 @@ */ package kotlin.native +import kotlin.experimental.ExperimentalNativeApi import kotlin.native.internal.GCUnsafeCall import kotlin.native.internal.TypedIntrinsic import kotlin.native.internal.IntrinsicType @@ -11,6 +12,7 @@ import kotlin.native.internal.IntrinsicType /** * Operating system family. */ +@ExperimentalNativeApi public enum class OsFamily { UNKNOWN, MACOSX, @@ -26,6 +28,7 @@ public enum class OsFamily { /** * Central Processor Unit architecture. */ +@ExperimentalNativeApi public enum class CpuArchitecture(val bitness: Int) { UNKNOWN(-1), ARM32(32), @@ -41,6 +44,7 @@ public enum class CpuArchitecture(val bitness: Int) { * Memory model. */ // NOTE: Must match `MemoryModel` in `Memory.h` +@ExperimentalNativeApi public enum class MemoryModel { STRICT, RELAXED, @@ -50,6 +54,7 @@ public enum class MemoryModel { /** * Object describing the current platform program executes upon. */ +@ExperimentalNativeApi public object Platform { /** * Check if current architecture allows unaligned access to wider than byte locations. @@ -125,7 +130,6 @@ public object Platform { * `KOTLIN_NATIVE_AVAILABLE_PROCESSORS` environment variable. When the variable is set and contains a value that is not * positive [Int], [IllegalStateException] will be thrown. */ - @ExperimentalStdlibApi public fun getAvailableProcessors() : Int { val fromEnv = Platform_getAvailableProcessorsEnv() if (fromEnv == null) { diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/MutableData.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/MutableData.kt index 46e3ae1a5d1..2592d7394a2 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/MutableData.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/MutableData.kt @@ -33,6 +33,7 @@ public class MutableData constructor(capacity: Int = 16) { private var buffer_ = ByteArray(capacity).apply { share() } private var buffer: ByteArray + @OptIn(ExperimentalNativeApi::class) get() = when (kotlin.native.Platform.memoryModel) { kotlin.native.MemoryModel.EXPERIMENTAL -> buffer_ diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Worker.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Worker.kt index 1303b52d7b2..55dfd02de4d 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Worker.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/concurrent/Worker.kt @@ -5,6 +5,7 @@ package kotlin.native.concurrent +import kotlin.experimental.ExperimentalNativeApi import kotlin.native.internal.ExportForCppRuntime import kotlin.native.internal.Frozen import kotlin.native.internal.VolatileLambda @@ -137,6 +138,7 @@ public value class Worker @PublishedApi internal constructor(val id: Int) { * @throws [IllegalArgumentException] on negative values of [afterMicroseconds]. * @throws [IllegalStateException] if [operation] parameter is not frozen and worker is not current. */ + @OptIn(ExperimentalNativeApi::class) public fun executeAfter(afterMicroseconds: Long = 0, operation: () -> Unit): Unit { val current = currentInternal() if (Platform.memoryModel != MemoryModel.EXPERIMENTAL && current != id && !operation.isFrozen) throw IllegalStateException("Job for another worker must be frozen")