Skip to content

Commit 8bf2677

Browse files
authored
Remove old syntax for core wasm instructions (#1184)
Long ago instructions like `get_local` were renamed to `local.get` along with a number of other instructions. The `wast` crate has for quite some time supported parsing the old forms but `wasmprinter` has always printed out the most "up to date" forms. This commit goes through and deletes the parsing support for all the old forms, meaning that it's now an error to use such syntax. Closes #1164
1 parent 8daf745 commit 8bf2677

File tree

1 file changed

+43
-43
lines changed

1 file changed

+43
-43
lines changed

crates/wast/src/core/expr.rs

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -529,11 +529,11 @@ instructions! {
529529

530530
Drop : [0x1a] : "drop",
531531
Select(SelectTypes<'a>) : [] : "select",
532-
LocalGet(Index<'a>) : [0x20] : "local.get" | "get_local",
533-
LocalSet(Index<'a>) : [0x21] : "local.set" | "set_local",
534-
LocalTee(Index<'a>) : [0x22] : "local.tee" | "tee_local",
535-
GlobalGet(Index<'a>) : [0x23] : "global.get" | "get_global",
536-
GlobalSet(Index<'a>) : [0x24] : "global.set" | "set_global",
532+
LocalGet(Index<'a>) : [0x20] : "local.get",
533+
LocalSet(Index<'a>) : [0x21] : "local.set",
534+
LocalTee(Index<'a>) : [0x22] : "local.tee",
535+
GlobalGet(Index<'a>) : [0x23] : "global.get",
536+
GlobalSet(Index<'a>) : [0x24] : "global.set",
537537

538538
TableGet(TableArg<'a>) : [0x25] : "table.get",
539539
TableSet(TableArg<'a>) : [0x26] : "table.set",
@@ -563,8 +563,8 @@ instructions! {
563563
I64Store32(MemArg<4>) : [0x3e] : "i64.store32",
564564

565565
// Lots of bulk memory proposal here as well
566-
MemorySize(MemoryArg<'a>) : [0x3f] : "memory.size" | "current_memory",
567-
MemoryGrow(MemoryArg<'a>) : [0x40] : "memory.grow" | "grow_memory",
566+
MemorySize(MemoryArg<'a>) : [0x3f] : "memory.size",
567+
MemoryGrow(MemoryArg<'a>) : [0x40] : "memory.grow",
568568
MemoryInit(MemoryInit<'a>) : [0xfc, 0x08] : "memory.init",
569569
MemoryCopy(MemoryCopy<'a>) : [0xfc, 0x0a] : "memory.copy",
570570
MemoryFill(MemoryArg<'a>) : [0xfc, 0x0b] : "memory.fill",
@@ -739,41 +739,41 @@ instructions! {
739739
F64Le : [0x65] : "f64.le",
740740
F64Ge : [0x66] : "f64.ge",
741741

742-
I32WrapI64 : [0xa7] : "i32.wrap_i64" | "i32.wrap/i64",
743-
I32TruncF32S : [0xa8] : "i32.trunc_f32_s" | "i32.trunc_s/f32",
744-
I32TruncF32U : [0xa9] : "i32.trunc_f32_u" | "i32.trunc_u/f32",
745-
I32TruncF64S : [0xaa] : "i32.trunc_f64_s" | "i32.trunc_s/f64",
746-
I32TruncF64U : [0xab] : "i32.trunc_f64_u" | "i32.trunc_u/f64",
747-
I64ExtendI32S : [0xac] : "i64.extend_i32_s" | "i64.extend_s/i32",
748-
I64ExtendI32U : [0xad] : "i64.extend_i32_u" | "i64.extend_u/i32",
749-
I64TruncF32S : [0xae] : "i64.trunc_f32_s" | "i64.trunc_s/f32",
750-
I64TruncF32U : [0xaf] : "i64.trunc_f32_u" | "i64.trunc_u/f32",
751-
I64TruncF64S : [0xb0] : "i64.trunc_f64_s" | "i64.trunc_s/f64",
752-
I64TruncF64U : [0xb1] : "i64.trunc_f64_u" | "i64.trunc_u/f64",
753-
F32ConvertI32S : [0xb2] : "f32.convert_i32_s" | "f32.convert_s/i32",
754-
F32ConvertI32U : [0xb3] : "f32.convert_i32_u" | "f32.convert_u/i32",
755-
F32ConvertI64S : [0xb4] : "f32.convert_i64_s" | "f32.convert_s/i64",
756-
F32ConvertI64U : [0xb5] : "f32.convert_i64_u" | "f32.convert_u/i64",
757-
F32DemoteF64 : [0xb6] : "f32.demote_f64" | "f32.demote/f64",
758-
F64ConvertI32S : [0xb7] : "f64.convert_i32_s" | "f64.convert_s/i32",
759-
F64ConvertI32U : [0xb8] : "f64.convert_i32_u" | "f64.convert_u/i32",
760-
F64ConvertI64S : [0xb9] : "f64.convert_i64_s" | "f64.convert_s/i64",
761-
F64ConvertI64U : [0xba] : "f64.convert_i64_u" | "f64.convert_u/i64",
762-
F64PromoteF32 : [0xbb] : "f64.promote_f32" | "f64.promote/f32",
763-
I32ReinterpretF32 : [0xbc] : "i32.reinterpret_f32" | "i32.reinterpret/f32",
764-
I64ReinterpretF64 : [0xbd] : "i64.reinterpret_f64" | "i64.reinterpret/f64",
765-
F32ReinterpretI32 : [0xbe] : "f32.reinterpret_i32" | "f32.reinterpret/i32",
766-
F64ReinterpretI64 : [0xbf] : "f64.reinterpret_i64" | "f64.reinterpret/i64",
742+
I32WrapI64 : [0xa7] : "i32.wrap_i64",
743+
I32TruncF32S : [0xa8] : "i32.trunc_f32_s",
744+
I32TruncF32U : [0xa9] : "i32.trunc_f32_u",
745+
I32TruncF64S : [0xaa] : "i32.trunc_f64_s",
746+
I32TruncF64U : [0xab] : "i32.trunc_f64_u",
747+
I64ExtendI32S : [0xac] : "i64.extend_i32_s",
748+
I64ExtendI32U : [0xad] : "i64.extend_i32_u",
749+
I64TruncF32S : [0xae] : "i64.trunc_f32_s",
750+
I64TruncF32U : [0xaf] : "i64.trunc_f32_u",
751+
I64TruncF64S : [0xb0] : "i64.trunc_f64_s",
752+
I64TruncF64U : [0xb1] : "i64.trunc_f64_u",
753+
F32ConvertI32S : [0xb2] : "f32.convert_i32_s",
754+
F32ConvertI32U : [0xb3] : "f32.convert_i32_u",
755+
F32ConvertI64S : [0xb4] : "f32.convert_i64_s",
756+
F32ConvertI64U : [0xb5] : "f32.convert_i64_u",
757+
F32DemoteF64 : [0xb6] : "f32.demote_f64",
758+
F64ConvertI32S : [0xb7] : "f64.convert_i32_s",
759+
F64ConvertI32U : [0xb8] : "f64.convert_i32_u",
760+
F64ConvertI64S : [0xb9] : "f64.convert_i64_s",
761+
F64ConvertI64U : [0xba] : "f64.convert_i64_u",
762+
F64PromoteF32 : [0xbb] : "f64.promote_f32",
763+
I32ReinterpretF32 : [0xbc] : "i32.reinterpret_f32",
764+
I64ReinterpretF64 : [0xbd] : "i64.reinterpret_f64",
765+
F32ReinterpretI32 : [0xbe] : "f32.reinterpret_i32",
766+
F64ReinterpretI64 : [0xbf] : "f64.reinterpret_i64",
767767

768768
// non-trapping float to int
769-
I32TruncSatF32S : [0xfc, 0x00] : "i32.trunc_sat_f32_s" | "i32.trunc_s:sat/f32",
770-
I32TruncSatF32U : [0xfc, 0x01] : "i32.trunc_sat_f32_u" | "i32.trunc_u:sat/f32",
771-
I32TruncSatF64S : [0xfc, 0x02] : "i32.trunc_sat_f64_s" | "i32.trunc_s:sat/f64",
772-
I32TruncSatF64U : [0xfc, 0x03] : "i32.trunc_sat_f64_u" | "i32.trunc_u:sat/f64",
773-
I64TruncSatF32S : [0xfc, 0x04] : "i64.trunc_sat_f32_s" | "i64.trunc_s:sat/f32",
774-
I64TruncSatF32U : [0xfc, 0x05] : "i64.trunc_sat_f32_u" | "i64.trunc_u:sat/f32",
775-
I64TruncSatF64S : [0xfc, 0x06] : "i64.trunc_sat_f64_s" | "i64.trunc_s:sat/f64",
776-
I64TruncSatF64U : [0xfc, 0x07] : "i64.trunc_sat_f64_u" | "i64.trunc_u:sat/f64",
769+
I32TruncSatF32S : [0xfc, 0x00] : "i32.trunc_sat_f32_s",
770+
I32TruncSatF32U : [0xfc, 0x01] : "i32.trunc_sat_f32_u",
771+
I32TruncSatF64S : [0xfc, 0x02] : "i32.trunc_sat_f64_s",
772+
I32TruncSatF64U : [0xfc, 0x03] : "i32.trunc_sat_f64_u",
773+
I64TruncSatF32S : [0xfc, 0x04] : "i64.trunc_sat_f32_s",
774+
I64TruncSatF32U : [0xfc, 0x05] : "i64.trunc_sat_f32_u",
775+
I64TruncSatF64S : [0xfc, 0x06] : "i64.trunc_sat_f64_s",
776+
I64TruncSatF64U : [0xfc, 0x07] : "i64.trunc_sat_f64_u",
777777

778778
// sign extension proposal
779779
I32Extend8S : [0xc0] : "i32.extend8_s",
@@ -783,9 +783,9 @@ instructions! {
783783
I64Extend32S : [0xc4] : "i64.extend32_s",
784784

785785
// atomics proposal
786-
MemoryAtomicNotify(MemArg<4>) : [0xfe, 0x00] : "memory.atomic.notify" | "atomic.notify",
787-
MemoryAtomicWait32(MemArg<4>) : [0xfe, 0x01] : "memory.atomic.wait32" | "i32.atomic.wait",
788-
MemoryAtomicWait64(MemArg<8>) : [0xfe, 0x02] : "memory.atomic.wait64" | "i64.atomic.wait",
786+
MemoryAtomicNotify(MemArg<4>) : [0xfe, 0x00] : "memory.atomic.notify",
787+
MemoryAtomicWait32(MemArg<4>) : [0xfe, 0x01] : "memory.atomic.wait32",
788+
MemoryAtomicWait64(MemArg<8>) : [0xfe, 0x02] : "memory.atomic.wait64",
789789
AtomicFence : [0xfe, 0x03, 0x00] : "atomic.fence",
790790

791791
I32AtomicLoad(MemArg<4>) : [0xfe, 0x10] : "i32.atomic.load",

0 commit comments

Comments
 (0)