From 6ddacde514af7cc546caa07fede4baa3e429c33c Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Fri, 20 Dec 2024 17:45:47 -0800 Subject: [NFC] Make MemoryOrder parameters non-optional (#7171) Update Builder and IRBuilder makeStructGet and makeStructSet functions to require the memory order to be explicitly supplied. This is slightly more verbose, but will reduce the chances that we forget to properly consider synchronization when implementing new features in the future. --- src/wasm/wasm-binary.cpp | 8 +++++--- src/wasm/wasm-ir-builder.cpp | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/wasm') diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index b0c5a54ac..2bcf3d446 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -4172,13 +4172,15 @@ Result<> WasmBinaryReader::readInst() { case BinaryConsts::StructGetU: { auto type = getIndexedHeapType(); auto field = getU32LEB(); - return builder.makeStructGet( - type, field, op == BinaryConsts::StructGetS); + return builder.makeStructGet(type, + field, + op == BinaryConsts::StructGetS, + MemoryOrder::Unordered); } case BinaryConsts::StructSet: { auto type = getIndexedHeapType(); auto field = getU32LEB(); - return builder.makeStructSet(type, field); + return builder.makeStructSet(type, field, MemoryOrder::Unordered); } case BinaryConsts::ArrayNew: return builder.makeArrayNew(getIndexedHeapType()); diff --git a/src/wasm/wasm-ir-builder.cpp b/src/wasm/wasm-ir-builder.cpp index 4b0342410..3c966769c 100644 --- a/src/wasm/wasm-ir-builder.cpp +++ b/src/wasm/wasm-ir-builder.cpp @@ -1801,7 +1801,7 @@ Result<> IRBuilder::makeStructGet(HeapType type, CHECK_ERR(ChildPopper{*this}.visitStructGet(&curr, type)); CHECK_ERR(validateTypeAnnotation(type, curr.ref)); push( - builder.makeStructGet(field, curr.ref, fields[field].type, signed_, order)); + builder.makeStructGet(field, curr.ref, order, fields[field].type, signed_)); return Ok{}; } -- cgit v1.2.3