summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-12-17 20:01:23 -0800
committerGitHub <noreply@github.com>2024-12-18 04:01:23 +0000
commit7c8cd2f4a51213964f6f1ec11e54d2b6e721cdaf (patch)
tree6440ab4fb4a1c572a5a82f3fcb9766fc8d505c5e /scripts
parent9f5f8dd2ffe0b89ea071aea3d2b3efad42dada4f (diff)
downloadbinaryen-7c8cd2f4a51213964f6f1ec11e54d2b6e721cdaf.tar.gz
binaryen-7c8cd2f4a51213964f6f1ec11e54d2b6e721cdaf.tar.bz2
binaryen-7c8cd2f4a51213964f6f1ec11e54d2b6e721cdaf.zip
Support atomic struct accessors (#7155)
Implement support for both sequentially consistent and acquire-release variants of `struct.atomic.get` and `struct.atomic.set`, as proposed by shared-everything-threads. Introduce a new `MemoryOrdering` enum for describing different levels of atomicity (or the lack thereof). This new enum should eventually be adopted by linear memory atomic accessors as well to support acquire-release semantics, but for now just use it in `StructGet` and `StructSet`. In addition to implementing parsing and emitting for the instructions, validate that shared-everything is enabled to use them, mark them as having synchronization side effects, and lightly optimize them by relaxing acquire-release accesses to non-shared structs to normal, unordered accesses. This is valid because such accesses cannot possibly synchronize with other threads. Also update Precompute to avoid optimizing out synchronization points. There are probably other passes that need to be updated to avoid incorrectly optimizing synchronizing accesses, but identifying and fixing them is left as future work.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/gen-s-parser.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/gen-s-parser.py b/scripts/gen-s-parser.py
index d15c07e8e..b5592d433 100755
--- a/scripts/gen-s-parser.py
+++ b/scripts/gen-s-parser.py
@@ -617,7 +617,11 @@ instructions = [
("struct.get", "makeStructGet()"),
("struct.get_s", "makeStructGet(true)"),
("struct.get_u", "makeStructGet(false)"),
+ ("struct.atomic.get", "makeAtomicStructGet()"),
+ ("struct.atomic.get_s", "makeAtomicStructGet(true)"),
+ ("struct.atomic.get_u", "makeAtomicStructGet(false)"),
("struct.set", "makeStructSet()"),
+ ("struct.atomic.set", "makeAtomicStructSet()"),
("array.new", "makeArrayNew(false)"),
("array.new_default", "makeArrayNew(true)"),
("array.new_data", "makeArrayNewData()"),