[stdlib] Explicit visibility and return types: Native
This commit is contained in:
committed by
Space Team
parent
43fc4ccf40
commit
c77930c1ea
@@ -53,7 +53,7 @@ public final class ByteArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_ByteArray_get")
|
||||
external public operator fun get(index: Int): Byte
|
||||
public external operator fun get(index: Int): Byte
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
@@ -61,10 +61,10 @@ public final class ByteArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_ByteArray_set")
|
||||
external public operator fun set(index: Int, value: Byte): Unit
|
||||
public external operator fun set(index: Int, value: Byte): Unit
|
||||
|
||||
@GCUnsafeCall("Kotlin_ByteArray_getArrayLength")
|
||||
external private fun getArrayLength(): Int
|
||||
private external fun getArrayLength(): Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): ByteIterator {
|
||||
@@ -124,7 +124,7 @@ public final class CharArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_CharArray_get")
|
||||
external public operator fun get(index: Int): Char
|
||||
public external operator fun get(index: Int): Char
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
@@ -132,10 +132,10 @@ public final class CharArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_CharArray_set")
|
||||
external public operator fun set(index: Int, value: Char): Unit
|
||||
public external operator fun set(index: Int, value: Char): Unit
|
||||
|
||||
@GCUnsafeCall("Kotlin_CharArray_getArrayLength")
|
||||
external private fun getArrayLength(): Int
|
||||
private external fun getArrayLength(): Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): kotlin.collections.CharIterator {
|
||||
@@ -195,7 +195,7 @@ public final class ShortArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_ShortArray_get")
|
||||
external public operator fun get(index: Int): Short
|
||||
public external operator fun get(index: Int): Short
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
@@ -203,10 +203,10 @@ public final class ShortArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_ShortArray_set")
|
||||
external public operator fun set(index: Int, value: Short): Unit
|
||||
public external operator fun set(index: Int, value: Short): Unit
|
||||
|
||||
@GCUnsafeCall("Kotlin_ShortArray_getArrayLength")
|
||||
external private fun getArrayLength(): Int
|
||||
private external fun getArrayLength(): Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): kotlin.collections.ShortIterator {
|
||||
@@ -266,7 +266,7 @@ public final class IntArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_IntArray_get")
|
||||
external public operator fun get(index: Int): Int
|
||||
public external operator fun get(index: Int): Int
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
@@ -274,10 +274,10 @@ public final class IntArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_IntArray_set")
|
||||
external public operator fun set(index: Int, value: Int): Unit
|
||||
public external operator fun set(index: Int, value: Int): Unit
|
||||
|
||||
@GCUnsafeCall("Kotlin_IntArray_getArrayLength")
|
||||
external private fun getArrayLength(): Int
|
||||
private external fun getArrayLength(): Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): kotlin.collections.IntIterator {
|
||||
@@ -337,7 +337,7 @@ public final class LongArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_LongArray_get")
|
||||
external public operator fun get(index: Int): Long
|
||||
public external operator fun get(index: Int): Long
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
@@ -345,10 +345,10 @@ public final class LongArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_LongArray_set")
|
||||
external public operator fun set(index: Int, value: Long): Unit
|
||||
public external operator fun set(index: Int, value: Long): Unit
|
||||
|
||||
@GCUnsafeCall("Kotlin_LongArray_getArrayLength")
|
||||
external private fun getArrayLength(): Int
|
||||
private external fun getArrayLength(): Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): kotlin.collections.LongIterator {
|
||||
@@ -408,7 +408,7 @@ public final class FloatArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_FloatArray_get")
|
||||
external public operator fun get(index: Int): Float
|
||||
public external operator fun get(index: Int): Float
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
@@ -416,10 +416,10 @@ public final class FloatArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_FloatArray_set")
|
||||
external public operator fun set(index: Int, value: Float): Unit
|
||||
public external operator fun set(index: Int, value: Float): Unit
|
||||
|
||||
@GCUnsafeCall("Kotlin_FloatArray_getArrayLength")
|
||||
external private fun getArrayLength(): Int
|
||||
private external fun getArrayLength(): Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): kotlin.collections.FloatIterator {
|
||||
@@ -479,7 +479,7 @@ public final class DoubleArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_DoubleArray_get")
|
||||
external public operator fun get(index: Int): Double
|
||||
public external operator fun get(index: Int): Double
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
@@ -487,10 +487,10 @@ public final class DoubleArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_DoubleArray_set")
|
||||
external public operator fun set(index: Int, value: Double): Unit
|
||||
public external operator fun set(index: Int, value: Double): Unit
|
||||
|
||||
@GCUnsafeCall("Kotlin_DoubleArray_getArrayLength")
|
||||
external private fun getArrayLength(): Int
|
||||
private external fun getArrayLength(): Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): kotlin.collections.DoubleIterator {
|
||||
@@ -550,7 +550,7 @@ public final class BooleanArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_BooleanArray_get")
|
||||
external public operator fun get(index: Int): Boolean
|
||||
public external operator fun get(index: Int): Boolean
|
||||
|
||||
/**
|
||||
* Sets the element at the given [index] to the given [value]. This method can be called using the index operator.
|
||||
@@ -558,10 +558,10 @@ public final class BooleanArray {
|
||||
* If the [index] is out of bounds of this array, throws an [IndexOutOfBoundsException].
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_BooleanArray_set")
|
||||
external public operator fun set(index: Int, value: Boolean): Unit
|
||||
public external operator fun set(index: Int, value: Boolean): Unit
|
||||
|
||||
@GCUnsafeCall("Kotlin_BooleanArray_getArrayLength")
|
||||
external private fun getArrayLength(): Int
|
||||
private external fun getArrayLength(): Int
|
||||
|
||||
/** Creates an iterator over the elements of the array. */
|
||||
public operator fun iterator(): kotlin.collections.BooleanIterator {
|
||||
@@ -599,52 +599,52 @@ public inline fun <T> arrayOfNulls(size: Int): Array<T?> =
|
||||
public external inline fun <T> arrayOf(vararg elements: T): Array<T>
|
||||
|
||||
@GCUnsafeCall("Kotlin_emptyArray")
|
||||
external public fun <T> emptyArray(): Array<T>
|
||||
public external fun <T> emptyArray(): Array<T>
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified [Double] numbers.
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public inline fun doubleArrayOf(vararg elements: Double) = elements
|
||||
public inline fun doubleArrayOf(vararg elements: Double): DoubleArray = elements
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified [Float] numbers.
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public inline fun floatArrayOf(vararg elements: Float) = elements
|
||||
public inline fun floatArrayOf(vararg elements: Float): FloatArray = elements
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified [Long] numbers.
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public inline fun longArrayOf(vararg elements: Long) = elements
|
||||
public inline fun longArrayOf(vararg elements: Long): LongArray = elements
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified [Int] numbers.
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public inline fun intArrayOf(vararg elements: Int) = elements
|
||||
public inline fun intArrayOf(vararg elements: Int): IntArray = elements
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified characters.
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public inline fun charArrayOf(vararg elements: Char) = elements
|
||||
public inline fun charArrayOf(vararg elements: Char): CharArray = elements
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified [Short] numbers.
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public inline fun shortArrayOf(vararg elements: Short) = elements
|
||||
public inline fun shortArrayOf(vararg elements: Short): ShortArray = elements
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified [Byte] numbers.
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public inline fun byteArrayOf(vararg elements: Byte) = elements
|
||||
public inline fun byteArrayOf(vararg elements: Byte): ByteArray = elements
|
||||
|
||||
/**
|
||||
* Returns an array containing the specified boolean values.
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
public inline fun booleanArrayOf(vararg elements: Boolean) = elements
|
||||
public inline fun booleanArrayOf(vararg elements: Boolean): BooleanArray = elements
|
||||
|
||||
@@ -7,105 +7,105 @@ package kotlin
|
||||
|
||||
public actual open class Error : Throwable {
|
||||
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
|
||||
actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
|
||||
actual constructor(cause: Throwable?) : super(cause)
|
||||
public actual constructor(cause: Throwable?) : super(cause)
|
||||
}
|
||||
|
||||
public actual open class Exception : Throwable {
|
||||
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
|
||||
actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
|
||||
actual constructor(cause: Throwable?) : super(cause)
|
||||
public actual constructor(cause: Throwable?) : super(cause)
|
||||
}
|
||||
|
||||
public actual open class RuntimeException : Exception {
|
||||
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
|
||||
actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
|
||||
actual constructor(cause: Throwable?) : super(cause)
|
||||
public actual constructor(cause: Throwable?) : super(cause)
|
||||
}
|
||||
|
||||
public actual open class NullPointerException : RuntimeException {
|
||||
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
}
|
||||
|
||||
public actual open class NoSuchElementException : RuntimeException {
|
||||
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
}
|
||||
|
||||
public actual open class IllegalArgumentException : RuntimeException {
|
||||
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
|
||||
actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
|
||||
actual constructor(cause: Throwable?) : super(cause)
|
||||
public actual constructor(cause: Throwable?) : super(cause)
|
||||
}
|
||||
|
||||
public actual open class IllegalStateException : RuntimeException {
|
||||
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
|
||||
actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
|
||||
actual constructor(cause: Throwable?) : super(cause)
|
||||
public actual constructor(cause: Throwable?) : super(cause)
|
||||
}
|
||||
|
||||
public actual open class UnsupportedOperationException : RuntimeException {
|
||||
|
||||
actual constructor()
|
||||
public actual constructor()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
|
||||
actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
|
||||
actual constructor(cause: Throwable?) : super(cause)
|
||||
public actual constructor(cause: Throwable?) : super(cause)
|
||||
}
|
||||
|
||||
public actual open class IndexOutOfBoundsException : RuntimeException {
|
||||
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
}
|
||||
|
||||
@Deprecated("Use IndexOutOfBoundsException instead.")
|
||||
@DeprecatedSinceKotlin(warningSince = "1.9")
|
||||
public open class ArrayIndexOutOfBoundsException : IndexOutOfBoundsException {
|
||||
|
||||
constructor() : super()
|
||||
public constructor() : super()
|
||||
|
||||
constructor(message: String?) : super(message)
|
||||
public constructor(message: String?) : super(message)
|
||||
}
|
||||
|
||||
public actual open class ClassCastException : RuntimeException {
|
||||
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
}
|
||||
|
||||
@PublishedApi
|
||||
@@ -117,21 +117,21 @@ internal open class TypeCastException : ClassCastException {
|
||||
}
|
||||
|
||||
public actual open class ArithmeticException : RuntimeException {
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
}
|
||||
|
||||
public actual open class AssertionError : Error {
|
||||
|
||||
actual constructor()
|
||||
public actual constructor()
|
||||
|
||||
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
|
||||
constructor(cause: Throwable?) : super(cause)
|
||||
public constructor(cause: Throwable?) : super(cause)
|
||||
|
||||
actual constructor(message: Any?) : super(message?.toString(), message as? Throwable)
|
||||
public actual constructor(message: Any?) : super(message?.toString(), message as? Throwable)
|
||||
|
||||
actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public actual constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
}
|
||||
|
||||
@Suppress("ACTUAL_WITHOUT_EXPECT")
|
||||
@@ -160,24 +160,24 @@ internal actual open class UninitializedPropertyAccessException : RuntimeExcepti
|
||||
|
||||
public open class OutOfMemoryError : Error {
|
||||
|
||||
constructor() : super()
|
||||
public constructor() : super()
|
||||
|
||||
constructor(message: String?) : super(message)
|
||||
public constructor(message: String?) : super(message)
|
||||
}
|
||||
|
||||
public actual open class NumberFormatException : IllegalArgumentException {
|
||||
|
||||
actual constructor() : super()
|
||||
public actual constructor() : super()
|
||||
|
||||
actual constructor(message: String?) : super(message)
|
||||
public actual constructor(message: String?) : super(message)
|
||||
}
|
||||
|
||||
public actual open class ConcurrentModificationException actual constructor(message: String?, cause: Throwable?) :
|
||||
RuntimeException(message, cause) {
|
||||
|
||||
actual constructor() : this(null, null)
|
||||
public actual constructor() : this(null, null)
|
||||
|
||||
actual constructor(message: String?) : this(message, null)
|
||||
public actual constructor(message: String?) : this(message, null)
|
||||
|
||||
actual constructor(cause: Throwable?) : this(null, cause)
|
||||
public actual constructor(cause: Throwable?) : this(null, cause)
|
||||
}
|
||||
@@ -68,4 +68,4 @@ public inline operator fun kotlin.String?.plus(other: kotlin.Any?): kotlin.Strin
|
||||
(this?.toString() ?: "null").plus(other?.toString() ?: "null")
|
||||
|
||||
|
||||
public inline fun Any?.toString() = this?.toString() ?: "null"
|
||||
public inline fun Any?.toString(): String = this?.toString() ?: "null"
|
||||
@@ -23,13 +23,13 @@ import kotlinx.cinterop.ExperimentalForeignApi
|
||||
*/
|
||||
@ExportTypeInfo("theThrowableTypeInfo")
|
||||
@OptIn(FreezingIsDeprecated::class)
|
||||
public open class Throwable(open val message: String?, open val cause: Throwable?) {
|
||||
public open class Throwable(public open val message: String?, public open val cause: Throwable?) {
|
||||
|
||||
constructor(message: String?) : this(message, null)
|
||||
public constructor(message: String?) : this(message, null)
|
||||
|
||||
constructor(cause: Throwable?) : this(cause?.toString(), cause)
|
||||
public constructor(cause: Throwable?) : this(cause?.toString(), cause)
|
||||
|
||||
constructor() : this(null, null)
|
||||
public constructor() : this(null, null)
|
||||
|
||||
@get:ExportForCppRuntime("Kotlin_Throwable_getStackTrace")
|
||||
private val stackTrace: NativePtrArray = getCurrentStackTrace()
|
||||
|
||||
@@ -12,5 +12,5 @@ import kotlin.native.internal.ExportTypeInfo
|
||||
*/
|
||||
@ExportTypeInfo("theUnitTypeInfo")
|
||||
public object Unit {
|
||||
override fun toString() = "kotlin.Unit"
|
||||
override fun toString(): String = "kotlin.Unit"
|
||||
}
|
||||
+4
-4
@@ -7,8 +7,8 @@ package kotlin.coroutines.cancellation
|
||||
|
||||
@SinceKotlin("1.4")
|
||||
public actual open class CancellationException : IllegalStateException {
|
||||
actual constructor() : super()
|
||||
actual constructor(message: String?) : super(message)
|
||||
constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
constructor(cause: Throwable?) : super(cause)
|
||||
public actual constructor() : super()
|
||||
public actual constructor(message: String?) : super(message)
|
||||
public constructor(message: String?, cause: Throwable?) : super(message, cause)
|
||||
public constructor(cause: Throwable?) : super(cause)
|
||||
}
|
||||
|
||||
+1
-1
@@ -294,7 +294,7 @@ internal inline fun createContinuationArgumentFromCallback(
|
||||
}
|
||||
|
||||
@PublishedApi
|
||||
internal fun <T> wrapWithContinuationImpl(completion: Continuation<T>) =
|
||||
internal fun <T> wrapWithContinuationImpl(completion: Continuation<T>): Continuation<T> =
|
||||
createSimpleCoroutineForSuspendFunction(probeCoroutineCreated(completion))
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,7 +15,7 @@ package kotlin.native
|
||||
public class BitSet(size: Int = ELEMENT_SIZE) {
|
||||
|
||||
@kotlin.native.internal.CanBePrecreated
|
||||
companion object {
|
||||
public companion object {
|
||||
// Default size of one element in the array used to store bits.
|
||||
private const val ELEMENT_SIZE = 64
|
||||
private const val MAX_BIT_OFFSET = ELEMENT_SIZE - 1
|
||||
@@ -29,21 +29,21 @@ public class BitSet(size: Int = ELEMENT_SIZE) {
|
||||
get() = size - 1
|
||||
|
||||
/** Returns an index of the last bit that has `true` value. Returns -1 if the set is empty. */
|
||||
val lastTrueIndex: Int
|
||||
public val lastTrueIndex: Int
|
||||
get() = previousSetBit(size)
|
||||
|
||||
/** True if this BitSet contains no bits set to true. */
|
||||
val isEmpty: Boolean
|
||||
public val isEmpty: Boolean
|
||||
get() = bits.all { it == ALL_FALSE }
|
||||
|
||||
/** Actual number of bits available in the set. All bits with indices >= size assumed to be 0 */
|
||||
var size: Int = size
|
||||
public var size: Int = size
|
||||
private set
|
||||
|
||||
/**
|
||||
* Creates a bit set of given [length] filling elements using [initializer]
|
||||
*/
|
||||
constructor(length: Int, initializer: (Int) -> Boolean): this(length) {
|
||||
public constructor(length: Int, initializer: (Int) -> Boolean): this(length) {
|
||||
for (i in 0 until length) {
|
||||
set(i, initializer(i))
|
||||
}
|
||||
@@ -135,17 +135,17 @@ public class BitSet(size: Int = ELEMENT_SIZE) {
|
||||
}
|
||||
|
||||
/** Set the bit specified to the specified value. */
|
||||
fun set(index: Int, value: Boolean = true) {
|
||||
public fun set(index: Int, value: Boolean = true) {
|
||||
ensureCapacity(index)
|
||||
val (elementIndex, offset) = index.asBitCoordinates
|
||||
setBitsWithMask(elementIndex, offset.asMask, value)
|
||||
}
|
||||
|
||||
/** Sets the bits with indices between [from] (inclusive) and [to] (exclusive) to the specified value. */
|
||||
fun set(from : Int, to: Int, value: Boolean = true) = set(from until to, value)
|
||||
public fun set(from : Int, to: Int, value: Boolean = true): Unit = set(from until to, value)
|
||||
|
||||
/** Sets the bits from the range specified to the specified value. */
|
||||
fun set(range: IntRange, value: Boolean = true) {
|
||||
public fun set(range: IntRange, value: Boolean = true) {
|
||||
if (range.start < 0 || range.endInclusive < 0) {
|
||||
throw IndexOutOfBoundsException()
|
||||
}
|
||||
@@ -172,31 +172,31 @@ public class BitSet(size: Int = ELEMENT_SIZE) {
|
||||
|
||||
|
||||
/** Clears the bit specified */
|
||||
fun clear(index: Int) = set(index, false)
|
||||
public fun clear(index: Int): Unit = set(index, false)
|
||||
/** Clears the bits with indices between [from] (inclusive) and [to] (exclusive) to the specified value. */
|
||||
fun clear(from : Int, to: Int) = set(from, to, false)
|
||||
public fun clear(from : Int, to: Int): Unit = set(from, to, false)
|
||||
/** Clears the bit specified */
|
||||
fun clear(range: IntRange) = set(range, false)
|
||||
public fun clear(range: IntRange): Unit = set(range, false)
|
||||
|
||||
/** Sets all bits in the BitSet to `false`. */
|
||||
fun clear() {
|
||||
public fun clear() {
|
||||
for (i in bits.indices) {
|
||||
bits[i] = ALL_FALSE
|
||||
}
|
||||
}
|
||||
|
||||
/** Reverses the bit specified. */
|
||||
fun flip(index: Int) {
|
||||
public fun flip(index: Int) {
|
||||
ensureCapacity(index)
|
||||
val (elementIndex, offset) = index.asBitCoordinates
|
||||
flipBitsWithMask(elementIndex, offset.asMask)
|
||||
}
|
||||
|
||||
/** Reverses the bits with indices between [from] (inclusive) and [to] (exclusive). */
|
||||
fun flip(from: Int, to: Int) = flip(from until to)
|
||||
public fun flip(from: Int, to: Int): Unit = flip(from until to)
|
||||
|
||||
/** Reverses the bits from the range specified. */
|
||||
fun flip(range: IntRange) {
|
||||
public fun flip(range: IntRange) {
|
||||
if (range.start < 0 || range.endInclusive < 0) {
|
||||
throw IndexOutOfBoundsException()
|
||||
}
|
||||
@@ -262,7 +262,7 @@ public class BitSet(size: Int = ELEMENT_SIZE) {
|
||||
* Returns -1 if there is no such bits after [startIndex].
|
||||
* @throws IndexOutOfBoundException if [startIndex] < 0.
|
||||
*/
|
||||
fun nextSetBit(startIndex: Int = 0): Int = nextBit(startIndex, true)
|
||||
public fun nextSetBit(startIndex: Int = 0): Int = nextBit(startIndex, true)
|
||||
|
||||
/**
|
||||
* Returns an index of a next bit which value is `false` after [startIndex] (inclusive).
|
||||
@@ -270,14 +270,14 @@ public class BitSet(size: Int = ELEMENT_SIZE) {
|
||||
* sequence of `false` bits after (size - 1)-th.
|
||||
* @throws IndexOutOfBoundException if [startIndex] < 0.
|
||||
*/
|
||||
fun nextClearBit(startIndex: Int = 0): Int = nextBit(startIndex, false)
|
||||
public fun nextClearBit(startIndex: Int = 0): Int = nextBit(startIndex, false)
|
||||
|
||||
/**
|
||||
* Returns the biggest index of a bit which value is [lookFor] before [startIndex] (inclusive).
|
||||
* Returns -1 if there is no such bits before [startIndex].
|
||||
* If [startIndex] >= [size] returns -1
|
||||
*/
|
||||
fun previousBit(startIndex: Int, lookFor: Boolean): Int {
|
||||
public fun previousBit(startIndex: Int, lookFor: Boolean): Int {
|
||||
var correctStartIndex = startIndex
|
||||
if (startIndex >= size) {
|
||||
// We assume that all bits after `size - 1` are 0. So we can return the start index if we are looking for 0.
|
||||
@@ -323,7 +323,7 @@ public class BitSet(size: Int = ELEMENT_SIZE) {
|
||||
* If [startIndex] >= size will search from (size - 1)-th bit.
|
||||
* @throws IndexOutOfBoundException if [startIndex] < -1.
|
||||
*/
|
||||
fun previousSetBit(startIndex: Int): Int = previousBit(startIndex, true)
|
||||
public fun previousSetBit(startIndex: Int): Int = previousBit(startIndex, true)
|
||||
|
||||
/**
|
||||
* Returns the biggest index of a bit which value is `false` before [startIndex] (inclusive).
|
||||
@@ -332,10 +332,10 @@ public class BitSet(size: Int = ELEMENT_SIZE) {
|
||||
* sequence of `false` bits after (size - 1)-th.
|
||||
* @throws IndexOutOfBoundException if [startIndex] < -1.
|
||||
*/
|
||||
fun previousClearBit(startIndex: Int): Int = previousBit(startIndex, false)
|
||||
public fun previousClearBit(startIndex: Int): Int = previousBit(startIndex, false)
|
||||
|
||||
/** Returns a value of a bit with the [index] specified. */
|
||||
operator fun get(index: Int): Boolean {
|
||||
public operator fun get(index: Int): Boolean {
|
||||
if (index < 0) {
|
||||
throw IndexOutOfBoundsException()
|
||||
}
|
||||
@@ -360,16 +360,16 @@ public class BitSet(size: Int = ELEMENT_SIZE) {
|
||||
}
|
||||
|
||||
/** Performs a logical and operation over corresponding bits of this and [another] BitSets. The result is saved in this BitSet. */
|
||||
fun and(another: BitSet) = doOperation(another, Long::and)
|
||||
public fun and(another: BitSet): Unit = doOperation(another, Long::and)
|
||||
|
||||
/** Performs a logical or operation over corresponding bits of this and [another] BitSets. The result is saved in this BitSet. */
|
||||
fun or(another: BitSet) = doOperation(another, Long::or)
|
||||
public fun or(another: BitSet): Unit = doOperation(another, Long::or)
|
||||
|
||||
/** Performs a logical xor operation over corresponding bits of this and [another] BitSets. The result is saved in this BitSet. */
|
||||
fun xor(another: BitSet) = doOperation(another, Long::xor)
|
||||
public fun xor(another: BitSet): Unit = doOperation(another, Long::xor)
|
||||
|
||||
/** Performs a logical and + not operations over corresponding bits of this and [another] BitSets. The result is saved in this BitSet. */
|
||||
fun andNot(another: BitSet) {
|
||||
public fun andNot(another: BitSet) {
|
||||
ensureCapacity(another.lastIndex)
|
||||
var index = 0
|
||||
while (index < another.bits.size) {
|
||||
@@ -383,7 +383,7 @@ public class BitSet(size: Int = ELEMENT_SIZE) {
|
||||
}
|
||||
|
||||
/** Returns true if the specified BitSet has any bits set to true that are also set to true in this BitSet. */
|
||||
fun intersects(another: BitSet): Boolean =
|
||||
public fun intersects(another: BitSet): Boolean =
|
||||
(0 until minOf(bits.size, another.bits.size)).any { bits[it] and another.bits[it] != 0L }
|
||||
|
||||
override fun toString(): String {
|
||||
|
||||
@@ -29,7 +29,7 @@ public enum class OsFamily {
|
||||
* Central Processor Unit architecture.
|
||||
*/
|
||||
@ExperimentalNativeApi
|
||||
public enum class CpuArchitecture(val bitness: Int) {
|
||||
public enum class CpuArchitecture(public val bitness: Int) {
|
||||
UNKNOWN(-1),
|
||||
ARM32(32),
|
||||
ARM64(64),
|
||||
@@ -182,4 +182,4 @@ private external fun Platform_getAvailableProcessors(): Int
|
||||
|
||||
@TypedIntrinsic(IntrinsicType.IS_EXPERIMENTAL_MM)
|
||||
@ExperimentalStdlibApi
|
||||
external fun isExperimentalMM(): Boolean
|
||||
public external fun isExperimentalMM(): Boolean
|
||||
|
||||
@@ -32,9 +32,9 @@ external public fun deinitRuntimeIfNeeded(): Unit
|
||||
*/
|
||||
@FreezingIsDeprecated
|
||||
public class IncorrectDereferenceException : RuntimeException {
|
||||
constructor() : super()
|
||||
public constructor() : super()
|
||||
|
||||
constructor(message: String) : super(message)
|
||||
public constructor(message: String) : super(message)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ public class AtomicLong(public @Volatile var value: Long = 0L) {
|
||||
* Atomically decrements the current value by one.
|
||||
*/
|
||||
@Deprecated("Use decrementAndGet() or getAndDecrement() instead.", ReplaceWith("this.decrementAndGet()"), DeprecationLevel.ERROR)
|
||||
fun decrement(): Unit {
|
||||
public fun decrement(): Unit {
|
||||
addAndGet(-1L)
|
||||
}
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ public class Continuation2<T1, T2>(
|
||||
}
|
||||
}
|
||||
|
||||
fun dispose() {
|
||||
public fun dispose() {
|
||||
assert(!singleShot)
|
||||
stable.dispose()
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public fun <T> T.freeze(): T {
|
||||
* @return true if given object is null or frozen or permanent
|
||||
*/
|
||||
@FreezingIsDeprecated
|
||||
public val Any?.isFrozen
|
||||
public val Any?.isFrozen: Boolean
|
||||
get() = isFrozenInternal(this)
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,7 @@ import kotlin.native.internal.Frozen
|
||||
* State of the future object.
|
||||
*/
|
||||
@ObsoleteWorkersApi
|
||||
enum class FutureState(val value: Int) {
|
||||
public enum class FutureState(public val value: Int) {
|
||||
INVALID(0),
|
||||
/** Future is scheduled for execution. */
|
||||
SCHEDULED(1),
|
||||
@@ -28,7 +28,7 @@ enum class FutureState(val value: Int) {
|
||||
*/
|
||||
@Suppress("NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS")
|
||||
@ObsoleteWorkersApi
|
||||
public value class Future<T> @PublishedApi internal constructor(val id: Int) {
|
||||
public value class Future<T> @PublishedApi internal constructor(public val id: Int) {
|
||||
/**
|
||||
* Blocks execution until the future is ready.
|
||||
*
|
||||
|
||||
@@ -68,14 +68,14 @@ public class MutableData constructor(capacity: Int = 16) {
|
||||
/**
|
||||
* Reset the data buffer, makings its size 0.
|
||||
*/
|
||||
public fun reset() = locked(lock) {
|
||||
public fun reset(): Unit = locked(lock) {
|
||||
size_ = 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends data to the buffer.
|
||||
*/
|
||||
public fun append(data: MutableData) = locked(lock) {
|
||||
public fun append(data: MutableData): Unit = locked(lock) {
|
||||
val toCopy = data.size
|
||||
val where = resizeDataLocked(size + toCopy)
|
||||
data.copyInto(buffer, 0, toCopy, where)
|
||||
@@ -126,7 +126,7 @@ public class MutableData constructor(capacity: Int = 16) {
|
||||
* Executes provided block under lock with raw pointer to the data stored in the buffer.
|
||||
* Block is executed under the spinlock, and must be short.
|
||||
*/
|
||||
public fun <R> withPointerLocked(block: (COpaquePointer, dataSize: Int) -> R) = locked(lock) {
|
||||
public fun <R> withPointerLocked(block: (COpaquePointer, dataSize: Int) -> R): R = locked(lock) {
|
||||
buffer.usePinned {
|
||||
it -> block(it.addressOf(0), size)
|
||||
}
|
||||
@@ -136,7 +136,7 @@ public class MutableData constructor(capacity: Int = 16) {
|
||||
* Executes provided block under lock with the raw data buffer.
|
||||
* Block is executed under the spinlock, and must be short.
|
||||
*/
|
||||
public fun <R> withBufferLocked(block: (array: ByteArray, dataSize: Int) -> R) = locked(lock) {
|
||||
public fun <R> withBufferLocked(block: (array: ByteArray, dataSize: Int) -> R): R = locked(lock) {
|
||||
block(buffer, size)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ import kotlin.concurrent.AtomicNativePtr
|
||||
*/
|
||||
// Not @FreezingIsDeprecated: every `Worker.execute` uses this.
|
||||
@ObsoleteWorkersApi
|
||||
public enum class TransferMode(val value: Int) {
|
||||
public enum class TransferMode(public val value: Int) {
|
||||
/**
|
||||
* Reachability check is performed.
|
||||
*/
|
||||
@@ -59,7 +59,7 @@ public enum class TransferMode(val value: Int) {
|
||||
@ObsoleteWorkersApi
|
||||
public class DetachedObjectGraph<T> internal constructor(pointer: NativePtr) {
|
||||
@PublishedApi
|
||||
internal val stable = AtomicNativePtr(pointer)
|
||||
internal val stable: AtomicNativePtr = AtomicNativePtr(pointer)
|
||||
|
||||
/**
|
||||
* Creates stable pointer to object, ensuring associated object subgraph is disjoint in specified mode
|
||||
|
||||
@@ -35,8 +35,8 @@ import kotlinx.cinterop.*
|
||||
@Suppress("NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS")
|
||||
@OptIn(FreezingIsDeprecated::class)
|
||||
@ObsoleteWorkersApi
|
||||
public value class Worker @PublishedApi internal constructor(val id: Int) {
|
||||
companion object {
|
||||
public value class Worker @PublishedApi internal constructor(public val id: Int) {
|
||||
public companion object {
|
||||
/**
|
||||
* Start new scheduling primitive, such as thread, to accept new tasks via `execute` interface.
|
||||
* Typically new worker may be needed for computations offload to another core, for IO it may be
|
||||
|
||||
+3
-3
@@ -51,19 +51,19 @@ public class WorkerBoundReference<out T : Any>(value: T) {
|
||||
* The referenced value.
|
||||
* @throws IncorrectDereferenceException if referred object is not frozen and current worker is different from the one created [this].
|
||||
*/
|
||||
val value: T
|
||||
public val value: T
|
||||
get() = valueOrNull ?: throw IncorrectDereferenceException("illegal attempt to access non-shared $valueDescription bound to `$ownerName` from `${Worker.current.name}`")
|
||||
|
||||
/**
|
||||
* The referenced value or null if referred object is not frozen and current worker is different from the one created [this].
|
||||
*/
|
||||
val valueOrNull: T?
|
||||
public val valueOrNull: T?
|
||||
get() = valueBeforeFreezing ?: @Suppress("UNCHECKED_CAST") (derefWorkerBoundReference(ptr) as T?)
|
||||
|
||||
/**
|
||||
* Worker that [value] is bound to.
|
||||
*/
|
||||
val worker: Worker = Worker.current
|
||||
public val worker: Worker = Worker.current
|
||||
|
||||
@ExportForCppRuntime("Kotlin_WorkerBoundReference_freezeHook")
|
||||
private fun freezeHook() {
|
||||
|
||||
@@ -168,7 +168,7 @@ internal annotation class HasFreezeHook
|
||||
@Target(AnnotationTarget.FUNCTION)
|
||||
@Retention(value = AnnotationRetention.BINARY)
|
||||
@InternalForKotlinNative
|
||||
annotation class GCUnsafeCall(val callee: String)
|
||||
public annotation class GCUnsafeCall(val callee: String)
|
||||
|
||||
/**
|
||||
* Marks a declaration that is internal for Kotlin/Native tests and shouldn't be used externally.
|
||||
|
||||
@@ -77,7 +77,7 @@ public interface Cleaner
|
||||
@ExperimentalStdlibApi
|
||||
@ExportForCompiler
|
||||
@OptIn(ExperimentalNativeApi::class, ObsoleteWorkersApi::class)
|
||||
fun <T> createCleaner(argument: T, block: (T) -> Unit): Cleaner =
|
||||
public fun <T> createCleaner(argument: T, block: (T) -> Unit): Cleaner =
|
||||
kotlin.native.ref.createCleanerImpl(argument, block) as Cleaner
|
||||
|
||||
/**
|
||||
@@ -85,7 +85,7 @@ fun <T> createCleaner(argument: T, block: (T) -> Unit): Cleaner =
|
||||
*/
|
||||
@InternalForKotlinNative
|
||||
@OptIn(kotlin.native.runtime.NativeRuntimeApi::class, ObsoleteWorkersApi::class)
|
||||
fun performGCOnCleanerWorker() =
|
||||
public fun performGCOnCleanerWorker(): Unit =
|
||||
getCleanerWorker().execute(TransferMode.SAFE, {}) {
|
||||
GC.collect()
|
||||
}.result
|
||||
@@ -95,14 +95,14 @@ fun performGCOnCleanerWorker() =
|
||||
*/
|
||||
@InternalForKotlinNative
|
||||
@OptIn(ObsoleteWorkersApi::class)
|
||||
fun waitCleanerWorker() =
|
||||
public fun waitCleanerWorker(): Unit =
|
||||
getCleanerWorker().execute(TransferMode.SAFE, {}) {
|
||||
Unit
|
||||
}.result
|
||||
|
||||
@GCUnsafeCall("Kotlin_CleanerImpl_getCleanerWorker")
|
||||
@OptIn(ObsoleteWorkersApi::class)
|
||||
external internal fun getCleanerWorker(): Worker
|
||||
internal external fun getCleanerWorker(): Worker
|
||||
|
||||
@ExportForCppRuntime("Kotlin_CleanerImpl_shutdownCleanerWorker")
|
||||
@OptIn(ObsoleteWorkersApi::class)
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:Suppress("NO_EXPLICIT_VISIBILITY_IN_API_MODE") // Scheduled for eventual removal
|
||||
|
||||
package kotlin.native.internal
|
||||
|
||||
import kotlin.time.*
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
package kotlin.native.internal
|
||||
|
||||
@InternalForKotlinNative
|
||||
object MemoryUsageInfo {
|
||||
public object MemoryUsageInfo {
|
||||
// An estimate of how much memory was committed by the process at its peak.
|
||||
// Resident Set Size in *nix, Working Set Size in Windows.
|
||||
// May return 0 if unimplemented on some platform, or in case of an error.
|
||||
val peakResidentSetSizeBytes: Long
|
||||
public val peakResidentSetSizeBytes: Long
|
||||
get() = MemoryUsageInfo_getPeakResidentSetSizeBytes()
|
||||
}
|
||||
|
||||
|
||||
@@ -14,23 +14,23 @@ import kotlinx.cinterop.*
|
||||
internal external fun getNativeNullPtr(): NativePtr
|
||||
|
||||
@ExperimentalForeignApi
|
||||
class NativePtr @PublishedApi internal constructor(private val value: NonNullNativePtr?) {
|
||||
companion object {
|
||||
public class NativePtr @PublishedApi internal constructor(private val value: NonNullNativePtr?) {
|
||||
public companion object {
|
||||
// TODO: make it properly precreated, maybe use an intrinsic for that.
|
||||
val NULL = getNativeNullPtr()
|
||||
public val NULL: NativePtr = getNativeNullPtr()
|
||||
}
|
||||
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_NATIVE_PTR_PLUS_LONG)
|
||||
external operator fun plus(offset: Long): NativePtr
|
||||
public external operator fun plus(offset: Long): NativePtr
|
||||
|
||||
@TypedIntrinsic(IntrinsicType.INTEROP_NATIVE_PTR_TO_LONG)
|
||||
external fun toLong(): Long
|
||||
public external fun toLong(): Long
|
||||
|
||||
override fun equals(other: Any?) = (other is NativePtr) && kotlin.native.internal.areEqualByValue(this, other)
|
||||
override fun equals(other: Any?): Boolean = (other is NativePtr) && kotlin.native.internal.areEqualByValue(this, other)
|
||||
|
||||
override fun hashCode() = this.toLong().hashCode()
|
||||
override fun hashCode(): Int = this.toLong().hashCode()
|
||||
|
||||
override fun toString() = "0x${this.toLong().toString(16)}"
|
||||
override fun toString(): String = "0x${this.toLong().toString(16)}"
|
||||
|
||||
internal fun isNull(): Boolean = (value == null)
|
||||
}
|
||||
@@ -40,11 +40,11 @@ internal class NonNullNativePtr private constructor() { // TODO: refactor to use
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun toNativePtr() = NativePtr(this)
|
||||
|
||||
override fun toString() = toNativePtr().toString()
|
||||
override fun toString(): String = toNativePtr().toString()
|
||||
|
||||
override fun hashCode() = toNativePtr().hashCode()
|
||||
override fun hashCode(): Int = toNativePtr().hashCode()
|
||||
|
||||
override fun equals(other: Any?) = other is NonNullNativePtr
|
||||
override fun equals(other: Any?): Boolean = other is NonNullNativePtr
|
||||
&& kotlin.native.internal.areEqualByValue(this.toNativePtr(), other.toNativePtr())
|
||||
}
|
||||
|
||||
@@ -52,14 +52,14 @@ internal class NonNullNativePtr private constructor() { // TODO: refactor to use
|
||||
internal class NativePtrArray {
|
||||
|
||||
@GCUnsafeCall("Kotlin_NativePtrArray_get")
|
||||
external public operator fun get(index: Int): NativePtr
|
||||
public external operator fun get(index: Int): NativePtr
|
||||
|
||||
@GCUnsafeCall("Kotlin_NativePtrArray_set")
|
||||
external public operator fun set(index: Int, value: NativePtr): Unit
|
||||
public external operator fun set(index: Int, value: NativePtr): Unit
|
||||
|
||||
val size: Int
|
||||
get() = getArrayLength()
|
||||
|
||||
@GCUnsafeCall("Kotlin_NativePtrArray_getArrayLength")
|
||||
external private fun getArrayLength(): Int
|
||||
private external fun getArrayLength(): Int
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ internal class NSEnumeratorAsKIterator : AbstractIterator<Any?>() {
|
||||
error: Any
|
||||
) = ObjCErrorException(message, error)
|
||||
|
||||
class ObjCErrorException(
|
||||
public class ObjCErrorException(
|
||||
message: String?,
|
||||
internal val error: Any
|
||||
) : Exception(message) {
|
||||
|
||||
@@ -225,10 +225,10 @@ internal external fun initInstance(thiz: Any, constructorCall: Any): Unit
|
||||
internal external fun <T> isSubtype(objTypeInfo: NativePtr): Boolean
|
||||
|
||||
@PublishedApi
|
||||
internal fun checkProgressionStep(step: Int) =
|
||||
internal fun checkProgressionStep(step: Int): Int =
|
||||
if (step > 0) step else throw IllegalArgumentException("Step must be positive, was: $step.")
|
||||
@PublishedApi
|
||||
internal fun checkProgressionStep(step: Long) =
|
||||
internal fun checkProgressionStep(step: Long): Long =
|
||||
if (step > 0) step else throw IllegalArgumentException("Step must be positive, was: $step.")
|
||||
|
||||
@PublishedApi
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
@file:Suppress("NO_EXPLICIT_VISIBILITY_IN_API_MODE") // Scheduled for eventual removal
|
||||
|
||||
package kotlin.native.internal.gc
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,14 +13,14 @@ import kotlin.native.concurrent.*
|
||||
|
||||
// Advanced users may need an access to test suites generated by the compiler to integrate
|
||||
// our test machinery with third party test runners (e.g. with xctestrun).
|
||||
// So we keep this object public but protect it with @ExperimentalStdlibApi
|
||||
// So we keep this object public but protect it with @ExperimentalNativeApi
|
||||
// to stress that it is not a part of the stable API.
|
||||
// Related YT issue: KT-47915.
|
||||
@ExperimentalNativeApi
|
||||
@ThreadLocal
|
||||
public object GeneratedSuites {
|
||||
val suites = mutableListOf<TestSuite>()
|
||||
fun add(suite: TestSuite) = suites.add(suite)
|
||||
public val suites: MutableList<TestSuite> = mutableListOf<TestSuite>()
|
||||
public fun add(suite: TestSuite): Boolean = suites.add(suite)
|
||||
}
|
||||
|
||||
@ExperimentalNativeApi
|
||||
@@ -29,12 +29,12 @@ public fun registerSuite(suite: TestSuite): Unit {
|
||||
}
|
||||
|
||||
@ExperimentalNativeApi
|
||||
fun testLauncherEntryPoint(args: Array<String>): Int {
|
||||
public fun testLauncherEntryPoint(args: Array<String>): Int {
|
||||
return TestRunner(GeneratedSuites.suites, args).run()
|
||||
}
|
||||
|
||||
@ExperimentalNativeApi
|
||||
fun main(args: Array<String>) {
|
||||
public fun main(args: Array<String>) {
|
||||
val exitCode = testLauncherEntryPoint(args)
|
||||
if (exitCode != 0) {
|
||||
exitProcess(exitCode)
|
||||
@@ -44,7 +44,7 @@ fun main(args: Array<String>) {
|
||||
@OptIn(FreezingIsDeprecated::class)
|
||||
@ExperimentalNativeApi
|
||||
@ObsoleteWorkersApi
|
||||
fun worker(args: Array<String>) {
|
||||
public fun worker(args: Array<String>) {
|
||||
val worker = Worker.start()
|
||||
val exitCode = worker.execute(TransferMode.SAFE, { args.freeze() }) {
|
||||
it -> testLauncherEntryPoint(it)
|
||||
@@ -56,6 +56,6 @@ fun worker(args: Array<String>) {
|
||||
}
|
||||
|
||||
@ExperimentalNativeApi
|
||||
fun mainNoExit(args: Array<String>) {
|
||||
public fun mainNoExit(args: Array<String>) {
|
||||
testLauncherEntryPoint(args)
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@ package kotlin.native.internal.test
|
||||
|
||||
import kotlin.experimental.ExperimentalNativeApi
|
||||
import kotlin.IllegalArgumentException
|
||||
import kotlin.system.getTimeMillis
|
||||
import kotlin.system.measureTimeMillis
|
||||
|
||||
/**
|
||||
* Represents a test case, that is a Kotlin test method marked with `@Test` annotaion.
|
||||
@@ -17,38 +15,38 @@ import kotlin.system.measureTimeMillis
|
||||
*/
|
||||
@ExperimentalNativeApi
|
||||
public interface TestCase {
|
||||
val name: String
|
||||
public val name: String
|
||||
|
||||
/**
|
||||
* Shows if this test is ignored by the `@Ignore` annotation.
|
||||
*
|
||||
* @see kotlin.test.Ignore
|
||||
*/
|
||||
val ignored: Boolean
|
||||
public val ignored: Boolean
|
||||
|
||||
/**
|
||||
* Test Suite the test belongs to.
|
||||
*/
|
||||
val suite: TestSuite
|
||||
public val suite: TestSuite
|
||||
|
||||
/**
|
||||
* Runs all methods that were marked with `@BeforeTest` annotation.
|
||||
*
|
||||
* @see kotlin.test.BeforeTest
|
||||
*/
|
||||
fun doBefore()
|
||||
public fun doBefore()
|
||||
|
||||
/**
|
||||
* Runs the test method itself
|
||||
*
|
||||
* @see kotlin.test.Test
|
||||
*/
|
||||
fun doRun()
|
||||
public fun doRun()
|
||||
|
||||
/**
|
||||
* Runs test with its before and after functions.
|
||||
*/
|
||||
fun run() {
|
||||
public fun run() {
|
||||
try {
|
||||
doBefore()
|
||||
doRun()
|
||||
@@ -62,7 +60,7 @@ public interface TestCase {
|
||||
*
|
||||
* @see kotlin.test.AfterTest
|
||||
*/
|
||||
fun doAfter()
|
||||
public fun doAfter()
|
||||
}
|
||||
|
||||
@ExperimentalNativeApi
|
||||
@@ -79,38 +77,38 @@ public interface TestSuite {
|
||||
/**
|
||||
* Test suite name.
|
||||
*/
|
||||
val name: String
|
||||
public val name: String
|
||||
|
||||
/**
|
||||
* Shows if the suite is ignored with `@Ignore` annotation.
|
||||
*
|
||||
* @see kotlin.test.Ignore
|
||||
*/
|
||||
val ignored: Boolean
|
||||
public val ignored: Boolean
|
||||
|
||||
/**
|
||||
* Test cases this test suite contains
|
||||
*/
|
||||
val testCases: Map<String, TestCase>
|
||||
public val testCases: Map<String, TestCase>
|
||||
|
||||
/**
|
||||
* Number of test cases
|
||||
*/
|
||||
val size : Int
|
||||
public val size : Int
|
||||
|
||||
/**
|
||||
* Executes all methods marked with `@BeforeClass` annotation
|
||||
*
|
||||
* @see kotlin.test.BeforeClass
|
||||
*/
|
||||
fun doBeforeClass()
|
||||
public fun doBeforeClass()
|
||||
|
||||
/**
|
||||
* Executes all methods marked with `@AfterClass` annotation
|
||||
*
|
||||
* @see @see kotlin.test.AfterClass
|
||||
*/
|
||||
fun doAfterClass()
|
||||
public fun doAfterClass()
|
||||
}
|
||||
|
||||
@ExperimentalNativeApi
|
||||
@@ -127,10 +125,10 @@ public abstract class AbstractTestSuite<F: Function<Unit>>(override val name: St
|
||||
override fun toString(): String = name
|
||||
|
||||
// TODO: Make inner and remove the type param when the bug is fixed.
|
||||
abstract class BasicTestCase<F: Function<Unit>>(
|
||||
public abstract class BasicTestCase<F: Function<Unit>>(
|
||||
override val name: String,
|
||||
override val suite: AbstractTestSuite<F>,
|
||||
val testFunction: F,
|
||||
public val testFunction: F,
|
||||
override val ignored: Boolean
|
||||
) : TestCase {
|
||||
override fun toString(): String = "$name ($suite)"
|
||||
@@ -142,10 +140,10 @@ public abstract class AbstractTestSuite<F: Function<Unit>>(override val name: St
|
||||
|
||||
private fun registerTestCase(testCase: BasicTestCase<F>) = _testCases.put(testCase.name, testCase)
|
||||
|
||||
fun registerTestCase(name: String, testFunction: F, ignored: Boolean) =
|
||||
public fun registerTestCase(name: String, testFunction: F, ignored: Boolean): BasicTestCase<F>? =
|
||||
registerTestCase(createTestCase(name, testFunction, ignored))
|
||||
|
||||
abstract fun createTestCase(name: String, testFunction: F, ignored: Boolean): BasicTestCase<F>
|
||||
public abstract fun createTestCase(name: String, testFunction: F, ignored: Boolean): BasicTestCase<F>
|
||||
|
||||
init {
|
||||
registerSuite(this)
|
||||
@@ -159,10 +157,10 @@ public abstract class AbstractTestSuite<F: Function<Unit>>(override val name: St
|
||||
public abstract class BaseClassSuite<INSTANCE, COMPANION>(name: String, ignored: Boolean)
|
||||
: AbstractTestSuite<INSTANCE.() -> Unit>(name, ignored) {
|
||||
|
||||
class TestCase<INSTANCE, COMPANION>(name: String,
|
||||
override val suite: BaseClassSuite<INSTANCE, COMPANION>,
|
||||
testFunction: INSTANCE.() -> Unit,
|
||||
ignored: Boolean)
|
||||
public class TestCase<INSTANCE, COMPANION>(name: String,
|
||||
override val suite: BaseClassSuite<INSTANCE, COMPANION>,
|
||||
testFunction: INSTANCE.() -> Unit,
|
||||
ignored: Boolean)
|
||||
: BasicTestCase<INSTANCE.() -> Unit>(name, suite, testFunction, ignored) {
|
||||
|
||||
internal val instance: INSTANCE by lazy { suite.createInstance() }
|
||||
@@ -181,12 +179,12 @@ public abstract class BaseClassSuite<INSTANCE, COMPANION>(name: String, ignored:
|
||||
}
|
||||
|
||||
// These two methods are overridden in test suite classes generated by the compiler.
|
||||
abstract fun createInstance(): INSTANCE
|
||||
open fun getCompanion(): COMPANION = throw NotImplementedError("Test class has no companion object")
|
||||
public abstract fun createInstance(): INSTANCE
|
||||
public open fun getCompanion(): COMPANION = throw NotImplementedError("Test class has no companion object")
|
||||
|
||||
companion object {
|
||||
val INSTANCE_KINDS = listOf(TestFunctionKind.BEFORE_TEST, TestFunctionKind.AFTER_TEST)
|
||||
val COMPANION_KINDS = listOf(TestFunctionKind.BEFORE_CLASS, TestFunctionKind.AFTER_CLASS)
|
||||
public companion object {
|
||||
public val INSTANCE_KINDS: List<TestFunctionKind> = listOf(TestFunctionKind.BEFORE_TEST, TestFunctionKind.AFTER_TEST)
|
||||
public val COMPANION_KINDS: List<TestFunctionKind> = listOf(TestFunctionKind.BEFORE_CLASS, TestFunctionKind.AFTER_CLASS)
|
||||
}
|
||||
|
||||
private val instanceFunctions = mutableMapOf<TestFunctionKind, MutableSet<INSTANCE.() -> Unit>>()
|
||||
@@ -201,22 +199,22 @@ public abstract class BaseClassSuite<INSTANCE, COMPANION>(name: String, ignored:
|
||||
return companionFunction.getOrPut(kind) { mutableSetOf() }
|
||||
}
|
||||
|
||||
val before: Collection<INSTANCE.() -> Unit> get() = getInstanceFunctions(TestFunctionKind.BEFORE_TEST)
|
||||
val after: Collection<INSTANCE.() -> Unit> get() = getInstanceFunctions(TestFunctionKind.AFTER_TEST)
|
||||
public val before: Collection<INSTANCE.() -> Unit> get() = getInstanceFunctions(TestFunctionKind.BEFORE_TEST)
|
||||
public val after: Collection<INSTANCE.() -> Unit> get() = getInstanceFunctions(TestFunctionKind.AFTER_TEST)
|
||||
|
||||
val beforeClass: Collection<COMPANION.() -> Unit> get() = getCompanionFunctions(TestFunctionKind.BEFORE_CLASS)
|
||||
val afterClass: Collection<COMPANION.() -> Unit> get() = getCompanionFunctions(TestFunctionKind.AFTER_CLASS)
|
||||
public val beforeClass: Collection<COMPANION.() -> Unit> get() = getCompanionFunctions(TestFunctionKind.BEFORE_CLASS)
|
||||
public val afterClass: Collection<COMPANION.() -> Unit> get() = getCompanionFunctions(TestFunctionKind.AFTER_CLASS)
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun registerFunction(kind: TestFunctionKind, function: Function1<*, Unit>) =
|
||||
public fun registerFunction(kind: TestFunctionKind, function: Function1<*, Unit>): Boolean =
|
||||
when (kind) {
|
||||
in INSTANCE_KINDS -> getInstanceFunctions(kind).add(function as INSTANCE.() -> Unit)
|
||||
in COMPANION_KINDS -> getCompanionFunctions(kind).add(function as COMPANION.() -> Unit)
|
||||
else -> throw IllegalArgumentException("Unknown function kind: $kind")
|
||||
}
|
||||
|
||||
override fun doBeforeClass() = beforeClass.forEach { getCompanion().it() }
|
||||
override fun doAfterClass() = afterClass.forEach { getCompanion().it() }
|
||||
override fun doBeforeClass(): Unit = beforeClass.forEach { getCompanion().it() }
|
||||
override fun doAfterClass(): Unit = afterClass.forEach { getCompanion().it() }
|
||||
|
||||
override fun createTestCase(name: String, testFunction: INSTANCE.() -> Unit, ignored: Boolean)
|
||||
: BasicTestCase<INSTANCE.() -> Unit> =
|
||||
@@ -228,7 +226,7 @@ private typealias TopLevelFun = () -> Unit
|
||||
@ExperimentalNativeApi
|
||||
public class TopLevelSuite(name: String): AbstractTestSuite<TopLevelFun>(name, false) {
|
||||
|
||||
class TestCase(name: String, override val suite: TopLevelSuite, testFunction: TopLevelFun, ignored: Boolean)
|
||||
public class TestCase(name: String, override val suite: TopLevelSuite, testFunction: TopLevelFun, ignored: Boolean)
|
||||
: BasicTestCase<TopLevelFun>(name, suite, testFunction, ignored) {
|
||||
override fun doBefore() {
|
||||
suite.before.forEach { it() }
|
||||
@@ -246,15 +244,15 @@ public class TopLevelSuite(name: String): AbstractTestSuite<TopLevelFun>(name, f
|
||||
private val specialFunctions = mutableMapOf<TestFunctionKind, MutableSet<TopLevelFun>>()
|
||||
private fun getFunctions(type: TestFunctionKind) = specialFunctions.getOrPut(type) { mutableSetOf() }
|
||||
|
||||
val before: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.BEFORE_TEST)
|
||||
val after: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.AFTER_TEST)
|
||||
val beforeClass: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.BEFORE_CLASS)
|
||||
val afterClass: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.AFTER_CLASS)
|
||||
public val before: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.BEFORE_TEST)
|
||||
public val after: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.AFTER_TEST)
|
||||
public val beforeClass: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.BEFORE_CLASS)
|
||||
public val afterClass: Collection<TopLevelFun> get() = getFunctions(TestFunctionKind.AFTER_CLASS)
|
||||
|
||||
fun registerFunction(kind: TestFunctionKind, function: TopLevelFun) = getFunctions(kind).add(function)
|
||||
public fun registerFunction(kind: TestFunctionKind, function: TopLevelFun): Boolean = getFunctions(kind).add(function)
|
||||
|
||||
override fun doBeforeClass() = beforeClass.forEach { it() }
|
||||
override fun doAfterClass() = afterClass.forEach { it() }
|
||||
override fun doBeforeClass(): Unit = beforeClass.forEach { it() }
|
||||
override fun doAfterClass(): Unit = afterClass.forEach { it() }
|
||||
|
||||
override fun createTestCase(name: String, testFunction: TopLevelFun, ignored: Boolean)
|
||||
: BasicTestCase<TopLevelFun> = TestCase(name, this, testFunction, ignored)
|
||||
|
||||
@@ -18,7 +18,7 @@ public class WeakReference<T : Any> {
|
||||
* Creates a weak reference object pointing to an object. Weak reference doesn't prevent
|
||||
* removing object, and is nullified once object is collected.
|
||||
*/
|
||||
constructor(referred: T) {
|
||||
public constructor(referred: T) {
|
||||
pointer = getWeakReferenceImpl(referred)
|
||||
}
|
||||
|
||||
|
||||
@@ -44,13 +44,13 @@ public object GC {
|
||||
* with [stop] operation. Even if GC is suspended, [collect] still triggers collection.
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_native_internal_GC_collect")
|
||||
external fun collect()
|
||||
public external fun collect()
|
||||
|
||||
/**
|
||||
* Trigger new collection without waiting for its completion.
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_native_internal_GC_schedule")
|
||||
external fun schedule()
|
||||
public external fun schedule()
|
||||
|
||||
/**
|
||||
* Deprecated and unused.
|
||||
@@ -59,7 +59,7 @@ public object GC {
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_native_internal_GC_collectCyclic")
|
||||
@Deprecated("No-op in modern GC implementation")
|
||||
external fun collectCyclic()
|
||||
public external fun collectCyclic()
|
||||
|
||||
/**
|
||||
* Deprecated and unused.
|
||||
@@ -68,7 +68,7 @@ public object GC {
|
||||
* GC algorithm is not executed.
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_native_internal_GC_suspend")
|
||||
external fun suspend()
|
||||
public external fun suspend()
|
||||
|
||||
/**
|
||||
* Deprecated and unused.
|
||||
@@ -77,7 +77,7 @@ public object GC {
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_native_internal_GC_resume")
|
||||
@Deprecated("No-op in modern GC implementation")
|
||||
external fun resume()
|
||||
public external fun resume()
|
||||
|
||||
/**
|
||||
* Deprecated and unused.
|
||||
@@ -86,7 +86,7 @@ public object GC {
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_native_internal_GC_stop")
|
||||
@Deprecated("No-op in modern GC implementation")
|
||||
external fun stop()
|
||||
public external fun stop()
|
||||
|
||||
/**
|
||||
* Deprecated and unused.
|
||||
@@ -96,7 +96,7 @@ public object GC {
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_native_internal_GC_start")
|
||||
@Deprecated("No-op in modern GC implementation")
|
||||
external fun start()
|
||||
public external fun start()
|
||||
|
||||
/**
|
||||
* Deprecated and unused.
|
||||
@@ -109,7 +109,7 @@ public object GC {
|
||||
* @throws [IllegalArgumentException] when value is not positive.
|
||||
*/
|
||||
@Deprecated("No-op in modern GC implementation")
|
||||
var threshold: Int
|
||||
public var threshold: Int
|
||||
get() = getThreshold()
|
||||
set(value) {
|
||||
require(value > 0) { "threshold must be positive: $value" }
|
||||
@@ -127,7 +127,7 @@ public object GC {
|
||||
* @throws [IllegalArgumentException] when value is not positive.
|
||||
*/
|
||||
@Deprecated("No-op in modern GC implementation")
|
||||
var collectCyclesThreshold: Long
|
||||
public var collectCyclesThreshold: Long
|
||||
get() = getCollectCyclesThreshold()
|
||||
set(value) {
|
||||
require(value > 0) { "collectCyclesThreshold must be positive: $value" }
|
||||
@@ -144,7 +144,7 @@ public object GC {
|
||||
*
|
||||
* @throws [IllegalArgumentException] when value is not positive.
|
||||
*/
|
||||
var thresholdAllocations: Long
|
||||
public var thresholdAllocations: Long
|
||||
get() = getThresholdAllocations()
|
||||
set(value) {
|
||||
require(value > 0) { "thresholdAllocations must be positive: $value" }
|
||||
@@ -158,7 +158,7 @@ public object GC {
|
||||
*
|
||||
* Default: true
|
||||
*/
|
||||
var autotune: Boolean
|
||||
public var autotune: Boolean
|
||||
get() = getTuneThreshold()
|
||||
set(value) = setTuneThreshold(value)
|
||||
|
||||
@@ -169,7 +169,7 @@ public object GC {
|
||||
* Legacy MM: If cyclic collector for atomic references to be deployed.
|
||||
*/
|
||||
@Deprecated("No-op in modern GC implementation")
|
||||
var cyclicCollectorEnabled: Boolean
|
||||
public var cyclicCollectorEnabled: Boolean
|
||||
get() = getCyclicCollectorEnabled()
|
||||
set(value) = setCyclicCollectorEnabled(value)
|
||||
|
||||
@@ -184,7 +184,7 @@ public object GC {
|
||||
*
|
||||
* @throws [IllegalArgumentException] when value is negative.
|
||||
*/
|
||||
var regularGCInterval: Duration
|
||||
public var regularGCInterval: Duration
|
||||
get() = getRegularGCIntervalMicroseconds().microseconds
|
||||
set(value) {
|
||||
require(!value.isNegative()) { "regularGCInterval must not be negative: $value" }
|
||||
@@ -207,7 +207,7 @@ public object GC {
|
||||
*
|
||||
* @throws [IllegalArgumentException] when value is negative.
|
||||
*/
|
||||
var targetHeapBytes: Long
|
||||
public var targetHeapBytes: Long
|
||||
get() = getTargetHeapBytes()
|
||||
set(value) {
|
||||
require(value >= 0) { "targetHeapBytes must not be negative: $value" }
|
||||
@@ -224,7 +224,7 @@ public object GC {
|
||||
*
|
||||
* @throws [IllegalArgumentException] when value is outside (0, 1] interval.
|
||||
*/
|
||||
var targetHeapUtilization: Double
|
||||
public var targetHeapUtilization: Double
|
||||
get() = getTargetHeapUtilization()
|
||||
set(value) {
|
||||
require(value > 0 && value <= 1) { "targetHeapUtilization must be in (0, 1] interval: $value" }
|
||||
@@ -241,7 +241,7 @@ public object GC {
|
||||
*
|
||||
* @throws [IllegalArgumentException] when value is negative.
|
||||
*/
|
||||
var minHeapBytes: Long
|
||||
public var minHeapBytes: Long
|
||||
get() = getMinHeapBytes()
|
||||
set(value) {
|
||||
require(value >= 0) { "minHeapBytes must not be negative: $value" }
|
||||
@@ -258,7 +258,7 @@ public object GC {
|
||||
*
|
||||
* @throws [IllegalArgumentException] when value is negative.
|
||||
*/
|
||||
var maxHeapBytes: Long
|
||||
public var maxHeapBytes: Long
|
||||
get() = getMaxHeapBytes()
|
||||
set(value) {
|
||||
require(value >= 0) { "maxHeapBytes must not be negative: $value" }
|
||||
@@ -272,7 +272,7 @@ public object GC {
|
||||
*
|
||||
* @throws [IllegalArgumentException] when value is outside (0, 1] interval.
|
||||
*/
|
||||
var heapTriggerCoefficient: Double
|
||||
public var heapTriggerCoefficient: Double
|
||||
get() = getHeapTriggerCoefficient()
|
||||
set(value) {
|
||||
require(value > 0 && value <= 1) { "heapTriggerCoefficient must be in (0, 1] interval: $value" }
|
||||
@@ -285,7 +285,7 @@ public object GC {
|
||||
*
|
||||
* Default: true, unless [autotune] is false or [maxHeapBytes] is less than [Long.MAX_VALUE].
|
||||
*/
|
||||
var pauseOnTargetHeapOverflow: Boolean
|
||||
public var pauseOnTargetHeapOverflow: Boolean
|
||||
get() = getPauseOnTargetHeapOverflow()
|
||||
set(value) = setPauseOnTargetHeapOverflow(value)
|
||||
|
||||
@@ -298,7 +298,7 @@ public object GC {
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_native_internal_GC_detectCycles")
|
||||
@Deprecated("No-op in modern GC implementation")
|
||||
external fun detectCycles(): Array<Any>?
|
||||
public external fun detectCycles(): Array<Any>?
|
||||
|
||||
/**
|
||||
* Returns statistics of the last finished garbage collection run.
|
||||
@@ -309,7 +309,7 @@ public object GC {
|
||||
* Legacy MM: Always returns null
|
||||
*/
|
||||
@ExperimentalStdlibApi
|
||||
val lastGCInfo: GCInfo?
|
||||
public val lastGCInfo: GCInfo?
|
||||
get() = GCInfo.lastGCInfo
|
||||
|
||||
/**
|
||||
@@ -319,7 +319,7 @@ public object GC {
|
||||
*/
|
||||
@GCUnsafeCall("Kotlin_native_internal_GC_findCycle")
|
||||
@Deprecated("No-op in modern GC implementation")
|
||||
external fun findCycle(root: Any): Array<Any>?
|
||||
public external fun findCycle(root: Any): Array<Any>?
|
||||
|
||||
@GCUnsafeCall("Kotlin_native_internal_GC_getThreshold")
|
||||
private external fun getThreshold(): Int
|
||||
|
||||
@@ -24,7 +24,7 @@ import kotlin.system.*
|
||||
@NativeRuntimeApi
|
||||
@SinceKotlin("1.9")
|
||||
public class MemoryUsage(
|
||||
val totalObjectsSizeBytes: Long,
|
||||
public val totalObjectsSizeBytes: Long,
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -36,8 +36,8 @@ public class MemoryUsage(
|
||||
@NativeRuntimeApi
|
||||
@SinceKotlin("1.9")
|
||||
public class SweepStatistics(
|
||||
val sweptCount: Long,
|
||||
val keptCount: Long,
|
||||
public val sweptCount: Long,
|
||||
public val keptCount: Long,
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -57,10 +57,10 @@ public class SweepStatistics(
|
||||
@NativeRuntimeApi
|
||||
@SinceKotlin("1.9")
|
||||
public class RootSetStatistics(
|
||||
val threadLocalReferences: Long,
|
||||
val stackReferences: Long,
|
||||
val globalReferences: Long,
|
||||
val stableReferences: Long
|
||||
public val threadLocalReferences: Long,
|
||||
public val stackReferences: Long,
|
||||
public val globalReferences: Long,
|
||||
public val stableReferences: Long
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -96,21 +96,21 @@ public class RootSetStatistics(
|
||||
@NativeRuntimeApi
|
||||
@SinceKotlin("1.9")
|
||||
public class GCInfo(
|
||||
val epoch: Long,
|
||||
val startTimeNs: Long,
|
||||
val endTimeNs: Long,
|
||||
val firstPauseRequestTimeNs: Long,
|
||||
val firstPauseStartTimeNs: Long,
|
||||
val firstPauseEndTimeNs: Long,
|
||||
val secondPauseRequestTimeNs: Long?,
|
||||
val secondPauseStartTimeNs: Long?,
|
||||
val secondPauseEndTimeNs: Long?,
|
||||
val postGcCleanupTimeNs: Long?,
|
||||
val rootSet: RootSetStatistics,
|
||||
val markedCount: Long,
|
||||
val sweepStatistics: Map<String, SweepStatistics>,
|
||||
val memoryUsageBefore: Map<String, MemoryUsage>,
|
||||
val memoryUsageAfter: Map<String, MemoryUsage>,
|
||||
public val epoch: Long,
|
||||
public val startTimeNs: Long,
|
||||
public val endTimeNs: Long,
|
||||
public val firstPauseRequestTimeNs: Long,
|
||||
public val firstPauseStartTimeNs: Long,
|
||||
public val firstPauseEndTimeNs: Long,
|
||||
public val secondPauseRequestTimeNs: Long?,
|
||||
public val secondPauseStartTimeNs: Long?,
|
||||
public val secondPauseEndTimeNs: Long?,
|
||||
public val postGcCleanupTimeNs: Long?,
|
||||
public val rootSet: RootSetStatistics,
|
||||
public val markedCount: Long,
|
||||
public val sweepStatistics: Map<String, SweepStatistics>,
|
||||
public val memoryUsageBefore: Map<String, MemoryUsage>,
|
||||
public val memoryUsageAfter: Map<String, MemoryUsage>,
|
||||
) {
|
||||
internal companion object {
|
||||
val lastGCInfo: GCInfo?
|
||||
|
||||
@@ -20,11 +20,11 @@ public typealias Vector128 = kotlinx.cinterop.Vector128
|
||||
@DeprecatedSinceKotlin(warningSince = "1.9")
|
||||
@ExperimentalForeignApi
|
||||
@GCUnsafeCall("Kotlin_Interop_Vector4f_of")
|
||||
external fun vectorOf(f0: Float, f1: Float, f2: Float, f3: Float): Vector128
|
||||
public external fun vectorOf(f0: Float, f1: Float, f2: Float, f3: Float): Vector128
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
@Deprecated("Use kotlinx.cinterop.vectorOf instead.", ReplaceWith("kotlinx.cinterop.vectorOf(f0, f1, f2, f3)"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.9")
|
||||
@ExperimentalForeignApi
|
||||
@GCUnsafeCall("Kotlin_Interop_Vector4i32_of")
|
||||
external fun vectorOf(f0: Int, f1: Int, f2: Int, f3: Int): Vector128
|
||||
public external fun vectorOf(f0: Int, f1: Int, f2: Int, f3: Int): Vector128
|
||||
|
||||
@@ -10,5 +10,5 @@ package kotlin.text
|
||||
*/
|
||||
@SinceKotlin("1.3")
|
||||
public actual open class CharacterCodingException(message: String?) : Exception(message) {
|
||||
actual constructor() : this(null)
|
||||
public actual constructor() : this(null)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user