[Wasm] Replace deprecated cast instructions

This commit is contained in:
Igor Yakovlev
2023-05-12 18:35:24 +02:00
committed by Space Team
parent 45897cf045
commit 6437d0919c
8 changed files with 57 additions and 43 deletions
@@ -159,7 +159,7 @@ internal fun isNullish(ref: ExternalInterfaceType?): Boolean =
* }
* ```
*/
internal fun returnArgumentIfItIsKotlinAny(ref: ExternalInterfaceType): Unit = implementedAsIntrinsic
internal fun returnArgumentIfItIsKotlinAny(): Unit = implementedAsIntrinsic
internal fun externRefToAny(ref: ExternalInterfaceType): Any? {
// TODO rewrite it so to get something like:
@@ -169,7 +169,7 @@ internal fun externRefToAny(ref: ExternalInterfaceType): Any? {
// return
// }
// If ref is an instance of kotlin class -- return it casted to Any
returnArgumentIfItIsKotlinAny(ref)
returnArgumentIfItIsKotlinAny()
// If we have Null in notNullRef -- return null
// If we already have a box -- return it,
@@ -20,11 +20,16 @@ internal fun wasm_unreachable(): Nothing =
implementedAsIntrinsic
@Suppress("REIFIED_TYPE_PARAMETER_NO_INLINE")
internal fun <reified To> wasm_ref_cast_deprecated(a: Any?): To =
internal fun <reified To> wasm_ref_cast_null(a: Any?): To =
implementedAsIntrinsic
@Suppress("REIFIED_TYPE_PARAMETER_NO_INLINE")
internal fun <reified To> wasm_ref_test_deprecated(a: Any?): Boolean =
internal fun <reified To> wasm_ref_test(a: Any?): Boolean =
implementedAsIntrinsic
@Suppress("REIFIED_TYPE_PARAMETER_NO_INLINE")
@WasmOp(WasmOp.REF_TEST_NULL)
internal fun <reified To> wasm_ref_test_null(a: Any?): Boolean =
implementedAsIntrinsic
internal fun <T> wasm_array_copy(destination: T, destinationIndex: Int, source: T, sourceIndex: Int, length: Int): Unit =