Skip to content

Commit

Permalink
Rename atomic.notify, *.atomic.wait (WebAssembly#1564)
Browse files Browse the repository at this point in the history
atomic.notify   -> memory.atomic.notify
i32.atomic.wait -> memory.atomic.wait32
i64.atomic.wait -> memory.atomic.wait64

These were renamed upstream a while ago, but the new names were not
added to wabt.
  • Loading branch information
binji committed Nov 3, 2020
1 parent 8e42376 commit 830d32a
Show file tree
Hide file tree
Showing 11 changed files with 548 additions and 539 deletions.
6 changes: 3 additions & 3 deletions src/binary-reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1373,7 +1373,7 @@ Result BinaryReader::ReadFunctionBody(Offset end_offset) {
CALLBACK0(OnOpcodeBare);
break;

case Opcode::AtomicNotify: {
case Opcode::MemoryAtomicNotify: {
Address alignment_log2;
CHECK_RESULT(ReadAlignment(&alignment_log2, "load alignment"));
Address offset;
Expand All @@ -1384,8 +1384,8 @@ Result BinaryReader::ReadFunctionBody(Offset end_offset) {
break;
}

case Opcode::I32AtomicWait:
case Opcode::I64AtomicWait: {
case Opcode::MemoryAtomicWait32:
case Opcode::MemoryAtomicWait64: {
Address alignment_log2;
CHECK_RESULT(ReadAlignment(&alignment_log2, "load alignment"));
Address offset;
Expand Down
6 changes: 3 additions & 3 deletions src/interp/interp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1635,9 +1635,9 @@ RunResult Thread::StepInternal(Trap::Ptr* out_trap) {
case O::I32X4Abs: return DoSimdUnop(IntAbs<u32>);

case O::AtomicFence:
case O::AtomicNotify:
case O::I32AtomicWait:
case O::I64AtomicWait:
case O::MemoryAtomicNotify:
case O::MemoryAtomicWait32:
case O::MemoryAtomicWait64:
return TRAP("not implemented");

case O::I32AtomicLoad: return DoAtomicLoad<u32>(instr, out_trap);
Expand Down
6 changes: 3 additions & 3 deletions src/interp/istream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ Instr Istream::Read(Offset* offset) const {
instr.imm_u32x2.snd = ReadAt<u32>(offset);
break;

case Opcode::AtomicNotify:
case Opcode::MemoryAtomicNotify:
case Opcode::F32Store:
case Opcode::F64Store:
case Opcode::I32AtomicRmw16AddU:
Expand Down Expand Up @@ -610,12 +610,12 @@ Instr Istream::Read(Offset* offset) const {
case Opcode::I32AtomicRmw16CmpxchgU:
case Opcode::I32AtomicRmw8CmpxchgU:
case Opcode::I32AtomicRmwCmpxchg:
case Opcode::I32AtomicWait:
case Opcode::I64AtomicRmw16CmpxchgU:
case Opcode::I64AtomicRmw32CmpxchgU:
case Opcode::I64AtomicRmw8CmpxchgU:
case Opcode::I64AtomicRmwCmpxchg:
case Opcode::I64AtomicWait:
case Opcode::MemoryAtomicWait32:
case Opcode::MemoryAtomicWait64:
// Index and memory offset immediates, 3 operands.
instr.kind = InstrKind::Imm_Index_Offset_Op_3;
instr.imm_u32x2.fst = ReadAt<u32>(offset);
Expand Down
9 changes: 6 additions & 3 deletions src/lexer-keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ assert_return, TokenType::AssertReturn
assert_trap, TokenType::AssertTrap
assert_unlinkable, TokenType::AssertUnlinkable
atomic.fence, TokenType::AtomicFence, Opcode::AtomicFence
atomic.notify, TokenType::AtomicNotify, Opcode::AtomicNotify
binary, TokenType::Bin
block, TokenType::Block, Opcode::Block
br_if, TokenType::BrIf, Opcode::BrIf
Expand Down Expand Up @@ -243,7 +242,6 @@ i32.atomic.rmw.xor, TokenType::AtomicRmw, Opcode::I32AtomicRmwXor
i32.atomic.store16, TokenType::AtomicStore, Opcode::I32AtomicStore16
i32.atomic.store8, TokenType::AtomicStore, Opcode::I32AtomicStore8
i32.atomic.store, TokenType::AtomicStore, Opcode::I32AtomicStore
i32.atomic.wait, TokenType::AtomicWait, Opcode::I32AtomicWait
i32.clz, TokenType::Unary, Opcode::I32Clz
i32.const, TokenType::Const, Opcode::I32Const
i32.ctz, TokenType::Unary, Opcode::I32Ctz
Expand Down Expand Up @@ -368,7 +366,6 @@ i64.atomic.store16, TokenType::AtomicStore, Opcode::I64AtomicStore16
i64.atomic.store32, TokenType::AtomicStore, Opcode::I64AtomicStore32
i64.atomic.store8, TokenType::AtomicStore, Opcode::I64AtomicStore8
i64.atomic.store, TokenType::AtomicStore, Opcode::I64AtomicStore
i64.atomic.wait, TokenType::AtomicWait, Opcode::I64AtomicWait
i64.clz, TokenType::Unary, Opcode::I64Clz
i64.const, TokenType::Const, Opcode::I64Const
i64.ctz, TokenType::Unary, Opcode::I64Ctz
Expand Down Expand Up @@ -482,6 +479,9 @@ local.set, TokenType::LocalSet, Opcode::LocalSet
local.tee, TokenType::LocalTee, Opcode::LocalTee
local, TokenType::Local
loop, TokenType::Loop, Opcode::Loop
memory.atomic.notify, TokenType::AtomicNotify, Opcode::MemoryAtomicNotify
memory.atomic.wait32, TokenType::AtomicWait, Opcode::MemoryAtomicWait32
memory.atomic.wait64, TokenType::AtomicWait, Opcode::MemoryAtomicWait64
memory.copy, TokenType::MemoryCopy, Opcode::MemoryCopy
memory.fill, TokenType::MemoryFill, Opcode::MemoryFill
memory.grow, TokenType::MemoryGrow, Opcode::MemoryGrow
Expand Down Expand Up @@ -541,6 +541,9 @@ v128.load8_splat, TokenType::Load, Opcode::V128Load8Splat
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
Expand Down
6 changes: 3 additions & 3 deletions src/opcode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ bool Opcode::IsEnabled(const Features& features) const {
case Opcode::I64Extend32S:
return features.sign_extension_enabled();

case Opcode::AtomicNotify:
case Opcode::I32AtomicWait:
case Opcode::I64AtomicWait:
case Opcode::MemoryAtomicNotify:
case Opcode::MemoryAtomicWait32:
case Opcode::MemoryAtomicWait64:
case Opcode::AtomicFence:
case Opcode::I32AtomicLoad:
case Opcode::I64AtomicLoad:
Expand Down
6 changes: 3 additions & 3 deletions src/opcode.def
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,9 @@ WABT_OPCODE(V128, V128, ___, ___, 0, 0xfd, 0xfa, F32X4ConvertI32X4S, "f32x4.c
WABT_OPCODE(V128, V128, ___, ___, 0, 0xfd, 0xfb, F32X4ConvertI32X4U, "f32x4.convert_i32x4_u", "")

/* Thread opcodes (--enable-threads) */
WABT_OPCODE(I32, I32, I32, ___, 4, 0xfe, 0x00, AtomicNotify, "atomic.notify", "")
WABT_OPCODE(I32, I32, I32, I64, 4, 0xfe, 0x01, I32AtomicWait, "i32.atomic.wait", "")
WABT_OPCODE(I32, I32, I64, I64, 8, 0xfe, 0x02, I64AtomicWait, "i64.atomic.wait", "")
WABT_OPCODE(I32, I32, I32, ___, 4, 0xfe, 0x00, MemoryAtomicNotify, "memory.atomic.notify", "")
WABT_OPCODE(I32, I32, I32, I64, 4, 0xfe, 0x01, MemoryAtomicWait32, "memory.atomic.wait32", "")
WABT_OPCODE(I32, I32, I64, I64, 8, 0xfe, 0x02, MemoryAtomicWait64, "memory.atomic.wait64", "")
WABT_OPCODE(___, ___, ___, ___, 0, 0xfe, 0x03, AtomicFence, "atomic.fence", "")
WABT_OPCODE(I32, I32, ___, ___, 4, 0xfe, 0x10, I32AtomicLoad, "i32.atomic.load", "")
WABT_OPCODE(I64, I32, ___, ___, 8, 0xfe, 0x11, I64AtomicLoad, "i64.atomic.load", "")
Expand Down
Loading

0 comments on commit 830d32a

Please sign in to comment.