[Wasm] Fix immediate type for recently (in M6) introduced instructions
STRUCT_TYPE_IDX -> HEAP_TYPE WasmImmediate.TypeIdx -> WasmImmediate.HeapType
This commit is contained in:
+2
@@ -864,6 +864,8 @@ class BodyGenerator(
|
|||||||
WasmImmediate.MemArg(0u, 0u)
|
WasmImmediate.MemArg(0u, 0u)
|
||||||
WasmImmediateKind.STRUCT_TYPE_IDX ->
|
WasmImmediateKind.STRUCT_TYPE_IDX ->
|
||||||
WasmImmediate.GcType(getReferenceGcType())
|
WasmImmediate.GcType(getReferenceGcType())
|
||||||
|
WasmImmediateKind.HEAP_TYPE ->
|
||||||
|
WasmImmediate.HeapType(WasmHeapType.Type(getReferenceGcType()))
|
||||||
WasmImmediateKind.TYPE_IDX ->
|
WasmImmediateKind.TYPE_IDX ->
|
||||||
WasmImmediate.TypeIdx(getReferenceGcType())
|
WasmImmediate.TypeIdx(getReferenceGcType())
|
||||||
|
|
||||||
|
|||||||
@@ -372,19 +372,19 @@ enum class WasmOp(
|
|||||||
I31_GET_U("i31.get_u", 0xFB_22),
|
I31_GET_U("i31.get_u", 0xFB_22),
|
||||||
|
|
||||||
REF_EQ("ref.eq", 0xD5),
|
REF_EQ("ref.eq", 0xD5),
|
||||||
REF_TEST("ref.test", 0xFB_40, STRUCT_TYPE_IDX),
|
REF_TEST("ref.test", 0xFB_40, HEAP_TYPE),
|
||||||
REF_TEST_NULL("ref.test null", 0xFB_48, STRUCT_TYPE_IDX),
|
REF_TEST_NULL("ref.test null", 0xFB_48, HEAP_TYPE),
|
||||||
REF_CAST("ref.cast", 0xFB_41, STRUCT_TYPE_IDX),
|
REF_CAST("ref.cast", 0xFB_41, HEAP_TYPE),
|
||||||
REF_CAST_NULL("ref.cast null", 0xFB_49, STRUCT_TYPE_IDX),
|
REF_CAST_NULL("ref.cast null", 0xFB_49, HEAP_TYPE),
|
||||||
|
|
||||||
// TODO remove as soon as V8 support new instructions, see below
|
// TODO remove as soon as V8 support new instructions, see below
|
||||||
BR_ON_CAST_FAIL("br_on_cast_fail", 0xfb47, listOf(LABEL_IDX, STRUCT_TYPE_IDX)),
|
BR_ON_CAST_FAIL("br_on_cast_fail", 0xfb47, listOf(LABEL_IDX, STRUCT_TYPE_IDX)),
|
||||||
|
|
||||||
// Not yet supported by V8
|
// Not yet supported by V8
|
||||||
// BR_ON_CAST("br_on_cast", 0xFB42, listOf(LABEL_IDX, STRUCT_TYPE_IDX)),
|
// BR_ON_CAST("br_on_cast", 0xFB42, listOf(LABEL_IDX, HEAP_TYPE)),
|
||||||
// BR_ON_CAST_NULL("br_on_cast null", 0xFB4A, listOf(LABEL_IDX, STRUCT_TYPE_IDX)),
|
// BR_ON_CAST_NULL("br_on_cast null", 0xFB4A, listOf(LABEL_IDX, HEAP_TYPE)),
|
||||||
// BR_ON_CAST_FAIL("br_on_cast_fail", 0xFB43, listOf(LABEL_IDX, STRUCT_TYPE_IDX)),
|
// BR_ON_CAST_FAIL("br_on_cast_fail", 0xFB43, listOf(LABEL_IDX, HEAP_TYPE)),
|
||||||
// BR_ON_CAST_FAIL_NULL("br_on_cast_fail null", 0xFB4B, listOf(LABEL_IDX, STRUCT_TYPE_IDX)),
|
// BR_ON_CAST_FAIL_NULL("br_on_cast_fail null", 0xFB4B, listOf(LABEL_IDX, HEAP_TYPE)),
|
||||||
|
|
||||||
EXTERN_INTERNALIZE("extern.internalize", 0xfb70), // externref -> anyref
|
EXTERN_INTERNALIZE("extern.internalize", 0xfb70), // externref -> anyref
|
||||||
EXTERN_EXTERNALIZE("extern.externalize", 0xfb71), // anyref -> externref
|
EXTERN_EXTERNALIZE("extern.externalize", 0xfb71), // anyref -> externref
|
||||||
|
|||||||
@@ -157,11 +157,11 @@ abstract class WasmExpressionBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun buildRefCastNullStatic(toType: WasmSymbolReadOnly<WasmTypeDeclaration>) {
|
fun buildRefCastNullStatic(toType: WasmSymbolReadOnly<WasmTypeDeclaration>) {
|
||||||
buildInstr(WasmOp.REF_CAST_NULL, WasmImmediate.TypeIdx(toType))
|
buildInstr(WasmOp.REF_CAST_NULL, WasmImmediate.HeapType(WasmHeapType.Type(toType)))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun buildRefTestStatic(toType: WasmSymbolReadOnly<WasmTypeDeclaration>) {
|
fun buildRefTestStatic(toType: WasmSymbolReadOnly<WasmTypeDeclaration>) {
|
||||||
buildInstr(WasmOp.REF_TEST, WasmImmediate.TypeIdx(toType))
|
buildInstr(WasmOp.REF_TEST, WasmImmediate.HeapType(WasmHeapType.Type(toType)))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun buildRefNull(type: WasmHeapType) {
|
fun buildRefNull(type: WasmHeapType) {
|
||||||
|
|||||||
Reference in New Issue
Block a user