Skip to content

Commit

Permalink
Remove old syntax for core wasm instructions
Browse files Browse the repository at this point in the history
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 bytecodealliance#1164
  • Loading branch information
alexcrichton committed Aug 25, 2023
1 parent 8daf745 commit a57e654
Showing 1 changed file with 43 additions and 43 deletions.
86 changes: 43 additions & 43 deletions crates/wast/src/core/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,11 +529,11 @@ instructions! {

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

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

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

I32WrapI64 : [0xa7] : "i32.wrap_i64" | "i32.wrap/i64",
I32TruncF32S : [0xa8] : "i32.trunc_f32_s" | "i32.trunc_s/f32",
I32TruncF32U : [0xa9] : "i32.trunc_f32_u" | "i32.trunc_u/f32",
I32TruncF64S : [0xaa] : "i32.trunc_f64_s" | "i32.trunc_s/f64",
I32TruncF64U : [0xab] : "i32.trunc_f64_u" | "i32.trunc_u/f64",
I64ExtendI32S : [0xac] : "i64.extend_i32_s" | "i64.extend_s/i32",
I64ExtendI32U : [0xad] : "i64.extend_i32_u" | "i64.extend_u/i32",
I64TruncF32S : [0xae] : "i64.trunc_f32_s" | "i64.trunc_s/f32",
I64TruncF32U : [0xaf] : "i64.trunc_f32_u" | "i64.trunc_u/f32",
I64TruncF64S : [0xb0] : "i64.trunc_f64_s" | "i64.trunc_s/f64",
I64TruncF64U : [0xb1] : "i64.trunc_f64_u" | "i64.trunc_u/f64",
F32ConvertI32S : [0xb2] : "f32.convert_i32_s" | "f32.convert_s/i32",
F32ConvertI32U : [0xb3] : "f32.convert_i32_u" | "f32.convert_u/i32",
F32ConvertI64S : [0xb4] : "f32.convert_i64_s" | "f32.convert_s/i64",
F32ConvertI64U : [0xb5] : "f32.convert_i64_u" | "f32.convert_u/i64",
F32DemoteF64 : [0xb6] : "f32.demote_f64" | "f32.demote/f64",
F64ConvertI32S : [0xb7] : "f64.convert_i32_s" | "f64.convert_s/i32",
F64ConvertI32U : [0xb8] : "f64.convert_i32_u" | "f64.convert_u/i32",
F64ConvertI64S : [0xb9] : "f64.convert_i64_s" | "f64.convert_s/i64",
F64ConvertI64U : [0xba] : "f64.convert_i64_u" | "f64.convert_u/i64",
F64PromoteF32 : [0xbb] : "f64.promote_f32" | "f64.promote/f32",
I32ReinterpretF32 : [0xbc] : "i32.reinterpret_f32" | "i32.reinterpret/f32",
I64ReinterpretF64 : [0xbd] : "i64.reinterpret_f64" | "i64.reinterpret/f64",
F32ReinterpretI32 : [0xbe] : "f32.reinterpret_i32" | "f32.reinterpret/i32",
F64ReinterpretI64 : [0xbf] : "f64.reinterpret_i64" | "f64.reinterpret/i64",
I32WrapI64 : [0xa7] : "i32.wrap_i64",
I32TruncF32S : [0xa8] : "i32.trunc_f32_s",
I32TruncF32U : [0xa9] : "i32.trunc_f32_u",
I32TruncF64S : [0xaa] : "i32.trunc_f64_s",
I32TruncF64U : [0xab] : "i32.trunc_f64_u",
I64ExtendI32S : [0xac] : "i64.extend_i32_s",
I64ExtendI32U : [0xad] : "i64.extend_i32_u",
I64TruncF32S : [0xae] : "i64.trunc_f32_s",
I64TruncF32U : [0xaf] : "i64.trunc_f32_u",
I64TruncF64S : [0xb0] : "i64.trunc_f64_s",
I64TruncF64U : [0xb1] : "i64.trunc_f64_u",
F32ConvertI32S : [0xb2] : "f32.convert_i32_s",
F32ConvertI32U : [0xb3] : "f32.convert_i32_u",
F32ConvertI64S : [0xb4] : "f32.convert_i64_s",
F32ConvertI64U : [0xb5] : "f32.convert_i64_u",
F32DemoteF64 : [0xb6] : "f32.demote_f64",
F64ConvertI32S : [0xb7] : "f64.convert_i32_s",
F64ConvertI32U : [0xb8] : "f64.convert_i32_u",
F64ConvertI64S : [0xb9] : "f64.convert_i64_s",
F64ConvertI64U : [0xba] : "f64.convert_i64_u",
F64PromoteF32 : [0xbb] : "f64.promote_f32",
I32ReinterpretF32 : [0xbc] : "i32.reinterpret_f32",
I64ReinterpretF64 : [0xbd] : "i64.reinterpret_f64",
F32ReinterpretI32 : [0xbe] : "f32.reinterpret_i32",
F64ReinterpretI64 : [0xbf] : "f64.reinterpret_i64",

// non-trapping float to int
I32TruncSatF32S : [0xfc, 0x00] : "i32.trunc_sat_f32_s" | "i32.trunc_s:sat/f32",
I32TruncSatF32U : [0xfc, 0x01] : "i32.trunc_sat_f32_u" | "i32.trunc_u:sat/f32",
I32TruncSatF64S : [0xfc, 0x02] : "i32.trunc_sat_f64_s" | "i32.trunc_s:sat/f64",
I32TruncSatF64U : [0xfc, 0x03] : "i32.trunc_sat_f64_u" | "i32.trunc_u:sat/f64",
I64TruncSatF32S : [0xfc, 0x04] : "i64.trunc_sat_f32_s" | "i64.trunc_s:sat/f32",
I64TruncSatF32U : [0xfc, 0x05] : "i64.trunc_sat_f32_u" | "i64.trunc_u:sat/f32",
I64TruncSatF64S : [0xfc, 0x06] : "i64.trunc_sat_f64_s" | "i64.trunc_s:sat/f64",
I64TruncSatF64U : [0xfc, 0x07] : "i64.trunc_sat_f64_u" | "i64.trunc_u:sat/f64",
I32TruncSatF32S : [0xfc, 0x00] : "i32.trunc_sat_f32_s",
I32TruncSatF32U : [0xfc, 0x01] : "i32.trunc_sat_f32_u",
I32TruncSatF64S : [0xfc, 0x02] : "i32.trunc_sat_f64_s",
I32TruncSatF64U : [0xfc, 0x03] : "i32.trunc_sat_f64_u",
I64TruncSatF32S : [0xfc, 0x04] : "i64.trunc_sat_f32_s",
I64TruncSatF32U : [0xfc, 0x05] : "i64.trunc_sat_f32_u",
I64TruncSatF64S : [0xfc, 0x06] : "i64.trunc_sat_f64_s",
I64TruncSatF64U : [0xfc, 0x07] : "i64.trunc_sat_f64_u",

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

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

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

0 comments on commit a57e654

Please sign in to comment.