[K/N] Move kotlin.native.internal.Debugging 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:11:18 +03:00
parent f90b846f86
commit bb8498b0c5
15 changed files with 89 additions and 29 deletions
@@ -7,13 +7,14 @@ package kotlin.native.internal
/*
* Internal utilities for debugging K/N compiler and runtime.
*/
public object Debugging {
public var forceCheckedShutdown: Boolean
get() = Debugging_getForceCheckedShutdown()
set(value) = Debugging_setForceCheckedShutdown(value)
public val isThreadStateRunnable: Boolean
get() = Debugging_isThreadStateRunnable()
@OptIn(kotlin.native.runtime.NativeRuntimeApi::class)
@Deprecated("Use kotlin.native.runtime.Debugging instead.", ReplaceWith("Debugging", "kotlin.native.runtime.Debugging"))
@DeprecatedSinceKotlin(warningSince = "1.9")
public object Debugging {
public var forceCheckedShutdown: Boolean by kotlin.native.runtime.Debugging::forceCheckedShutdown
public val isThreadStateRunnable: Boolean by kotlin.native.runtime.Debugging::isThreadStateRunnable
}
@GCUnsafeCall("Kotlin_Debugging_isPermanent")
@@ -23,12 +24,3 @@ public external fun Any.isPermanent() : Boolean
@GCUnsafeCall("Kotlin_Debugging_isLocal")
@InternalForKotlinNative
public external fun Any.isLocal() : Boolean
@GCUnsafeCall("Kotlin_Debugging_getForceCheckedShutdown")
private external fun Debugging_getForceCheckedShutdown(): Boolean
@GCUnsafeCall("Kotlin_Debugging_setForceCheckedShutdown")
private external fun Debugging_setForceCheckedShutdown(value: Boolean): Unit
@GCUnsafeCall("Kotlin_Debugging_isThreadStateRunnable")
private external fun Debugging_isThreadStateRunnable(): Boolean
@@ -0,0 +1,50 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kotlin.native.runtime
import kotlin.native.internal.GCUnsafeCall
import kotlin.native.internal.InternalForKotlinNative
/**
* __Note__: this API is unstable and may change in any release.
*
* A set of utilities for debugging Kotlin/Native runtime.
*/
@NativeRuntimeApi
@SinceKotlin("1.9")
public object Debugging {
/**
* Run full checked deinitialization on shutdown.
*
* Make sure that after exiting `main()` only a single thread with Kotlin runtime remains.
* Run GC collecting everything including globals.
*
* When enabled together with [Platform.isCleanersLeakCheckerActive] additionally checks that no cleaners get executed after `main()`
*/
public var forceCheckedShutdown: Boolean
get() = Debugging_getForceCheckedShutdown()
set(value) = Debugging_setForceCheckedShutdown(value)
/**
* Whether the current thread's state allows running Kotlin code.
*
* Used by Kotlin/Native internal tests.
* If it returns `false`, it's a bug.
*/
@InternalForKotlinNative
public val isThreadStateRunnable: Boolean
get() = Debugging_isThreadStateRunnable()
}
@GCUnsafeCall("Kotlin_Debugging_getForceCheckedShutdown")
private external fun Debugging_getForceCheckedShutdown(): Boolean
@GCUnsafeCall("Kotlin_Debugging_setForceCheckedShutdown")
private external fun Debugging_setForceCheckedShutdown(value: Boolean): Unit
@GCUnsafeCall("Kotlin_Debugging_isThreadStateRunnable")
private external fun Debugging_isThreadStateRunnable(): Boolean