Skip to content

Commit

Permalink
Finish instruction renaming (WebAssembly#1792)
Browse files Browse the repository at this point in the history
This finishes WebAssembly#985. This
- replaces the old names in the tests with the new names
- drops support for the deprecated names
- renames test files to match new instruction names

I don't think dropping support for the old names will be a problem at
this point. WebAssembly#985 says the old names are supported for convenience but we
should remove those too at some point; that "some point" may have well
arrived given that three years have passed.

The lists of names updated are in WebAssembly#933, WebAssembly#1564, WebAssembly/spec#720.
  • Loading branch information
aheejin authored Dec 21, 2021
1 parent e59cf93 commit 1f3a1d5
Show file tree
Hide file tree
Showing 231 changed files with 2,084 additions and 2,297 deletions.
2 changes: 1 addition & 1 deletion docs/demo/wast-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
var mode = CodeMirror.defineSimpleMode('wast', {
start: [
{regex: /[+\-]?(?:nan(?::0x[0-9a-fA-F]+)?|infinity|inf|0x[0-9a-fA-F]+\.?[0-9a-fA-F]*p[+\/-]?\d+|\d+(?:\.\d*)?[eE][+\-]?\d*|\d+\.\d*|0x[0-9a-fA-F]+|\d+)/, token: "number"},
{regex: /anyfunc|mut|nop|block|if|then|else|loop|br|br_if|br_table|call|call_indirect|drop|end|return|get_local|set_local|tee_local|get_global|set_global|i32\.load|i64\.load|f32\.load|f64\.load|i32\.store|i64\.store|f32\.store|f64\.store|i32\.load8_s|i64\.load8_s|i32\.load8_u|i64\.load8_u|i32\.load16_s|i64\.load16_s|i32\.load16_u|i64\.load16_u|i64\.load32_s|i64\.load32_u|i32\.store8|i64\.store8|i32\.store16|i64\.store16|i32\.const|i64\.const|f32\.const|f64\.const|i32\.eqz|i64\.eqz|i32\.clz|i64\.clz|i32\.ctz|i64\.ctz|i32\.popcnt|i64\.popcnt|f32\.neg|f64\.neg|f32\.abs|f64\.abs|f32\.sqrt|f64\.sqrt|f32\.ceil|f64\.ceil|f32\.floor|f64\.floor|f32\.trunc|f64\.trunc|f32\.nearest|f64\.nearest|i32\.add|i64\.add|i32\.sub|i64\.sub|i32\.mul|i64\.mul|i32\.div_s|i64\.div_s|i32\.div_u|i64\.div_u|i32\.rem_s|i64\.rem_s|i32\.rem_u|i64\.rem_u|i32\.and|i64\.and|i32\.or|i64\.or|i32\.xor|i64\.xor|i32\.shl|i64\.shl|i32\.shr_s|i64\.shr_s|i32\.shr_u|i64\.shr_u|i32\.rotl|i64\.rotl|i32\.rotr|i64\.rotr|f32\.add|f64\.add|f32\.sub|f64\.sub|f32\.mul|f64\.mul|f32\.div|f64\.div|f32\.min|f64\.min|f32\.max|f64\.max|f32\.copysign|f64\.copysign|i32\.eq|i64\.eq|i32\.ne|i64\.ne|i32\.lt_s|i64\.lt_s|i32\.lt_u|i64\.lt_u|i32\.le_s|i64\.le_s|i32\.le_u|i64\.le_u|i32\.gt_s|i64\.gt_s|i32\.gt_u|i64\.gt_u|i32\.ge_s|i64\.ge_s|i32\.ge_u|i64\.ge_u|f32\.eq|f64\.eq|f32\.ne|f64\.ne|f32\.lt|f64\.lt|f32\.le|f64\.le|f32\.gt|f64\.gt|f32\.ge|f64\.ge|i64\.extend_s\/i32|i64\.extend_u\/i32|i32\.wrap\/i64|i32\.trunc_s\/f32|i64\.trunc_s\/f32|i32\.trunc_s\/f64|i64\.trunc_s\/f64|i32\.trunc_u\/f32|i64\.trunc_u\/f32|i32\.trunc_u\/f64|i64\.trunc_u\/f64|f32\.convert_s\/i32|f64\.convert_s\/i32|f32\.convert_s\/i64|f64\.convert_s\/i64|f32\.convert_u\/i32|f64\.convert_u\/i32|f32\.convert_u\/i64|f64\.convert_u\/i64|f64\.promote\/f32|f32\.demote\/f64|f32\.reinterpret\/i32|i32\.reinterpret\/f32|f64\.reinterpret\/i64|i64\.reinterpret\/f64|select|unreachable|current_memory|memory.size|grow_memory|memory.grow|type|func|param|result|local|global|module|table|memory|start|elem|data|offset|import|export|i32|i64|f32|f64/, token: "keyword"},
{regex: /funcref|mut|nop|block|if|then|else|loop|br|br_if|br_table|call|call_indirect|drop|end|return|local\.get|local\.set|local\.tee|global\.get|global\.set|i32\.load|i64\.load|f32\.load|f64\.load|i32\.store|i64\.store|f32\.store|f64\.store|i32\.load8_s|i64\.load8_s|i32\.load8_u|i64\.load8_u|i32\.load16_s|i64\.load16_s|i32\.load16_u|i64\.load16_u|i64\.load32_s|i64\.load32_u|i32\.store8|i64\.store8|i32\.store16|i64\.store16|i32\.const|i64\.const|f32\.const|f64\.const|i32\.eqz|i64\.eqz|i32\.clz|i64\.clz|i32\.ctz|i64\.ctz|i32\.popcnt|i64\.popcnt|f32\.neg|f64\.neg|f32\.abs|f64\.abs|f32\.sqrt|f64\.sqrt|f32\.ceil|f64\.ceil|f32\.floor|f64\.floor|f32\.trunc|f64\.trunc|f32\.nearest|f64\.nearest|i32\.add|i64\.add|i32\.sub|i64\.sub|i32\.mul|i64\.mul|i32\.div_s|i64\.div_s|i32\.div_u|i64\.div_u|i32\.rem_s|i64\.rem_s|i32\.rem_u|i64\.rem_u|i32\.and|i64\.and|i32\.or|i64\.or|i32\.xor|i64\.xor|i32\.shl|i64\.shl|i32\.shr_s|i64\.shr_s|i32\.shr_u|i64\.shr_u|i32\.rotl|i64\.rotl|i32\.rotr|i64\.rotr|f32\.add|f64\.add|f32\.sub|f64\.sub|f32\.mul|f64\.mul|f32\.div|f64\.div|f32\.min|f64\.min|f32\.max|f64\.max|f32\.copysign|f64\.copysign|i32\.eq|i64\.eq|i32\.ne|i64\.ne|i32\.lt_s|i64\.lt_s|i32\.lt_u|i64\.lt_u|i32\.le_s|i64\.le_s|i32\.le_u|i64\.le_u|i32\.gt_s|i64\.gt_s|i32\.gt_u|i64\.gt_u|i32\.ge_s|i64\.ge_s|i32\.ge_u|i64\.ge_u|f32\.eq|f64\.eq|f32\.ne|f64\.ne|f32\.lt|f64\.lt|f32\.le|f64\.le|f32\.gt|f64\.gt|f32\.ge|f64\.ge|i64\.extend_i32_s|i64\.extend_i32_u|i32\.wrap_i64|i32\.trunc_f32_s|i64\.trunc_f32_s|i32\.trunc_f64_s|i64\.trunc_f64_s|i32\.trunc_f32_u|i64\.trunc_f32_u|i32\.trunc_f64_u|i64\.trunc_f64_u|f32\.convert_i32_s|f64\.convert_i32_s|f32\.convert_i64_s|f64\.convert_i64_s|f32\.convert_i32_u|f64\.convert_i32_u|f32\.convert_i64_u|f64\.convert_i64_u|f64\.promote_f32|f32\.demote_f64|f32\.reinterpret_i32|i32\.reinterpret_f32|f64\.reinterpret_i64|i64\.reinterpret_f64|select|unreachable|memory\.size|memory\.grow|type|func|param|result|local|global|module|table|memory|start|elem|data|offset|import|export|i32|i64|f32|f64/, token: "keyword"},
{regex: /\$([a-zA-Z0-9_`\+\-\*\/\\\^~=<>!\?@#$%&|:\.]+)/, token: "variable-2"},
{regex: /"(?:[^"\\\x00-\x1f\x7f]|\\[nt\\'"]|\\[0-9a-fA-F][0-9a-fA-F])*"/, token: "string"},
{regex: /\(;.*?/, token: "comment", next: "comment"},
Expand Down
2 changes: 1 addition & 1 deletion docs/demo/wat2wasm/examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ for (let i = 1; i <= 15; i++) {
(memory (data "hi"))
(type (func (param i32) (result i32)))
(start 1)
(table 0 1 anyfunc)
(table 0 1 funcref)
(func)
(func (type 1)
i32.const 42
Expand Down
60 changes: 30 additions & 30 deletions fuzz-in/wast.dict
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ op_call_indirect="call_indirect"
op_drop="drop"
op_end="end"
op_return="return"
op_get_local="get_local"
op_set_local="set_local"
op_tee_local="tee_local"
op_get_global="get_global"
op_set_global="set_global"
op_local_get="local.get"
op_local_set="local.set"
op_local_tee="local.tee"
op_global_get="global.get"
op_global_set="global.set"
op_i32_load="i32.load"
op_i64_load="i64.load"
op_f32_load="f32.load"
Expand Down Expand Up @@ -173,31 +173,31 @@ op_f32_gt="f32.gt"
op_f64_gt="f64.gt"
op_f32_ge="f32.ge"
op_f64_ge="f64.ge"
op_i64_extend_s_i32="i64.extend_s/i32"
op_i64_extend_u_i32="i64.extend_u/i32"
op_i32_wrap_i64="i32.wrap/i64"
op_i32_trunc_s_f32="i32.trunc_s/f32"
op_i64_trunc_s_f32="i64.trunc_s/f32"
op_i32_trunc_s_f64="i32.trunc_s/f64"
op_i64_trunc_s_f64="i64.trunc_s/f64"
op_i32_trunc_u_f32="i32.trunc_u/f32"
op_i64_trunc_u_f32="i64.trunc_u/f32"
op_i32_trunc_u_f64="i32.trunc_u/f64"
op_i64_trunc_u_f64="i64.trunc_u/f64"
op_f32_convert_s_i32="f32.convert_s/i32"
op_f64_convert_s_i32="f64.convert_s/i32"
op_f32_convert_s_i64="f32.convert_s/i64"
op_f64_convert_s_i64="f64.convert_s/i64"
op_f32_convert_u_i32="f32.convert_u/i32"
op_f64_convert_u_i32="f64.convert_u/i32"
op_f32_convert_u_i64="f32.convert_u/i64"
op_f64_convert_u_i64="f64.convert_u/i64"
op_f64_promote_f32="f64.promote/f32"
op_f32_demote_f64="f32.demote/f64"
op_f32_reinterpret_i32="f32.reinterpret/i32"
op_i32_reinterpret_f32="i32.reinterpret/f32"
op_f64_reinterpret_i64="f64.reinterpret/i64"
op_i64_reinterpret_f64="i64.reinterpret/f64"
op_i64_extend_i32_s="i64.extend_i32_s"
op_i64_extend_i32_u="i64.extend_i32_u"
op_i32_wrap_i64="i32.wrap_i64"
op_i32_trunc_f32_s="i32.trunc_f32_s"
op_i64_trunc_f32_s="i64.trunc_f32_s"
op_i32_trunc_f64_s="i32.trunc_f64_s"
op_i64_trunc_f64_s="i64.trunc_f64_s"
op_i32_trunc_f32_u="i32.trunc_f32_u"
op_i64_trunc_f32_u="i64.trunc_f32_u"
op_i32_trunc_f64_u="i32.trunc_f64_u"
op_i64_trunc_f64_u="i64.trunc_f64_u"
op_f32_convert_i32_s="f32.convert_i32_s"
op_f64_convert_i32_s="f64.convert_i32_s"
op_f32_convert_i64_s="f32.convert_i64_s"
op_f64_convert_i64_s="f64.convert_i64_s"
op_f32_convert_i32_u="f32.convert_i32_u"
op_f64_convert_i32_u="f64.convert_i32_u"
op_f32_convert_i64_u="f32.convert_i64_u"
op_f64_convert_i64_u="f64.convert_i64_u"
op_f64_promote_f32="f64.promote_f32"
op_f32_demote_f64="f32.demote_f64"
op_f32_reinterpret_i32="f32.reinterpret_i32"
op_i32_reinterpret_f32="i32.reinterpret_f32"
op_f64_reinterpret_i64="f64.reinterpret_i64"
op_i64_reinterpret_f64="i64.reinterpret_f64"
op_select="select"
op_unreachable="unreachable"
op_memory_size="memory.size"
Expand Down
2 changes: 1 addition & 1 deletion src/c-writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ void CWriter::WriteElemInitializers() {

Write(ExternalRef(table->name), ".data[offset + ", i,
"] = (wasm_rt_elem_t){func_types[", func_type_index,
"], (wasm_rt_anyfunc_t)", ExternalPtr(func->name), "};", Newline());
"], (wasm_rt_funcref_t)", ExternalPtr(func->name), "};", Newline());
++i;
}
++elem_segment_index;
Expand Down
2 changes: 1 addition & 1 deletion src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ enum class RelocType {
MemoryAddressSLEB = 4, // e.g. Memory address in i32.const
MemoryAddressI32 = 5, // e.g. Memory address in DATA
TypeIndexLEB = 6, // e.g. Immediate type in call_indirect
GlobalIndexLEB = 7, // e.g. Immediate of get_global inst
GlobalIndexLEB = 7, // e.g. Immediate of global.get inst
FunctionOffsetI32 = 8, // e.g. Code offset in DWARF metadata
SectionOffsetI32 = 9, // e.g. Section offset in DWARF metadata
TagIndexLEB = 10, // Used in throw instructions
Expand Down
4 changes: 2 additions & 2 deletions src/decompiler-ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ struct AST {
// Special optimisation: for constant instructions, we can mark these
// as if they were variables, so they can be re-ordered for free with
// the above code, without needing new variables!
// TODO: this would be nice to also do for get_local and maybe others,
// though that needs a way to ensure there's no set_local in between
// TODO: this would be nice to also do for local.get and maybe others,
// though that needs a way to ensure there's no local.set in between
// when they get lifted, so complicates matters a bit.
if (e.type() == ExprType::Const &&
value_stack_in_variables == value_stack_depth - 1) {
Expand Down
45 changes: 0 additions & 45 deletions src/lexer-keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ call_ref, TokenType::CallRef, Opcode::CallRef
call, TokenType::Call, Opcode::Call
catch, TokenType::Catch, Opcode::Catch
catch_all, TokenType::CatchAll, Opcode::CatchAll
current_memory, TokenType::MemorySize, Opcode::MemorySize
data.drop, TokenType::DataDrop, Opcode::DataDrop
data, TokenType::Data
declare, TokenType::Declare
Expand Down Expand Up @@ -174,7 +173,6 @@ get, TokenType::Get
global.get, TokenType::GlobalGet, Opcode::GlobalGet
global.set, TokenType::GlobalSet, Opcode::GlobalSet
global, TokenType::Global
grow_memory, TokenType::MemoryGrow, Opcode::MemoryGrow
i16x8.abs, TokenType::Unary, Opcode::I16X8Abs
i16x8.add_sat_s, TokenType::Binary, Opcode::I16X8AddSatS
i16x8.add_sat_u, TokenType::Binary, Opcode::I16X8AddSatU
Expand Down Expand Up @@ -588,46 +586,3 @@ v128.store32_lane, TokenType::SimdStoreLane, Opcode::V128Store32Lane
v128.store64_lane, TokenType::SimdStoreLane, Opcode::V128Store64Lane
i8x16.shuffle, TokenType::SimdShuffleOp, Opcode::I8X16Shuffle
i8x16.swizzle, TokenType::Binary, Opcode::I8X16Swizzle
# Deprecated names.
atomic.notify, TokenType::AtomicNotify, Opcode::MemoryAtomicNotify
i32.atomic.wait, TokenType::AtomicWait, Opcode::MemoryAtomicWait32
i64.atomic.wait, TokenType::AtomicWait, Opcode::MemoryAtomicWait64
anyfunc, Type::FuncRef
f32.convert_s/i32, TokenType::Convert, Opcode::F32ConvertI32S
f32.convert_s/i64, TokenType::Convert, Opcode::F32ConvertI64S
f32.convert_u/i32, TokenType::Convert, Opcode::F32ConvertI32U
f32.convert_u/i64, TokenType::Convert, Opcode::F32ConvertI64U
f32.demote/f64, TokenType::Convert, Opcode::F32DemoteF64
f32.reinterpret/i32, TokenType::Convert, Opcode::F32ReinterpretI32
f64.convert_s/i32, TokenType::Convert, Opcode::F64ConvertI32S
f64.convert_s/i64, TokenType::Convert, Opcode::F64ConvertI64S
f64.convert_u/i32, TokenType::Convert, Opcode::F64ConvertI32U
f64.convert_u/i64, TokenType::Convert, Opcode::F64ConvertI64U
f64.promote/f32, TokenType::Convert, Opcode::F64PromoteF32
f64.reinterpret/i64, TokenType::Convert, Opcode::F64ReinterpretI64
get_global, TokenType::GlobalGet, Opcode::GlobalGet
get_local, TokenType::LocalGet, Opcode::LocalGet
i32.reinterpret/f32, TokenType::Convert, Opcode::I32ReinterpretF32
i32.trunc_s/f32, TokenType::Convert, Opcode::I32TruncF32S
i32.trunc_s/f64, TokenType::Convert, Opcode::I32TruncF64S
i32.trunc_s:sat/f32, TokenType::Convert, Opcode::I32TruncSatF32S
i32.trunc_s:sat/f64, TokenType::Convert, Opcode::I32TruncSatF64S
i32.trunc_u/f32, TokenType::Convert, Opcode::I32TruncF32U
i32.trunc_u/f64, TokenType::Convert, Opcode::I32TruncF64U
i32.trunc_u:sat/f32, TokenType::Convert, Opcode::I32TruncSatF32U
i32.trunc_u:sat/f64, TokenType::Convert, Opcode::I32TruncSatF64U
i32.wrap/i64, TokenType::Convert, Opcode::I32WrapI64
i64.extend_s/i32, TokenType::Convert, Opcode::I64ExtendI32S
i64.extend_u/i32, TokenType::Convert, Opcode::I64ExtendI32U
i64.reinterpret/f64, TokenType::Convert, Opcode::I64ReinterpretF64
i64.trunc_s/f32, TokenType::Convert, Opcode::I64TruncF32S
i64.trunc_s/f64, TokenType::Convert, Opcode::I64TruncF64S
i64.trunc_s:sat/f32, TokenType::Convert, Opcode::I64TruncSatF32S
i64.trunc_s:sat/f64, TokenType::Convert, Opcode::I64TruncSatF64S
i64.trunc_u/f32, TokenType::Convert, Opcode::I64TruncF32U
i64.trunc_u/f64, TokenType::Convert, Opcode::I64TruncF64U
i64.trunc_u:sat/f32, TokenType::Convert, Opcode::I64TruncSatF32U
i64.trunc_u:sat/f64, TokenType::Convert, Opcode::I64TruncSatF64U
set_global, TokenType::GlobalSet, Opcode::GlobalSet
set_local, TokenType::LocalSet, Opcode::LocalSet
tee_local, TokenType::LocalTee, Opcode::LocalTee
Loading

0 comments on commit 1f3a1d5

Please sign in to comment.