From e1b168d77c26809af049f3c8cd2f15dadacf1a86 Mon Sep 17 00:00:00 2001 From: Alexander Shabalin Date: Mon, 3 Jul 2023 11:46:31 +0200 Subject: [PATCH] [K/N] Fix performance build --- .../src/main/kotlin/org/jetbrains/ring/BunnymarkBenchmark.kt | 2 ++ .../ring/src/main/kotlin/org/jetbrains/ring/LifeBenchmark.kt | 1 + .../ring/src/main/kotlin/org/jetbrains/ring/WeakRefBenchmark.kt | 2 ++ .../common/org/jetbrains/benchmarksLauncher/Utils.kt | 1 + 4 files changed, 6 insertions(+) diff --git a/kotlin-native/performance/ring/src/main/kotlin/org/jetbrains/ring/BunnymarkBenchmark.kt b/kotlin-native/performance/ring/src/main/kotlin/org/jetbrains/ring/BunnymarkBenchmark.kt index 05a3a842830..43b2b47d9d1 100644 --- a/kotlin-native/performance/ring/src/main/kotlin/org/jetbrains/ring/BunnymarkBenchmark.kt +++ b/kotlin-native/performance/ring/src/main/kotlin/org/jetbrains/ring/BunnymarkBenchmark.kt @@ -127,7 +127,9 @@ operator fun Float32Buffer.set(index: Int, value: Float): Unit = mbuffer.setFloa fun MemBufferAlloc(size: Int): MemBuffer = MemBuffer(ByteArray(size)) +@OptIn(kotlin.experimental.ExperimentalNativeApi::class) fun MemBuffer.getFloat(index: Int): Float = data.getFloatAt(index) +@OptIn(kotlin.experimental.ExperimentalNativeApi::class) fun MemBuffer.setFloat(index: Int, value: Float): Unit = data.setFloatAt(index, value) fun MemBuffer.asFloat32Buffer(): Float32Buffer = this.sliceFloat32Buffer() diff --git a/kotlin-native/performance/ring/src/main/kotlin/org/jetbrains/ring/LifeBenchmark.kt b/kotlin-native/performance/ring/src/main/kotlin/org/jetbrains/ring/LifeBenchmark.kt index d8c67b48174..8085fddc413 100644 --- a/kotlin-native/performance/ring/src/main/kotlin/org/jetbrains/ring/LifeBenchmark.kt +++ b/kotlin-native/performance/ring/src/main/kotlin/org/jetbrains/ring/LifeBenchmark.kt @@ -25,6 +25,7 @@ class Generation(private val width: Int, private val height: Int) { } } } + @OptIn(kotlin.experimental.ExperimentalNativeApi::class) assert(neighborhood.size == 8) val aliveNeighbours = neighborhood .map { wrapOverEdge(it) } diff --git a/kotlin-native/performance/ring/src/main/kotlin/org/jetbrains/ring/WeakRefBenchmark.kt b/kotlin-native/performance/ring/src/main/kotlin/org/jetbrains/ring/WeakRefBenchmark.kt index b22bee98fd9..62f59a42462 100644 --- a/kotlin-native/performance/ring/src/main/kotlin/org/jetbrains/ring/WeakRefBenchmark.kt +++ b/kotlin-native/performance/ring/src/main/kotlin/org/jetbrains/ring/WeakRefBenchmark.kt @@ -22,11 +22,13 @@ private class Data(var x: Int = Random.nextInt(1000) + 1) private class ReferenceWrapper private constructor( data: Data ) { + @OptIn(kotlin.experimental.ExperimentalNativeApi::class) private val weak = WeakReference(data) private val strong = StableRef.create(data) val value: Int get() { + @OptIn(kotlin.experimental.ExperimentalNativeApi::class) val ref: Data? = weak.value if (ref == null) { return 0 diff --git a/kotlin-native/performance/shared/src/main/kotlin-native/common/org/jetbrains/benchmarksLauncher/Utils.kt b/kotlin-native/performance/shared/src/main/kotlin-native/common/org/jetbrains/benchmarksLauncher/Utils.kt index 69b6f79ecbe..eb192bf9424 100644 --- a/kotlin-native/performance/shared/src/main/kotlin-native/common/org/jetbrains/benchmarksLauncher/Utils.kt +++ b/kotlin-native/performance/shared/src/main/kotlin-native/common/org/jetbrains/benchmarksLauncher/Utils.kt @@ -31,6 +31,7 @@ actual fun writeToFile(fileName: String, text: String) { } // Wrapper for assert funtion in stdlib +@OptIn(kotlin.experimental.ExperimentalNativeApi::class) actual fun assert(value: Boolean) { kotlin.assert(value) }