[K/N] Move kotlin.native.internal.GC into kotlin.native.runtime

As a part of efforts to stabilize Native stdlib #KT-55765.
This commit is contained in:
Abduqodiri Qurbonzoda
2023-03-30 23:16:33 +03:00
parent 7a2e2f5f9f
commit e1c91ee50f
46 changed files with 506 additions and 212 deletions
@@ -1,5 +1,6 @@
package org.jetbrains.ring
import kotlin.native.internal.GC
import kotlin.native.runtime.GC
@OptIn(kotlin.native.runtime.NativeRuntimeApi::class)
actual fun cleanup() { GC.collect() }
@@ -5,7 +5,7 @@
package org.jetbrains.ring
import kotlin.native.internal.GC
import kotlin.native.runtime.GC
import kotlin.native.ref.WeakReference
import kotlin.test.assertEquals
import kotlin.test.assertNotEquals
@@ -46,6 +46,7 @@ private fun ReferenceWrapper.stress() = (1..REPEAT_COUNT).sumOf {
this.value
}
@file:OptIn(kotlin.native.runtime.NativeRuntimeApi::class)
open class WeakRefBenchmark {
private val aliveRef = ReferenceWrapper.create()
private val deadRef = ReferenceWrapper.create().apply {
@@ -16,7 +16,7 @@
package org.jetbrains.benchmarksLauncher
import kotlin.native.internal.GC
import kotlin.native.runtime.GC
import platform.posix.*
import kotlinx.cinterop.*
@@ -39,6 +39,7 @@ actual inline fun measureNanoTime(block: () -> Unit): Long {
return kotlin.system.measureNanoTime(block)
}
@OptIn(kotlin.native.runtime.NativeRuntimeApi::class)
actual fun cleanup() {
GC.collect()
}
@@ -2,10 +2,11 @@
* Copyright 2010-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
*/
@file:OptIn(kotlin.native.runtime.NativeRuntimeApi::class)
package org.jetbrains.gc
import kotlin.native.internal.GC
import kotlin.native.runtime.GC
fun collect() = GC.collect()
fun schedule() = GC.schedule()