[Wasm] Change externRefToAny to make it compatible with SpiderMonkey and V8
It's hard to achieve that without implementing part of `externRefToAny` using an intrinsic. It should be rewritten when all VMs and tools update to the latest spec. Also, stop using (deprecated) instructions unsupported by SpiderMonkey. #KT-56166 In-Progress
This commit is contained in:
@@ -211,6 +211,7 @@ class WasmSymbols(
|
||||
val nullableDoubleIeee754Equals = getInternalFunction("nullableDoubleIeee754Equals")
|
||||
|
||||
val unsafeGetScratchRawMemory = getInternalFunction("unsafeGetScratchRawMemory")
|
||||
val returnArgumentIfItIsKotlinAny = getInternalFunction("returnArgumentIfItIsKotlinAny")
|
||||
|
||||
val newJsArray = getInternalFunction("newJsArray")
|
||||
val jsArrayPush = getInternalFunction("jsArrayPush")
|
||||
|
||||
+14
-2
@@ -594,11 +594,23 @@ class BodyGenerator(
|
||||
}
|
||||
|
||||
wasmSymbols.unsafeGetScratchRawMemory -> {
|
||||
|
||||
body.buildConstI32Symbol(context.scratchMemAddr, location)
|
||||
}
|
||||
|
||||
|
||||
wasmSymbols.returnArgumentIfItIsKotlinAny -> {
|
||||
body.buildBlock("returnIfAny", WasmAnyRef) { innerLabel ->
|
||||
body.buildGetLocal(functionContext.referenceLocal(0), location)
|
||||
body.buildInstr(WasmOp.EXTERN_INTERNALIZE, location)
|
||||
body.buildBrInstr(WasmOp.BR_ON_NON_DATA_DEPRECATED, innerLabel, location)
|
||||
body.buildBrInstr(
|
||||
WasmOp.BR_ON_CAST_FAIL_DEPRECATED,
|
||||
innerLabel,
|
||||
context.referenceGcType(backendContext.irBuiltIns.anyClass),
|
||||
location
|
||||
)
|
||||
body.buildInstr(WasmOp.RETURN, location)
|
||||
}
|
||||
}
|
||||
|
||||
wasmSymbols.wasmArrayCopy -> {
|
||||
val immediate = WasmImmediate.GcType(
|
||||
|
||||
Reference in New Issue
Block a user