From dba0a08963d0452a773b9abbdd789503945c5f43 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 29 Mar 2023 17:10:08 -0700 Subject: Do not treat `atomic.fence` as using a memory (#5603) * Do not treat `atomic.fence` as using a memory Update RemoveUnusedModuleElements so that it no longer keeps the memory alive due to an `atomic.fence` instruction and update validation to allow modules to use `atomic.fence` without a memory. * update wasm2js tests --- src/passes/RemoveUnusedModuleElements.cpp | 1 - src/wasm/wasm-validator.cpp | 2 -- 2 files changed, 3 deletions(-) (limited to 'src') diff --git a/src/passes/RemoveUnusedModuleElements.cpp b/src/passes/RemoveUnusedModuleElements.cpp index 6ad804e0b..103be5e4a 100644 --- a/src/passes/RemoveUnusedModuleElements.cpp +++ b/src/passes/RemoveUnusedModuleElements.cpp @@ -138,7 +138,6 @@ struct ReferenceFinder : public PostWalker { void visitAtomicRMW(AtomicRMW* curr) { usesMemory = true; } void visitAtomicWait(AtomicWait* curr) { usesMemory = true; } void visitAtomicNotify(AtomicNotify* curr) { usesMemory = true; } - void visitAtomicFence(AtomicFence* curr) { usesMemory = true; } void visitMemoryInit(MemoryInit* curr) { usesMemory = true; } void visitDataDrop(DataDrop* curr) { // TODO: Replace this with a use of a data segment (#5224). diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 123a15c1e..8abcd92fe 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -1172,8 +1172,6 @@ void FunctionValidator::visitAtomicNotify(AtomicNotify* curr) { } void FunctionValidator::visitAtomicFence(AtomicFence* curr) { - shouldBeFalse( - getModule()->memories.empty(), curr, "Memory operations require a memory"); shouldBeTrue(getModule()->features.hasAtomics(), curr, "Atomic operations require threads [--enable-threads]"); -- cgit v1.2.3