[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
@@ -2,6 +2,7 @@
* Copyright 2010-2020 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 coroutines
@@ -243,4 +244,4 @@ fun createCoroutineUninterceptedAndResume(fn: suspend () -> Any?, resultHolder:
fun createCoroutineUninterceptedAndResume(fn: suspend Any?.() -> Any?, receiver: Any?, resultHolder: ResultHolder<Any?>) =
fn.createCoroutine(receiver, ResultHolderCompletion(resultHolder)).resume(Unit)
fun gc() = kotlin.native.internal.GC.collect()
fun gc() = kotlin.native.runtime.GC.collect()
@@ -7,7 +7,8 @@ package deallocretain
open class DeallocRetainBase
fun garbageCollect() = kotlin.native.internal.GC.collect()
@OptIn(kotlin.native.runtime.NativeRuntimeApi::class)
fun garbageCollect() = kotlin.native.runtime.GC.collect()
fun createWeakReference(value: Any) = kotlin.native.ref.WeakReference(value)
@@ -19,7 +19,8 @@ class KotlinLivenessTracker {
fun objectsAreDead() = weakRefs.all { it.value === null }
}
fun gc() = kotlin.native.internal.GC.collect()
@OptIn(kotlin.native.runtime.NativeRuntimeApi::class)
fun gc() = kotlin.native.runtime.GC.collect()
class KotlinObject
@@ -5,7 +5,7 @@
// All classes and methods should be used in tests
@file:Suppress("UNUSED")
@file:OptIn(FreezingIsDeprecated::class)
@file:OptIn(FreezingIsDeprecated::class, kotlin.native.runtime.NativeRuntimeApi::class)
package conversions
@@ -807,7 +807,7 @@ open class TestDeprecation() {
@Deprecated("warning", level = DeprecationLevel.WARNING) var warningVar: Any? = null
fun gc() {
kotlin.native.internal.GC.collect()
kotlin.native.runtime.GC.collect()
}
class TestWeakRefs(private val frozen: Boolean) {
@@ -862,7 +862,7 @@ class SharedRefs {
fun createFrozenCollection() = createCollection().freeze()
fun hasAliveObjects(): Boolean {
kotlin.native.internal.GC.collect()
kotlin.native.runtime.GC.collect()
return mustBeRemoved.any { it.get() != null }
}