[Wasm] Migrate to the new GC M6 instructions
This commit is contained in:
@@ -138,13 +138,16 @@ private fun Any.asWasmExternRef(): ExternalInterfaceType =
|
||||
internal external fun isNullish(ref: ExternalInterfaceType?): Boolean
|
||||
|
||||
internal fun externRefToAny(ref: ExternalInterfaceType): Any? {
|
||||
// If ref is an instance of kotlin class -- return it cased to Any
|
||||
// TODO rewrite it so to get something like:
|
||||
// block {
|
||||
// refAsAnyref
|
||||
// br_on_cast_fail 0 $kotlin.Any
|
||||
// return
|
||||
// }
|
||||
// If ref is an instance of kotlin class -- return it casted to Any
|
||||
val refAsAnyref = ref.externAsWasmAnyref()
|
||||
if (wasm_ref_is_data(refAsAnyref)) {
|
||||
val refAsDataRef = wasm_ref_as_data(refAsAnyref)
|
||||
if (wasm_ref_test<Any>(refAsDataRef)) {
|
||||
return wasm_ref_cast<Any>(refAsDataRef)
|
||||
}
|
||||
if (wasm_ref_test<Any>(refAsAnyref)) {
|
||||
return wasm_ref_cast<Any>(refAsAnyref)
|
||||
}
|
||||
|
||||
// If we have Null in notNullRef -- return null
|
||||
|
||||
@@ -378,17 +378,5 @@ public external fun wasm_i64_ctz(a: Long): Long
|
||||
|
||||
// Reference type operators
|
||||
|
||||
@WasmOp(WasmOp.REF_IS_DATA)
|
||||
internal external fun wasm_ref_is_data(x: anyref): Boolean
|
||||
|
||||
@WasmOp(WasmOp.REF_IS_I31)
|
||||
internal external fun wasm_ref_is_i31(x: anyref): Boolean
|
||||
|
||||
@WasmOp(WasmOp.REF_AS_DATA)
|
||||
internal external fun wasm_ref_as_data(x: anyref): dataref
|
||||
|
||||
@WasmOp(WasmOp.REF_AS_I31)
|
||||
internal external fun wasm_ref_as_i31(x: anyref): i31ref
|
||||
|
||||
@WasmOp(WasmOp.REF_IS_NULL)
|
||||
internal external fun wasm_externref_is_null(a: ExternalInterfaceType?): Boolean
|
||||
internal external fun wasm_externref_is_null(a: ExternalInterfaceType?): Boolean
|
||||
|
||||
Reference in New Issue
Block a user