[Wasm] stdlib NFC: Fix or suppress remaining warnings
This commit is contained in:
@@ -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.
|
* 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("UNUSED_PARAMETER")
|
||||||
|
|
||||||
package kotlin
|
package kotlin
|
||||||
|
|
||||||
import kotlin.wasm.internal.*
|
import kotlin.wasm.internal.*
|
||||||
@@ -56,7 +58,7 @@ public class Boolean private constructor(private val value: Boolean) : Comparabl
|
|||||||
return if (other !is Boolean) {
|
return if (other !is Boolean) {
|
||||||
false
|
false
|
||||||
} else {
|
} else {
|
||||||
this === (other as Boolean)
|
wasm_i32_eq(this.toInt(), other.toInt())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public class Char private constructor(public val value: Char) : Comparable<Char>
|
|||||||
|
|
||||||
public override fun equals(other: Any?): Boolean {
|
public override fun equals(other: Any?): Boolean {
|
||||||
if (other is Char)
|
if (other is Char)
|
||||||
return this === (other as Char)
|
return wasm_i32_eq(this.toInt(), other.toInt())
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,5 +87,5 @@ public inline fun <reified T : Enum<T>> enumValues(): Array<T>
|
|||||||
* Returns an enum entry with specified name.
|
* Returns an enum entry with specified name.
|
||||||
*/
|
*/
|
||||||
@SinceKotlin("1.1")
|
@SinceKotlin("1.1")
|
||||||
@Suppress("NON_MEMBER_FUNCTION_NO_BODY")
|
@Suppress("NON_MEMBER_FUNCTION_NO_BODY", "UNUSED_PARAMETER")
|
||||||
public inline fun <reified T : Enum<T>> enumValueOf(name: String): T
|
public inline fun <reified T : Enum<T>> enumValueOf(name: String): T
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
@file:Suppress(
|
@file:Suppress(
|
||||||
"OVERRIDE_BY_INLINE",
|
"OVERRIDE_BY_INLINE",
|
||||||
"NOTHING_TO_INLINE",
|
"NOTHING_TO_INLINE",
|
||||||
"unused"
|
"unused", "UNUSED_PARAMETER"
|
||||||
)
|
)
|
||||||
|
|
||||||
package kotlin
|
package kotlin
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ public class String internal @WasmPrimitiveConstructor constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
internal inline fun WasmCharArray.createString(): String =
|
internal inline fun WasmCharArray.createString(): String =
|
||||||
String(null, this.len(), this)
|
String(null, this.len(), this)
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ internal fun <T> getContinuation(): Continuation<T> =
|
|||||||
|
|
||||||
@PublishedApi
|
@PublishedApi
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
internal suspend fun <T> returnIfSuspended(@Suppress("UNUSED_PARAMETER") argument: Any?): T =
|
internal suspend fun <T> returnIfSuspended(argument: Any?): T =
|
||||||
argument as T
|
argument as T
|
||||||
|
|
||||||
@PublishedApi
|
@PublishedApi
|
||||||
@@ -33,6 +33,7 @@ internal suspend fun getCoroutineContext(): CoroutineContext = getContinuation<A
|
|||||||
internal suspend fun <T> suspendCoroutineUninterceptedOrReturn(block: (Continuation<T>) -> Any?): T =
|
internal suspend fun <T> suspendCoroutineUninterceptedOrReturn(block: (Continuation<T>) -> Any?): T =
|
||||||
returnIfSuspended<T>(block(getContinuation<T>()))
|
returnIfSuspended<T>(block(getContinuation<T>()))
|
||||||
|
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
@ExcludedFromCodegen
|
@ExcludedFromCodegen
|
||||||
@PublishedApi
|
@PublishedApi
|
||||||
internal fun <T> startCoroutineUninterceptedOrReturnIntrinsic0(
|
internal fun <T> startCoroutineUninterceptedOrReturnIntrinsic0(
|
||||||
@@ -42,6 +43,7 @@ internal fun <T> startCoroutineUninterceptedOrReturnIntrinsic0(
|
|||||||
implementedAsIntrinsic
|
implementedAsIntrinsic
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
@ExcludedFromCodegen
|
@ExcludedFromCodegen
|
||||||
@PublishedApi
|
@PublishedApi
|
||||||
internal fun <R, T> startCoroutineUninterceptedOrReturnIntrinsic1(
|
internal fun <R, T> startCoroutineUninterceptedOrReturnIntrinsic1(
|
||||||
@@ -52,6 +54,7 @@ internal fun <R, T> startCoroutineUninterceptedOrReturnIntrinsic1(
|
|||||||
implementedAsIntrinsic
|
implementedAsIntrinsic
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
@ExcludedFromCodegen
|
@ExcludedFromCodegen
|
||||||
@PublishedApi
|
@PublishedApi
|
||||||
internal fun <R, P, T> startCoroutineUninterceptedOrReturnIntrinsic2(
|
internal fun <R, P, T> startCoroutineUninterceptedOrReturnIntrinsic2(
|
||||||
|
|||||||
@@ -14,11 +14,10 @@ package kotlin.wasm.internal
|
|||||||
throw error;
|
throw error;
|
||||||
}"""
|
}"""
|
||||||
)
|
)
|
||||||
private external fun throwJsError(message: String?, wasmTypeName: String?, stack: String)
|
private external fun throwJsError(message: String?, wasmTypeName: String?, stack: String): Nothing
|
||||||
|
|
||||||
internal fun throwAsJsException(t: Throwable): Nothing {
|
internal fun throwAsJsException(t: Throwable): Nothing {
|
||||||
throwJsError(t.message, t::class.simpleName, t.stackTraceToString())
|
throwJsError(t.message, t::class.simpleName, t.stackTraceToString())
|
||||||
return error("Unreachable")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal var isNotFirstWasmExportCall: Boolean = false
|
internal var isNotFirstWasmExportCall: Boolean = false
|
||||||
@@ -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.
|
* 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("UNUSED_PARAMETER") // File contains many intrinsics
|
||||||
|
|
||||||
package kotlin.wasm.internal
|
package kotlin.wasm.internal
|
||||||
|
|
||||||
internal const val CHAR_SIZE_BYTES = 2
|
internal const val CHAR_SIZE_BYTES = 2
|
||||||
@@ -115,5 +117,6 @@ internal fun stringGetPoolSize(): Int =
|
|||||||
implementedAsIntrinsic
|
implementedAsIntrinsic
|
||||||
|
|
||||||
// This initializer is a special case in FieldInitializersLowering
|
// This initializer is a special case in FieldInitializersLowering
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
@EagerInitialization
|
@EagerInitialization
|
||||||
internal val stringPool: Array<String?> = arrayOfNulls(stringGetPoolSize())
|
internal val stringPool: Array<String?> = arrayOfNulls(stringGetPoolSize())
|
||||||
@@ -51,6 +51,7 @@ internal fun isInterfaceById(obj: Any, interfaceId: Int): Boolean {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
@ExcludedFromCodegen
|
@ExcludedFromCodegen
|
||||||
internal fun <T> wasmIsInterface(obj: Any): Boolean =
|
internal fun <T> wasmIsInterface(obj: Any): Boolean =
|
||||||
implementedAsIntrinsic
|
implementedAsIntrinsic
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@file:ExcludedFromCodegen
|
@file:ExcludedFromCodegen
|
||||||
@file:Suppress("unused", "NON_ABSTRACT_FUNCTION_WITH_NO_BODY", "INLINE_CLASS_IN_EXTERNAL_DECLARATION")
|
@file:Suppress("unused", "NON_ABSTRACT_FUNCTION_WITH_NO_BODY", "INLINE_CLASS_IN_EXTERNAL_DECLARATION", "UNUSED_PARAMETER")
|
||||||
|
|
||||||
|
|
||||||
package kotlin.wasm.internal
|
package kotlin.wasm.internal
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ internal fun Dynamic.getDouble(index: String): Double = dynamicGetDouble(this, i
|
|||||||
@PublishedApi
|
@PublishedApi
|
||||||
internal fun Dynamic.getString(index: String): String? = dynamicGetString(this, index)
|
internal fun Dynamic.getString(index: String): String? = dynamicGetString(this, index)
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
@PublishedApi
|
@PublishedApi
|
||||||
internal fun <T> Dynamic.getAny(index: String): T? = dynamicGetAny(this, index) as T?
|
internal fun <T> Dynamic.getAny(index: String): T? = dynamicGetAny(this, index) as T?
|
||||||
|
|
||||||
@@ -142,6 +143,7 @@ internal fun Dynamic.getDouble(index: Int): Double = dynamicGetDouble(this, inde
|
|||||||
@PublishedApi
|
@PublishedApi
|
||||||
internal fun Dynamic.getString(index: Int): String? = dynamicGetString(this, index.toString())
|
internal fun Dynamic.getString(index: Int): String? = dynamicGetString(this, index.toString())
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
@PublishedApi
|
@PublishedApi
|
||||||
internal fun <T> Dynamic.getAny(index: Int): T? = dynamicGetAny(this, index.toString()) as T?
|
internal fun <T> Dynamic.getAny(index: Int): T? = dynamicGetAny(this, index.toString()) as T?
|
||||||
|
|
||||||
@@ -153,6 +155,7 @@ external interface Dynamic
|
|||||||
/**
|
/**
|
||||||
* Reinterprets this value as a value of the Dynamic type.
|
* Reinterprets this value as a value of the Dynamic type.
|
||||||
*/
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE")
|
||||||
@kotlin.internal.InlineOnly
|
@kotlin.internal.InlineOnly
|
||||||
fun Any.asDynamic(): Dynamic = this as Dynamic
|
fun Any.asDynamic(): Dynamic = this as Dynamic
|
||||||
|
|
||||||
@@ -183,6 +186,8 @@ operator fun Dynamic.set(index: Int, value: Any?) {
|
|||||||
|
|
||||||
@JsFun("(x) => x")
|
@JsFun("(x) => x")
|
||||||
private external fun <T> unsafeCastJs(x: String): Dynamic
|
private external fun <T> unsafeCastJs(x: String): Dynamic
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
fun <T> String.unsafeCast(): T = unsafeCastJs<T>(this) as T
|
fun <T> String.unsafeCast(): T = unsafeCastJs<T>(this) as T
|
||||||
|
|
||||||
@JsFun("(x) => x")
|
@JsFun("(x) => x")
|
||||||
@@ -191,6 +196,7 @@ private external fun <T> unsafeCastJs(x: Boolean): Dynamic
|
|||||||
/**
|
/**
|
||||||
* Reinterprets boolean value as a value of the specified type [T] without any actual type checking.
|
* Reinterprets boolean value as a value of the specified type [T] without any actual type checking.
|
||||||
*/
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
fun <T> Boolean.unsafeCast(): T = unsafeCastJs<T>(this) as T
|
fun <T> Boolean.unsafeCast(): T = unsafeCastJs<T>(this) as T
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -201,6 +207,7 @@ fun <T> Nothing?.unsafeCast(): Dynamic? = null
|
|||||||
/**
|
/**
|
||||||
* Reinterprets Dynamic type value as a value of the specified type [T] without any actual type checking.
|
* Reinterprets Dynamic type value as a value of the specified type [T] without any actual type checking.
|
||||||
*/
|
*/
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
fun <T> Dynamic.unsafeCast(): T = this as T
|
fun <T> Dynamic.unsafeCast(): T = this as T
|
||||||
|
|
||||||
@JsFun("e => { throw e; }")
|
@JsFun("e => { throw e; }")
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ public actual fun Int.rotateRight(bitCount: Int): Int =
|
|||||||
/**
|
/**
|
||||||
* Counts the number of set bits in the binary representation of this [Long] number.
|
* Counts the number of set bits in the binary representation of this [Long] number.
|
||||||
*/
|
*/
|
||||||
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
public actual inline fun Long.countOneBits(): Int =
|
public actual inline fun Long.countOneBits(): Int =
|
||||||
wasm_i64_popcnt(this).toInt()
|
wasm_i64_popcnt(this).toInt()
|
||||||
|
|
||||||
@@ -87,6 +88,7 @@ public actual fun Long.countLeadingZeroBits(): Int = wasm_i64_clz(this).toInt()
|
|||||||
/**
|
/**
|
||||||
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [Long] number.
|
* Counts the number of consecutive least significant bits that are zero in the binary representation of this [Long] number.
|
||||||
*/
|
*/
|
||||||
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
public actual inline fun Long.countTrailingZeroBits(): Int =
|
public actual inline fun Long.countTrailingZeroBits(): Int =
|
||||||
wasm_i64_ctz(this).toInt()
|
wasm_i64_ctz(this).toInt()
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ package kotlin.collections
|
|||||||
@kotlin.internal.InlineOnly
|
@kotlin.internal.InlineOnly
|
||||||
public actual inline fun <T> Collection<T>.toTypedArray(): Array<T> = copyToArray(this)
|
public actual inline fun <T> Collection<T>.toTypedArray(): Array<T> = copyToArray(this)
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
@PublishedApi
|
@PublishedApi
|
||||||
internal fun <T> copyToArray(collection: Collection<T>): Array<T> =
|
internal fun <T> copyToArray(collection: Collection<T>): Array<T> =
|
||||||
if (collection is AbstractCollection<T>)
|
if (collection is AbstractCollection<T>)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ package kotlin.collections
|
|||||||
* Attempts to read _uninitialized_ values from this array work in implementation-dependent manner,
|
* Attempts to read _uninitialized_ values from this array work in implementation-dependent manner,
|
||||||
* either throwing exception or returning some kind of implementation-specific default value.
|
* either throwing exception or returning some kind of implementation-specific default value.
|
||||||
*/
|
*/
|
||||||
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
@PublishedApi
|
@PublishedApi
|
||||||
internal inline fun <E> arrayOfUninitializedElements(size: Int): Array<E> {
|
internal inline fun <E> arrayOfUninitializedElements(size: Int): Array<E> {
|
||||||
require(size >= 0) { "capacity must be non-negative." }
|
require(size >= 0) { "capacity must be non-negative." }
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ package kotlin.js
|
|||||||
* Exposes the JavaScript [Promise object](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise) to Kotlin.
|
* Exposes the JavaScript [Promise object](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise) to Kotlin.
|
||||||
*/
|
*/
|
||||||
public external class Promise<out T>(executor: (resolve: (Dynamic?) -> Unit, reject: (Dynamic) -> Unit) -> Unit) {
|
public external class Promise<out T>(executor: (resolve: (Dynamic?) -> Unit, reject: (Dynamic) -> Unit) -> Unit) {
|
||||||
public open fun then(onFulfilled: (Dynamic?) -> Dynamic?): Promise<Dynamic?>
|
public fun then(onFulfilled: (Dynamic?) -> Dynamic?): Promise<Dynamic?>
|
||||||
public open fun then(onFulfilled: (Dynamic?) -> Dynamic?, onRejected: (Dynamic) -> Dynamic?): Promise<Dynamic?>
|
public fun then(onFulfilled: (Dynamic?) -> Dynamic?, onRejected: (Dynamic) -> Dynamic?): Promise<Dynamic?>
|
||||||
public open fun catch(onRejected: (Dynamic) -> Dynamic?): Promise<Dynamic?>
|
public fun catch(onRejected: (Dynamic) -> Dynamic?): Promise<Dynamic?>
|
||||||
public open fun finally(onFinally: () -> Unit): Promise<Dynamic?>
|
public fun finally(onFinally: () -> Unit): Promise<Dynamic?>
|
||||||
|
|
||||||
public companion object {
|
public companion object {
|
||||||
public fun reject(e: Dynamic): Promise<Dynamic?>
|
public fun reject(e: Dynamic): Promise<Dynamic?>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import kotlin.reflect.wasm.internal.*
|
|||||||
internal fun <T : Any> getKClass(typeInfoData: TypeInfoData): KClass<T> =
|
internal fun <T : Any> getKClass(typeInfoData: TypeInfoData): KClass<T> =
|
||||||
KClassImpl(typeInfoData)
|
KClassImpl(typeInfoData)
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
internal fun <T : Any> getKClassFromExpression(e: T): KClass<T> =
|
internal fun <T : Any> getKClassFromExpression(e: T): KClass<T> =
|
||||||
when (e) {
|
when (e) {
|
||||||
is String -> PrimitiveClasses.stringClass
|
is String -> PrimitiveClasses.stringClass
|
||||||
|
|||||||
@@ -299,9 +299,10 @@ public actual fun CharSequence.repeat(n: Int): String {
|
|||||||
0 -> ""
|
0 -> ""
|
||||||
1 -> this.toString()
|
1 -> this.toString()
|
||||||
else -> {
|
else -> {
|
||||||
|
val sequence = this
|
||||||
buildString(n * length) {
|
buildString(n * length) {
|
||||||
repeat(n) {
|
repeat(n) {
|
||||||
append(this@repeat)
|
append(sequence)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,13 +27,13 @@ internal actual object MonotonicTimeSource : TimeSource.WithComparableMarks {
|
|||||||
if (performance != null) getPerformanceNow(performance) else dateNow()
|
if (performance != null) getPerformanceNow(performance) else dateNow()
|
||||||
|
|
||||||
actual override fun markNow(): ValueTimeMark = ValueTimeMark(read())
|
actual override fun markNow(): ValueTimeMark = ValueTimeMark(read())
|
||||||
actual fun elapsedFrom(timeMark: ValueTimeMark): Duration = (read() - timeMark.reading as Double).milliseconds
|
actual fun elapsedFrom(timeMark: ValueTimeMark): Duration = (read() - timeMark.reading).milliseconds
|
||||||
actual fun adjustReading(timeMark: ValueTimeMark, duration: Duration): ValueTimeMark =
|
actual fun adjustReading(timeMark: ValueTimeMark, duration: Duration): ValueTimeMark =
|
||||||
ValueTimeMark(sumCheckNaN(timeMark.reading as Double + duration.toDouble(DurationUnit.MILLISECONDS)))
|
ValueTimeMark(sumCheckNaN(timeMark.reading + duration.toDouble(DurationUnit.MILLISECONDS)))
|
||||||
|
|
||||||
actual fun differenceBetween(one: ValueTimeMark, another: ValueTimeMark): Duration {
|
actual fun differenceBetween(one: ValueTimeMark, another: ValueTimeMark): Duration {
|
||||||
val ms1 = one.reading as Double
|
val ms1 = one.reading
|
||||||
val ms2 = another.reading as Double
|
val ms2 = another.reading
|
||||||
return if (ms1 == ms2) Duration.ZERO else (ms1 - ms2).milliseconds
|
return if (ms1 == ms2) Duration.ZERO else (ms1 - ms2).milliseconds
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,21 +52,25 @@ public value class Pointer public constructor(public val address: UInt) {
|
|||||||
implementedAsIntrinsic
|
implementedAsIntrinsic
|
||||||
|
|
||||||
/** Store a Byte (8 bit) [value] */
|
/** Store a Byte (8 bit) [value] */
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
@WasmOp(WasmOp.I32_STORE8)
|
@WasmOp(WasmOp.I32_STORE8)
|
||||||
public fun storeByte(value: Byte): Unit =
|
public fun storeByte(value: Byte): Unit =
|
||||||
implementedAsIntrinsic
|
implementedAsIntrinsic
|
||||||
|
|
||||||
/** Store a Short (16 bit) [value] */
|
/** Store a Short (16 bit) [value] */
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
@WasmOp(WasmOp.I32_STORE16)
|
@WasmOp(WasmOp.I32_STORE16)
|
||||||
public fun storeShort(value: Short): Unit =
|
public fun storeShort(value: Short): Unit =
|
||||||
implementedAsIntrinsic
|
implementedAsIntrinsic
|
||||||
|
|
||||||
/** Store an Int (32 bit) [value] */
|
/** Store an Int (32 bit) [value] */
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
@WasmOp(WasmOp.I32_STORE)
|
@WasmOp(WasmOp.I32_STORE)
|
||||||
public fun storeInt(value: Int): Unit =
|
public fun storeInt(value: Int): Unit =
|
||||||
implementedAsIntrinsic
|
implementedAsIntrinsic
|
||||||
|
|
||||||
/** Store a Long (64 bit) [value] */
|
/** Store a Long (64 bit) [value] */
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
@WasmOp(WasmOp.I64_STORE)
|
@WasmOp(WasmOp.I64_STORE)
|
||||||
public fun storeLong(value: Long): Unit =
|
public fun storeLong(value: Long): Unit =
|
||||||
implementedAsIntrinsic
|
implementedAsIntrinsic
|
||||||
|
|||||||
@@ -151,6 +151,7 @@ internal fun wasmMemorySize(): Int =
|
|||||||
* Grow memory by a given delta (in pages).
|
* Grow memory by a given delta (in pages).
|
||||||
* Return the previous size, or -1 if enough memory cannot be allocated.
|
* Return the previous size, or -1 if enough memory cannot be allocated.
|
||||||
*/
|
*/
|
||||||
|
@Suppress("UNUSED_PARAMETER")
|
||||||
@WasmOp(WasmOp.MEMORY_GROW)
|
@WasmOp(WasmOp.MEMORY_GROW)
|
||||||
internal fun wasmMemoryGrow(delta: Int): Int =
|
internal fun wasmMemoryGrow(delta: Int): Int =
|
||||||
implementedAsIntrinsic
|
implementedAsIntrinsic
|
||||||
@@ -13,6 +13,7 @@ public external interface ItemArrayLike<out T> {
|
|||||||
public fun <T> ItemArrayLike<T>.asList(): List<T> = object : AbstractList<T>() {
|
public fun <T> ItemArrayLike<T>.asList(): List<T> = object : AbstractList<T>() {
|
||||||
override val size: Int get() = this@asList.length
|
override val size: Int get() = this@asList.length
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
override fun get(index: Int): T = when (index) {
|
override fun get(index: Int): T = when (index) {
|
||||||
in 0..lastIndex -> this@asList.item(index) as T
|
in 0..lastIndex -> this@asList.item(index) as T
|
||||||
else -> throw IndexOutOfBoundsException("index $index is not in range [0..$lastIndex]")
|
else -> throw IndexOutOfBoundsException("index $index is not in range [0..$lastIndex]")
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ package kotlin.native.concurrent
|
|||||||
internal val Any?.isFrozen
|
internal val Any?.isFrozen
|
||||||
inline get() = false
|
inline get() = false
|
||||||
|
|
||||||
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
internal inline fun <T> T.freeze(): T = this
|
internal inline fun <T> T.freeze(): T = this
|
||||||
|
|
||||||
internal class AtomicReference<T>(public var value: T) {
|
internal class AtomicReference<T>(public var value: T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user