From d6b5411a766701ce13ebdd5b81c294e9867e16e8 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 2 Jan 2024 17:34:21 -0800 Subject: [PATCH 1/2] Use the standard shared memory text format Update the legacy text parser and all tests to use the standard text format for shared memories, e.g. `(memory $m 1 1 shared)` rather than `(memory $m (shared 1 1))`. Also remove support for non-standard in-line "data" or "segment" declarations. This change makes the tests more compatible with the new text parser, which only supports the standard format. --- src/passes/Print.cpp | 6 +- src/wasm/wasm-s-parser.cpp | 66 +-------- test/example/c-api-kitchen-sink.txt | 2 +- test/example/module-splitting.cpp | 6 +- test/example/module-splitting.txt | 18 +-- test/lit/basic/atomics.wast | 8 +- test/lit/basic/atomics64.wast | 8 +- test/lit/basic/memory-shared.wast | 8 +- test/lit/basic/multi-memories-atomics64.wast | 24 +-- test/lit/basic/nonspec-bulk-memory.wast | 137 ------------------ test/lit/basic/unreachable-instr-type.wast | 8 +- test/lit/ctor-eval/array_new_data.wast | 4 +- test/lit/ctor-eval/v128.wast | 4 +- .../passes/code-folding_enable-threads.wast | 5 +- .../passes/flatten_dfo_O3_enable-threads.wast | 5 +- ...g_souperify-single-use_enable-threads.wast | 4 +- ...ls-nonesting_souperify_enable-threads.wast | 4 +- .../inlining-optimizing_enable-threads.wast | 4 +- .../passes/memory-packing_all-features.wast | 8 +- .../passes/merge-similar-functions_types.wast | 4 +- .../passes/optimize-instructions-atomics.wast | 4 +- ...e-unused-module-elements_all-features.wast | 22 +-- test/lit/validation/shared-memory.wast | 4 +- ...ment-in-secondary-memory-custom-names.wast | 2 +- .../instrument-in-secondary-memory.wast | 2 +- test/lit/wasm-split/profile-guided.wast | 2 +- test/lit/wat-kitchen-sink.wast | 6 +- test/lld/em_asm_pthread.wasm.out | 2 +- test/passes/fuzz-exec_all-features.txt | 8 +- test/passes/fuzz-exec_all-features.wast | 8 +- test/passes/pick-load-signs_all-features.txt | 2 +- test/passes/pick-load-signs_all-features.wast | 2 +- test/passes/precompute_all-features.txt | 2 +- test/passes/precompute_all-features.wast | 4 +- test/passes/remove-memory.txt | 2 +- test/passes/remove-memory.wast | 7 +- ...unused-names_merge-blocks_all-features.txt | 2 +- ...nused-names_merge-blocks_all-features.wast | 2 +- ...nfunction-module-elements_all-features.txt | 10 +- ...function-module-elements_all-features.wast | 10 +- .../safe-heap_enable-threads_enable-simd.txt | 4 +- .../safe-heap_enable-threads_enable-simd.wast | 4 +- ...safe-heap_enable-threads_enable-simd64.txt | 4 +- ...afe-heap_enable-threads_enable-simd64.wast | 4 +- ...mory-unused_enable-threads_enable-simd.txt | 4 +- ...ory-unused_enable-threads_enable-simd.wast | 4 +- test/passes/simplify-locals_all-features.txt | 4 +- test/passes/simplify-locals_all-features.wast | 4 +- ...ll-features_disable-exception-handling.txt | 2 +- ...l-features_disable-exception-handling.wast | 2 +- test/passes/ssa_fuzz-exec_enable-threads.txt | 2 +- test/passes/ssa_fuzz-exec_enable-threads.wast | 3 +- test/print/memory-import-shared.minified.txt | 2 +- test/print/memory-import-shared.txt | 2 +- test/print/memory-import-shared.wast | 2 +- test/print/memory-shared.minified.txt | 2 +- test/print/memory-shared.txt | 2 +- test/print/memory-shared.wast | 2 +- test/spec/atomics.wast | 2 +- test/wasm2js/atomic_fence.wast | 2 +- test/wasm2js/atomics_32.wast | 2 +- 61 files changed, 148 insertions(+), 347 deletions(-) delete mode 100644 test/lit/basic/nonspec-bulk-memory.wast diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 5e290ebca9d..dcd43c323e2 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -3148,10 +3148,6 @@ void PrintSExpression::printMemoryHeader(Memory* curr) { o << '('; printMedium(o, "memory") << ' '; printName(curr->name, o) << ' '; - if (curr->shared) { - o << '('; - printMedium(o, "shared "); - } if (curr->is64()) { o << "i64 "; } @@ -3160,7 +3156,7 @@ void PrintSExpression::printMemoryHeader(Memory* curr) { o << ' ' << curr->max; } if (curr->shared) { - o << ")"; + printMedium(o, " shared"); } o << ")"; } diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index 9f5f412be82..41a5b188495 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -3480,7 +3480,7 @@ Index SExpressionWasmBuilder::parseMemoryLimits( void SExpressionWasmBuilder::parseMemory(Element& s, bool preParseImport) { auto memory = std::make_unique(); - memory->shared = false; + memory->shared = *s[s.size() - 1] == SHARED; Index i = 1; if (s[i]->dollared()) { memory->setExplicitName(s[i++]->str()); @@ -3507,10 +3507,6 @@ void SExpressionWasmBuilder::parseMemory(Element& s, bool preParseImport) { memory->module = inner[1]->str(); memory->base = inner[2]->str(); i++; - } else if (elementStartsWith(inner, SHARED)) { - memory->shared = true; - parseMemoryLimits(inner, 1, memory); - i++; } else { if (!(inner.size() > 0 ? inner[0]->str() != IMPORT : true)) { throw SParseException("bad import ending", inner); @@ -3533,52 +3529,9 @@ void SExpressionWasmBuilder::parseMemory(Element& s, bool preParseImport) { return; } } - if (!memory->shared) { - i = parseMemoryLimits(s, i, memory); - } - - // Parse memory initializers. - while (i < s.size()) { - Element& curr = *s[i]; - size_t j = 1; - Address offsetValue; - if (elementStartsWith(curr, DATA)) { - offsetValue = 0; - } else { - auto offsetElem = curr[j++]; - offsetValue = getAddress(offsetElem); - if (!memory->is64()) { - checkAddress(offsetValue, "excessive memory offset", offsetElem); - } - } - std::string_view input = curr[j]->str().str; - auto* offset = allocator.alloc(); - if (memory->is64()) { - offset->type = Type::i64; - offset->value = Literal(offsetValue); - } else { - offset->type = Type::i32; - offset->value = Literal(int32_t(offsetValue)); - } - if (input.size()) { - std::vector data; - stringToBinary(*curr[j], input, data); - auto segment = Builder::makeDataSegment(Name::fromInt(dataCounter++), - memory->name, - false, - offset, - data.data(), - data.size()); - segment->hasExplicitName = false; - dataSegmentNames.push_back(segment->name); - wasm.addDataSegment(std::move(segment)); - } else { - auto segment = Builder::makeDataSegment( - Name::fromInt(dataCounter++), memory->name, false, offset); - segment->hasExplicitName = false; - wasm.addDataSegment(std::move(segment)); - } - i++; + i = parseMemoryLimits(s, i, memory); + if (i + int(memory->shared) != s.size()) { + throw SParseException("expected end of memory", *s[i]); } wasm.addMemory(std::move(memory)); } @@ -3774,15 +3727,10 @@ void SExpressionWasmBuilder::parseImport(Element& s) { memory->base = base; memoryNames.push_back(name); - if (inner[j]->isList()) { - auto& limits = *inner[j]; - if (!elementStartsWith(limits, SHARED)) { - throw SParseException("bad memory limit declaration", inner, *inner[j]); - } + j = parseMemoryLimits(inner, j, memory); + if (j != inner.size() && *inner[j] == SHARED) { memory->shared = true; - j = parseMemoryLimits(limits, 1, memory); - } else { - j = parseMemoryLimits(inner, j, memory); + j++; } wasm.addMemory(std::move(memory)); diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index 8955921b85b..06ec3a1b7d1 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -88,7 +88,7 @@ BinaryenFeatureAll: 131071 )) (global $i32Struct-global (mut (ref null $1)) (struct.new_default $1)) (global $string-global (mut stringref) (string.const "")) - (memory $0 (shared 1 256)) + (memory $0 1 256 shared) (data $0 (i32.const 10) "hello, world") (data $1 "I am passive") (table $tab 0 100 funcref) diff --git a/test/example/module-splitting.cpp b/test/example/module-splitting.cpp index 95d6de44cad..cb3df4e78e3 100644 --- a/test/example/module-splitting.cpp +++ b/test/example/module-splitting.cpp @@ -73,7 +73,7 @@ int main() { // Global stuff do_test({}, R"( (module - (memory $mem (shared 3 42)) + (memory $mem 3 42 shared) (table $tab 3 42 funcref) (global $glob (mut i32) (i32.const 7)) (tag $e (param i32)) @@ -82,7 +82,7 @@ int main() { // Imported global stuff do_test({}, R"( (module - (import "env" "mem" (memory $mem (shared 3 42))) + (import "env" "mem" (memory $mem 3 42 shared)) (import "env" "tab" (table $tab 3 42 funcref)) (import "env" "glob" (global $glob (mut i32))) (import "env" "e" (tag $e (param i32))) @@ -91,7 +91,7 @@ int main() { // Exported global stuff do_test({}, R"( (module - (memory $mem (shared 3 42)) + (memory $mem 3 42 shared) (table $tab 3 42 funcref) (global $glob (mut i32) (i32.const 7)) (tag $e (param i32)) diff --git a/test/example/module-splitting.txt b/test/example/module-splitting.txt index 69146cbf95d..b083e8967b6 100644 --- a/test/example/module-splitting.txt +++ b/test/example/module-splitting.txt @@ -14,7 +14,7 @@ Before: (module (type $0 (func (param i32))) (global $glob (mut i32) (i32.const 7)) - (memory $mem (shared 3 42)) + (memory $mem 3 42 shared) (table $tab 3 42 funcref) (tag $e (param i32)) ) @@ -23,7 +23,7 @@ After: (module (type $0 (func (param i32))) (global $glob (mut i32) (i32.const 7)) - (memory $mem (shared 3 42)) + (memory $mem 3 42 shared) (table $tab 3 42 funcref) (tag $e (param i32)) (export "%memory" (memory $mem)) @@ -34,7 +34,7 @@ After: Secondary: (module (type $0 (func (param i32))) - (import "primary" "%memory" (memory $mem (shared 3 42))) + (import "primary" "%memory" (memory $mem 3 42 shared)) (import "primary" "%table" (table $tab 3 42 funcref)) (import "primary" "%global" (global $glob (mut i32))) (import "primary" "%tag" (tag $e (param i32))) @@ -44,7 +44,7 @@ Secondary: Before: (module (type $0 (func (param i32))) - (import "env" "mem" (memory $mem (shared 3 42))) + (import "env" "mem" (memory $mem 3 42 shared)) (import "env" "tab" (table $tab 3 42 funcref)) (import "env" "glob" (global $glob (mut i32))) (import "env" "e" (tag $e (param i32))) @@ -53,7 +53,7 @@ Keeping: After: (module (type $0 (func (param i32))) - (import "env" "mem" (memory $mem (shared 3 42))) + (import "env" "mem" (memory $mem 3 42 shared)) (import "env" "tab" (table $tab 3 42 funcref)) (import "env" "glob" (global $glob (mut i32))) (import "env" "e" (tag $e (param i32))) @@ -65,7 +65,7 @@ After: Secondary: (module (type $0 (func (param i32))) - (import "primary" "%memory" (memory $mem (shared 3 42))) + (import "primary" "%memory" (memory $mem 3 42 shared)) (import "primary" "%table" (table $tab 3 42 funcref)) (import "primary" "%global" (global $glob (mut i32))) (import "primary" "%tag" (tag $e (param i32))) @@ -76,7 +76,7 @@ Before: (module (type $0 (func (param i32))) (global $glob (mut i32) (i32.const 7)) - (memory $mem (shared 3 42)) + (memory $mem 3 42 shared) (table $tab 3 42 funcref) (tag $e (param i32)) (export "mem" (memory $mem)) @@ -89,7 +89,7 @@ After: (module (type $0 (func (param i32))) (global $glob (mut i32) (i32.const 7)) - (memory $mem (shared 3 42)) + (memory $mem 3 42 shared) (table $tab 3 42 funcref) (tag $e (param i32)) (export "mem" (memory $mem)) @@ -100,7 +100,7 @@ After: Secondary: (module (type $0 (func (param i32))) - (import "primary" "mem" (memory $mem (shared 3 42))) + (import "primary" "mem" (memory $mem 3 42 shared)) (import "primary" "tab" (table $tab 3 42 funcref)) (import "primary" "glob" (global $glob (mut i32))) (import "primary" "e" (tag $e (param i32))) diff --git a/test/lit/basic/atomics.wast b/test/lit/basic/atomics.wast index ef98afe4e9a..e73d6b6111d 100644 --- a/test/lit/basic/atomics.wast +++ b/test/lit/basic/atomics.wast @@ -14,10 +14,10 @@ ;; CHECK-BIN: (type $0 (func)) ;; CHECK-BIN-NODEBUG: (type $0 (func)) (type $0 (func)) - ;; CHECK-TEXT: (memory $0 (shared 23 256)) - ;; CHECK-BIN: (memory $0 (shared 23 256)) - ;; CHECK-BIN-NODEBUG: (memory $0 (shared 23 256)) - (memory $0 (shared 23 256)) + ;; CHECK-TEXT: (memory $0 23 256 shared) + ;; CHECK-BIN: (memory $0 23 256 shared) + ;; CHECK-BIN-NODEBUG: (memory $0 23 256 shared) + (memory $0 23 256 shared) ;; CHECK-TEXT: (func $atomic-loadstore (type $0) ;; CHECK-TEXT-NEXT: (local $0 i32) diff --git a/test/lit/basic/atomics64.wast b/test/lit/basic/atomics64.wast index b30b1ce6e36..255ecc033c3 100644 --- a/test/lit/basic/atomics64.wast +++ b/test/lit/basic/atomics64.wast @@ -14,10 +14,10 @@ ;; CHECK-BIN: (type $0 (func)) ;; CHECK-BIN-NODEBUG: (type $0 (func)) (type $0 (func)) - ;; CHECK-TEXT: (memory $0 (shared i64 23 256)) - ;; CHECK-BIN: (memory $0 (shared i64 23 256)) - ;; CHECK-BIN-NODEBUG: (memory $0 (shared i64 23 256)) - (memory $0 (shared i64 23 256)) + ;; CHECK-TEXT: (memory $0 i64 23 256 shared) + ;; CHECK-BIN: (memory $0 i64 23 256 shared) + ;; CHECK-BIN-NODEBUG: (memory $0 i64 23 256 shared) + (memory $0 i64 23 256 shared) ;; CHECK-TEXT: (func $atomic-loadstore (type $0) ;; CHECK-TEXT-NEXT: (local $0 i64) diff --git a/test/lit/basic/memory-shared.wast b/test/lit/basic/memory-shared.wast index bc2f8baccf7..fe15c20e714 100644 --- a/test/lit/basic/memory-shared.wast +++ b/test/lit/basic/memory-shared.wast @@ -10,8 +10,8 @@ ;; RUN: cat %t.bin.nodebug.wast | filecheck %s --check-prefix=CHECK-BIN-NODEBUG (module - ;; CHECK-TEXT: (memory $0 (shared 23 256)) - ;; CHECK-BIN: (memory $0 (shared 23 256)) - ;; CHECK-BIN-NODEBUG: (memory $0 (shared 23 256)) - (memory $0 (shared 23 256)) + ;; CHECK-TEXT: (memory $0 23 256 shared) + ;; CHECK-BIN: (memory $0 23 256 shared) + ;; CHECK-BIN-NODEBUG: (memory $0 23 256 shared) + (memory $0 23 256 shared) ) diff --git a/test/lit/basic/multi-memories-atomics64.wast b/test/lit/basic/multi-memories-atomics64.wast index 79afddb3b9b..0795d10ad74 100644 --- a/test/lit/basic/multi-memories-atomics64.wast +++ b/test/lit/basic/multi-memories-atomics64.wast @@ -14,15 +14,15 @@ ;; CHECK-BIN: (type $0 (func)) ;; CHECK-BIN-NODEBUG: (type $0 (func)) (type $0 (func)) - ;; CHECK-TEXT: (memory $appMemory (shared i64 23 256)) - ;; CHECK-BIN: (memory $appMemory (shared i64 23 256)) - (memory $appMemory (shared i64 23 256)) - ;; CHECK-TEXT: (memory $dataMemory (shared i64 23 256)) - ;; CHECK-BIN: (memory $dataMemory (shared i64 23 256)) - (memory $dataMemory (shared i64 23 256)) - ;; CHECK-TEXT: (memory $instrumentMemory (shared i64 23 256)) - ;; CHECK-BIN: (memory $instrumentMemory (shared i64 23 256)) - (memory $instrumentMemory (shared i64 23 256)) + ;; CHECK-TEXT: (memory $appMemory i64 23 256 shared) + ;; CHECK-BIN: (memory $appMemory i64 23 256 shared) + (memory $appMemory i64 23 256 shared) + ;; CHECK-TEXT: (memory $dataMemory i64 23 256 shared) + ;; CHECK-BIN: (memory $dataMemory i64 23 256 shared) + (memory $dataMemory i64 23 256 shared) + ;; CHECK-TEXT: (memory $instrumentMemory i64 23 256 shared) + ;; CHECK-BIN: (memory $instrumentMemory i64 23 256 shared) + (memory $instrumentMemory i64 23 256 shared) ;; CHECK-TEXT: (func $atomic-loadstore (type $0) ;; CHECK-TEXT-NEXT: (local $0 i64) @@ -1064,11 +1064,11 @@ (atomic.fence) ) ) -;; CHECK-BIN-NODEBUG: (memory $0 (shared i64 23 256)) +;; CHECK-BIN-NODEBUG: (memory $0 i64 23 256 shared) -;; CHECK-BIN-NODEBUG: (memory $1 (shared i64 23 256)) +;; CHECK-BIN-NODEBUG: (memory $1 i64 23 256 shared) -;; CHECK-BIN-NODEBUG: (memory $2 (shared i64 23 256)) +;; CHECK-BIN-NODEBUG: (memory $2 i64 23 256 shared) ;; CHECK-BIN-NODEBUG: (func $0 (type $0) ;; CHECK-BIN-NODEBUG-NEXT: (local $0 i64) diff --git a/test/lit/basic/nonspec-bulk-memory.wast b/test/lit/basic/nonspec-bulk-memory.wast deleted file mode 100644 index 980598f5d91..00000000000 --- a/test/lit/basic/nonspec-bulk-memory.wast +++ /dev/null @@ -1,137 +0,0 @@ -;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited. - -;; RUN: wasm-opt %s -all -o %t.text.wast -g -S -;; RUN: wasm-as %s -all -g -o %t.wasm -;; RUN: wasm-dis %t.wasm -all -o %t.bin.wast -;; RUN: wasm-as %s -all -o %t.nodebug.wasm -;; RUN: wasm-dis %t.nodebug.wasm -all -o %t.bin.nodebug.wast -;; RUN: cat %t.text.wast | filecheck %s --check-prefix=CHECK-TEXT -;; RUN: cat %t.bin.wast | filecheck %s --check-prefix=CHECK-BIN -;; RUN: cat %t.bin.nodebug.wast | filecheck %s --check-prefix=CHECK-BIN-NODEBUG - -(module - (memory 1024 1024 - (segment 0 "hello, world") - ) - - ;; CHECK-TEXT: (type $0 (func)) - - ;; CHECK-TEXT: (memory $0 1024 1024) - - ;; CHECK-TEXT: (data $0 (i32.const 0) "hello, world") - - ;; CHECK-TEXT: (func $memory.init (type $0) - ;; CHECK-TEXT-NEXT: (memory.init $0 - ;; CHECK-TEXT-NEXT: (i32.const 512) - ;; CHECK-TEXT-NEXT: (i32.const 0) - ;; CHECK-TEXT-NEXT: (i32.const 12) - ;; CHECK-TEXT-NEXT: ) - ;; CHECK-TEXT-NEXT: ) - ;; CHECK-BIN: (type $0 (func)) - - ;; CHECK-BIN: (memory $0 1024 1024) - - ;; CHECK-BIN: (data $0 (i32.const 0) "hello, world") - - ;; CHECK-BIN: (func $memory.init (type $0) - ;; CHECK-BIN-NEXT: (memory.init $0 - ;; CHECK-BIN-NEXT: (i32.const 512) - ;; CHECK-BIN-NEXT: (i32.const 0) - ;; CHECK-BIN-NEXT: (i32.const 12) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) - (func $memory.init - (memory.init 0 - (i32.const 512) - (i32.const 0) - (i32.const 12) - ) - ) - - ;; CHECK-TEXT: (func $data.drop (type $0) - ;; CHECK-TEXT-NEXT: (data.drop $0) - ;; CHECK-TEXT-NEXT: ) - ;; CHECK-BIN: (func $data.drop (type $0) - ;; CHECK-BIN-NEXT: (data.drop $0) - ;; CHECK-BIN-NEXT: ) - (func $data.drop - (data.drop 0) - ) - - ;; CHECK-TEXT: (func $memory.copy (type $0) - ;; CHECK-TEXT-NEXT: (memory.copy - ;; CHECK-TEXT-NEXT: (i32.const 512) - ;; CHECK-TEXT-NEXT: (i32.const 0) - ;; CHECK-TEXT-NEXT: (i32.const 12) - ;; CHECK-TEXT-NEXT: ) - ;; CHECK-TEXT-NEXT: ) - ;; CHECK-BIN: (func $memory.copy (type $0) - ;; CHECK-BIN-NEXT: (memory.copy - ;; CHECK-BIN-NEXT: (i32.const 512) - ;; CHECK-BIN-NEXT: (i32.const 0) - ;; CHECK-BIN-NEXT: (i32.const 12) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) - (func $memory.copy - (memory.copy - (i32.const 512) - (i32.const 0) - (i32.const 12) - ) - ) - - ;; CHECK-TEXT: (func $memory.fill (type $0) - ;; CHECK-TEXT-NEXT: (memory.fill - ;; CHECK-TEXT-NEXT: (i32.const 0) - ;; CHECK-TEXT-NEXT: (i32.const 42) - ;; CHECK-TEXT-NEXT: (i32.const 1024) - ;; CHECK-TEXT-NEXT: ) - ;; CHECK-TEXT-NEXT: ) - ;; CHECK-BIN: (func $memory.fill (type $0) - ;; CHECK-BIN-NEXT: (memory.fill - ;; CHECK-BIN-NEXT: (i32.const 0) - ;; CHECK-BIN-NEXT: (i32.const 42) - ;; CHECK-BIN-NEXT: (i32.const 1024) - ;; CHECK-BIN-NEXT: ) - ;; CHECK-BIN-NEXT: ) - (func $memory.fill - (memory.fill - (i32.const 0) - (i32.const 42) - (i32.const 1024) - ) - ) -) -;; CHECK-BIN-NODEBUG: (type $0 (func)) - -;; CHECK-BIN-NODEBUG: (memory $0 1024 1024) - -;; CHECK-BIN-NODEBUG: (data $0 (i32.const 0) "hello, world") - -;; CHECK-BIN-NODEBUG: (func $0 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (memory.init $0 -;; CHECK-BIN-NODEBUG-NEXT: (i32.const 512) -;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) -;; CHECK-BIN-NODEBUG-NEXT: (i32.const 12) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) - -;; CHECK-BIN-NODEBUG: (func $1 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (data.drop $0) -;; CHECK-BIN-NODEBUG-NEXT: ) - -;; CHECK-BIN-NODEBUG: (func $2 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (memory.copy -;; CHECK-BIN-NODEBUG-NEXT: (i32.const 512) -;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) -;; CHECK-BIN-NODEBUG-NEXT: (i32.const 12) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) - -;; CHECK-BIN-NODEBUG: (func $3 (type $0) -;; CHECK-BIN-NODEBUG-NEXT: (memory.fill -;; CHECK-BIN-NODEBUG-NEXT: (i32.const 0) -;; CHECK-BIN-NODEBUG-NEXT: (i32.const 42) -;; CHECK-BIN-NODEBUG-NEXT: (i32.const 1024) -;; CHECK-BIN-NODEBUG-NEXT: ) -;; CHECK-BIN-NODEBUG-NEXT: ) diff --git a/test/lit/basic/unreachable-instr-type.wast b/test/lit/basic/unreachable-instr-type.wast index ff6df8bac03..494678a3272 100644 --- a/test/lit/basic/unreachable-instr-type.wast +++ b/test/lit/basic/unreachable-instr-type.wast @@ -10,11 +10,11 @@ ;; RUN: cat %t.bin.nodebug.wast | filecheck %s --check-prefix=CHECK-BIN-NODEBUG (module - (memory (shared 1 1)) + (memory 1 1 shared) ;; CHECK-TEXT: (type $0 (func)) - ;; CHECK-TEXT: (memory $0 (shared 1 1)) + ;; CHECK-TEXT: (memory $0 1 1 shared) ;; CHECK-TEXT: (func $test (type $0) ;; CHECK-TEXT-NEXT: (i32.load @@ -41,7 +41,7 @@ ;; CHECK-TEXT-NEXT: ) ;; CHECK-BIN: (type $0 (func)) - ;; CHECK-BIN: (memory $0 (shared 1 1)) + ;; CHECK-BIN: (memory $0 1 1 shared) ;; CHECK-BIN: (func $test (type $0) ;; CHECK-BIN-NEXT: (unreachable) @@ -74,7 +74,7 @@ ) ;; CHECK-BIN-NODEBUG: (type $0 (func)) -;; CHECK-BIN-NODEBUG: (memory $0 (shared 1 1)) +;; CHECK-BIN-NODEBUG: (memory $0 1 1 shared) ;; CHECK-BIN-NODEBUG: (func $0 (type $0) ;; CHECK-BIN-NODEBUG-NEXT: (unreachable) diff --git a/test/lit/ctor-eval/array_new_data.wast b/test/lit/ctor-eval/array_new_data.wast index a185c171f0c..90551862dd6 100644 --- a/test/lit/ctor-eval/array_new_data.wast +++ b/test/lit/ctor-eval/array_new_data.wast @@ -7,8 +7,8 @@ ;; CHECK: (type $[i8] (array i8)) (type $[i8] (array i8)) - ;; CHECK: (memory $0 (shared 16 17)) - (memory $0 (shared 16 17)) + ;; CHECK: (memory $0 16 17 shared) + (memory $0 16 17 shared) ;; CHECK: (data $0 (i32.const 40) "") (data $0 (i32.const 40) "") ;; CHECK: (data $1 (i32.const 0) "") diff --git a/test/lit/ctor-eval/v128.wast b/test/lit/ctor-eval/v128.wast index 009ef57f25c..71a380623ef 100644 --- a/test/lit/ctor-eval/v128.wast +++ b/test/lit/ctor-eval/v128.wast @@ -6,8 +6,8 @@ ;; CHECK: (type $1 (func (result v128))) - ;; CHECK: (memory $0 (shared 16 17)) - (memory $0 (shared 16 17)) + ;; CHECK: (memory $0 16 17 shared) + (memory $0 16 17 shared) (export "v128" (func $v128)) ;; CHECK: (data $0 (i32.const 23) "\e0\ff\c0N\8e\00\00\fe\01\00\12\81\85\fd\ff\90") diff --git a/test/lit/passes/code-folding_enable-threads.wast b/test/lit/passes/code-folding_enable-threads.wast index 15b83f71bd7..487fbd3acda 100644 --- a/test/lit/passes/code-folding_enable-threads.wast +++ b/test/lit/passes/code-folding_enable-threads.wast @@ -262,8 +262,8 @@ (module ;; CHECK: (type $0 (func (result i32))) - ;; CHECK: (memory $0 (shared 1 1)) - (memory $0 (shared 1 1)) + ;; CHECK: (memory $0 1 1 shared) + (memory $0 1 1 shared) ;; CHECK: (export "func_2224" (func $0)) (export "func_2224" (func $0)) ;; CHECK: (func $0 (result i32) @@ -420,4 +420,3 @@ ) ) ) - diff --git a/test/lit/passes/flatten_dfo_O3_enable-threads.wast b/test/lit/passes/flatten_dfo_O3_enable-threads.wast index 55bf54dc911..ccb029060be 100644 --- a/test/lit/passes/flatten_dfo_O3_enable-threads.wast +++ b/test/lit/passes/flatten_dfo_O3_enable-threads.wast @@ -14,8 +14,8 @@ ;; CHECK: (type $4 (func (result i32))) - ;; CHECK: (memory $0 (shared 1 1)) - (memory $0 (shared 1 1)) + ;; CHECK: (memory $0 1 1 shared) + (memory $0 1 1 shared) ;; CHECK: (export "one" (func $one)) ;; CHECK: (export "two" (func $two)) @@ -264,4 +264,3 @@ ) ) ) - diff --git a/test/lit/passes/flatten_simplify-locals-nonesting_souperify-single-use_enable-threads.wast b/test/lit/passes/flatten_simplify-locals-nonesting_souperify-single-use_enable-threads.wast index 0bcc36de280..ea693d50230 100644 --- a/test/lit/passes/flatten_simplify-locals-nonesting_souperify-single-use_enable-threads.wast +++ b/test/lit/passes/flatten_simplify-locals-nonesting_souperify-single-use_enable-threads.wast @@ -30,8 +30,8 @@ ;; CHECK: (type $12 (func (param i32 i32 i32 i32 i32) (result i32))) - ;; CHECK: (memory $0 (shared 1 1)) - (memory $0 (shared 1 1)) + ;; CHECK: (memory $0 1 1 shared) + (memory $0 1 1 shared) ;; Figure 1a from the Souper paper https://arxiv.org/pdf/1711.04422.pdf ;; CHECK: (export "replaced-print-internal" (func $replaced-print-internal)) diff --git a/test/lit/passes/flatten_simplify-locals-nonesting_souperify_enable-threads.wast b/test/lit/passes/flatten_simplify-locals-nonesting_souperify_enable-threads.wast index 61430d653c0..e8d423058ac 100644 --- a/test/lit/passes/flatten_simplify-locals-nonesting_souperify_enable-threads.wast +++ b/test/lit/passes/flatten_simplify-locals-nonesting_souperify_enable-threads.wast @@ -30,8 +30,8 @@ ;; CHECK: (type $12 (func (param i32 i32 i32 i32 i32) (result i32))) - ;; CHECK: (memory $0 (shared 1 1)) - (memory $0 (shared 1 1)) + ;; CHECK: (memory $0 1 1 shared) + (memory $0 1 1 shared) ;; Figure 1a from the Souper paper https://arxiv.org/pdf/1711.04422.pdf ;; CHECK: (export "replaced-print-internal" (func $replaced-print-internal)) diff --git a/test/lit/passes/inlining-optimizing_enable-threads.wast b/test/lit/passes/inlining-optimizing_enable-threads.wast index 60385b11a24..631fc1fa58f 100644 --- a/test/lit/passes/inlining-optimizing_enable-threads.wast +++ b/test/lit/passes/inlining-optimizing_enable-threads.wast @@ -153,8 +153,8 @@ (module ;; CHECK: (type $0 (func (result i64))) - ;; CHECK: (memory $0 (shared 1 1)) - (memory $0 (shared 1 1)) + ;; CHECK: (memory $0 1 1 shared) + (memory $0 1 1 shared) (func $0 (result i32) (i32.atomic.store16 (i32.const 0) diff --git a/test/lit/passes/memory-packing_all-features.wast b/test/lit/passes/memory-packing_all-features.wast index dfcf5ce53f7..1f0886d66a8 100644 --- a/test/lit/passes/memory-packing_all-features.wast +++ b/test/lit/passes/memory-packing_all-features.wast @@ -2279,8 +2279,8 @@ ;; the wrong segments in the presence of unreferenced segments. ;; CHECK: (type $0 (func)) - ;; CHECK: (memory $0 (shared 1 1)) - (memory $0 (shared 1 1)) + ;; CHECK: (memory $0 1 1 shared) + (memory $0 1 1 shared) (data (i32.const 0) "") (data "foo") ;; CHECK: (data $1 "foo") @@ -2394,8 +2394,8 @@ (type $array (array (mut i32))) ;; CHECK: (type $1 (func (param (ref $array) i32 i32 i32))) - ;; CHECK: (memory $0 (shared 16 17)) - (memory $0 (shared 16 17)) + ;; CHECK: (memory $0 16 17 shared) + (memory $0 16 17 shared) ;; CHECK: (data $0 "") (data $0 "") ;; CHECK: (func $0 (type $1) (param $0 (ref $array)) (param $1 i32) (param $2 i32) (param $3 i32) diff --git a/test/lit/passes/merge-similar-functions_types.wast b/test/lit/passes/merge-similar-functions_types.wast index 717777ab7df..980f10cd9c1 100644 --- a/test/lit/passes/merge-similar-functions_types.wast +++ b/test/lit/passes/merge-similar-functions_types.wast @@ -120,8 +120,8 @@ ;; CHECK: (global $global$0 (mut i32) (i32.const 10)) (global $global$0 (mut i32) (i32.const 10)) - ;; CHECK: (memory $0 (shared 16 17)) - (memory $0 (shared 16 17)) + ;; CHECK: (memory $0 16 17 shared) + (memory $0 16 17 shared) ;; CHECK: (elem declare func $2 $3) diff --git a/test/lit/passes/optimize-instructions-atomics.wast b/test/lit/passes/optimize-instructions-atomics.wast index 29037186dcb..e59c6a4e79b 100644 --- a/test/lit/passes/optimize-instructions-atomics.wast +++ b/test/lit/passes/optimize-instructions-atomics.wast @@ -2,8 +2,8 @@ ;; RUN: wasm-opt %s --optimize-instructions --enable-threads -S -o - | filecheck %s (module - ;; CHECK: (import "env" "memory" (memory $0 (shared 256 256))) - (import "env" "memory" (memory $0 (shared 256 256))) + ;; CHECK: (import "env" "memory" (memory $0 256 256 shared)) + (import "env" "memory" (memory $0 256 256 shared)) ;; CHECK: (func $x ;; CHECK-NEXT: (drop diff --git a/test/lit/passes/remove-unused-module-elements_all-features.wast b/test/lit/passes/remove-unused-module-elements_all-features.wast index 15a843064b7..f287df88f0a 100644 --- a/test/lit/passes/remove-unused-module-elements_all-features.wast +++ b/test/lit/passes/remove-unused-module-elements_all-features.wast @@ -260,8 +260,8 @@ (module ;; more use checks ;; CHECK: (type $0 (func)) - ;; CHECK: (memory $0 (shared 23 256)) - (memory $0 (shared 23 256)) + ;; CHECK: (memory $0 23 256 shared) + (memory $0 23 256 shared) (export "user" $user) ;; CHECK: (export "user" (func $user)) @@ -278,8 +278,8 @@ (module ;; more use checks ;; CHECK: (type $0 (func (result i32))) - ;; CHECK: (memory $0 (shared 23 256)) - (memory $0 (shared 23 256)) + ;; CHECK: (memory $0 23 256 shared) + (memory $0 23 256 shared) (export "user" $user) ;; CHECK: (export "user" (func $user)) @@ -296,8 +296,8 @@ (module ;; more use checks ;; CHECK: (type $0 (func (result i32))) - ;; CHECK: (memory $0 (shared 23 256)) - (memory $0 (shared 23 256)) + ;; CHECK: (memory $0 23 256 shared) + (memory $0 23 256 shared) (export "user" $user) ;; CHECK: (export "user" (func $user)) @@ -315,8 +315,8 @@ (module ;; more use checks ;; CHECK: (type $0 (func)) - ;; CHECK: (memory $0 (shared 23 256)) - (memory $0 (shared 23 256)) + ;; CHECK: (memory $0 23 256 shared) + (memory $0 23 256 shared) (export "user" $user) ;; CHECK: (export "user" (func $user)) @@ -346,8 +346,8 @@ (module ;; more use checks ;; CHECK: (type $0 (func (result i32))) - ;; CHECK: (memory $0 (shared 23 256)) - (memory $0 (shared 23 256)) + ;; CHECK: (memory $0 23 256 shared) + (memory $0 23 256 shared) (export "user" $user) ;; CHECK: (export "user" (func $user)) @@ -362,7 +362,7 @@ ) ) (module ;; atomic.fence and data.drop do not use a memory, so should not keep the memory alive. - (memory $0 (shared 1 1)) + (memory $0 1 1 shared) (data "") (export "fake-user" $user) ;; CHECK: (type $0 (func)) diff --git a/test/lit/validation/shared-memory.wast b/test/lit/validation/shared-memory.wast index 03128756c99..34619594961 100644 --- a/test/lit/validation/shared-memory.wast +++ b/test/lit/validation/shared-memory.wast @@ -4,8 +4,8 @@ ;; RUN: wasm-opt %s --enable-threads -o - -S | filecheck %s --check-prefix ATOMICS ;; NO-ATOMICS: shared memory requires threads [--enable-threads] -;; ATOMICS: (memory $0 (shared 10 20)) +;; ATOMICS: (memory $0 10 20 shared) (module - (memory (shared 10 20)) + (memory 10 20 shared) ) diff --git a/test/lit/wasm-split/instrument-in-secondary-memory-custom-names.wast b/test/lit/wasm-split/instrument-in-secondary-memory-custom-names.wast index 9035a0b8b17..a211e5d8a5d 100644 --- a/test/lit/wasm-split/instrument-in-secondary-memory-custom-names.wast +++ b/test/lit/wasm-split/instrument-in-secondary-memory-custom-names.wast @@ -17,7 +17,7 @@ ) ;; Check that a memory import has been added for secondary memory -;; CHECK: (import "custom_env" "custom_name" (memory $custom_name (shared 1 1))) +;; CHECK: (import "custom_env" "custom_name" (memory $custom_name 1 1 shared)) ;; And the profiling function exported ;; CHECK: (export "__write_profile" (func $__write_profile)) diff --git a/test/lit/wasm-split/instrument-in-secondary-memory.wast b/test/lit/wasm-split/instrument-in-secondary-memory.wast index d68e4c1d667..26ac0ad18d9 100644 --- a/test/lit/wasm-split/instrument-in-secondary-memory.wast +++ b/test/lit/wasm-split/instrument-in-secondary-memory.wast @@ -17,7 +17,7 @@ ) ;; Check that a memory import has been added for secondary memory -;; CHECK: (import "env" "profile-data" (memory $profile-data (shared 1 1))) +;; CHECK: (import "env" "profile-data" (memory $profile-data 1 1 shared)) ;; And the profiling function exported ;; CHECK: (export "__write_profile" (func $__write_profile)) diff --git a/test/lit/wasm-split/profile-guided.wast b/test/lit/wasm-split/profile-guided.wast index 8270204a2a6..6828c19fcde 100644 --- a/test/lit/wasm-split/profile-guided.wast +++ b/test/lit/wasm-split/profile-guided.wast @@ -69,7 +69,7 @@ ;; NONE: Splitting out functions: bar, bar_callee, deep_foo_callee, foo, foo_callee, shared_callee, uncalled (module - (memory $mem (shared 1 1)) + (memory $mem 1 1 shared) (export "memory" (memory $mem)) (export "foo" (func $foo)) (export "bar" (func $bar)) diff --git a/test/lit/wat-kitchen-sink.wast b/test/lit/wat-kitchen-sink.wast index 479a8412d45..05aedd51985 100644 --- a/test/lit/wat-kitchen-sink.wast +++ b/test/lit/wat-kitchen-sink.wast @@ -216,7 +216,7 @@ ;; CHECK: (import "" "mem" (memory $mimport$0 0)) - ;; CHECK: (import "mod" "imported-m" (memory $m-imported (shared 1 2))) + ;; CHECK: (import "mod" "imported-m" (memory $m-imported 1 2 shared)) (import "mod" "imported-m" (memory $m-imported 1 2 shared)) ;; imported tables @@ -271,10 +271,10 @@ (global $i32 i32 i32.const 42) ;; memories - ;; CHECK: (memory $mem (shared 1 1)) + ;; CHECK: (memory $mem 1 1 shared) (memory $mem 1 1 shared) (memory 0 1 shared) - ;; CHECK: (memory $1 (shared 0 1)) + ;; CHECK: (memory $1 0 1 shared) ;; CHECK: (memory $mem-i32 0 1) (memory $mem-i32 i32 0 1) diff --git a/test/lld/em_asm_pthread.wasm.out b/test/lld/em_asm_pthread.wasm.out index 676178bd33a..40f61e3a71a 100644 --- a/test/lld/em_asm_pthread.wasm.out +++ b/test/lld/em_asm_pthread.wasm.out @@ -38,7 +38,7 @@ (type $36 (func (param i32 f64) (result i32))) (type $37 (func (param i32 i32 i32 i32) (result f64))) (type $38 (func (param i32 i32 i64 i32) (result i64))) - (import "env" "memory" (memory $mimport$0 (shared 256 256))) + (import "env" "memory" (memory $mimport$0 256 256 shared)) (import "env" "emscripten_asm_const_int" (func $fimport$0 (param i32 i32 i32) (result i32))) (import "env" "world" (func $fimport$1)) (import "env" "__cxa_thread_atexit" (func $fimport$2 (param i32 i32 i32) (result i32))) diff --git a/test/passes/fuzz-exec_all-features.txt b/test/passes/fuzz-exec_all-features.txt index 6a0ee8585c4..22ea5f06ad8 100644 --- a/test/passes/fuzz-exec_all-features.txt +++ b/test/passes/fuzz-exec_all-features.txt @@ -75,7 +75,7 @@ (type $2 (func (param i32 i32))) (type $3 (func)) (import "fuzzing-support" "log-i32" (func $fimport$0 (type $1) (param i32))) - (memory $0 (shared 1 1)) + (memory $0 1 1 shared) (export "unaligned_load" (func $unaligned_load)) (export "unaligned_load_offset" (func $unaligned_load_offset)) (export "aligned_for_size" (func $aligned_for_size)) @@ -148,7 +148,7 @@ [fuzz-exec] note result: unsigned_2_bytes => 65535 (module (type $0 (func (result i32))) - (memory $0 (shared 1 1)) + (memory $0 1 1 shared) (data $0 (i32.const 0) "\ff\ff") (export "unsigned_2_bytes" (func $unsigned_2_bytes)) (func $unsigned_2_bytes (type $0) (result i32) @@ -167,7 +167,7 @@ (type $0 (func (param i32))) (type $1 (func)) (import "fuzzing-support" "log-i32" (func $fimport$0 (type $0) (param i32))) - (memory $0 (shared 1 1)) + (memory $0 1 1 shared) (export "rmw-reads-modifies-and-writes" (func $rmw-reads-modifies-and-writes)) (func $rmw-reads-modifies-and-writes (type $1) (drop @@ -192,7 +192,7 @@ (type $0 (func (param i32))) (type $1 (func)) (import "fuzzing-support" "log-i32" (func $fimport$0 (type $0) (param i32))) - (memory $0 (shared 1 1)) + (memory $0 1 1 shared) (export "rmw-reads-modifies-and-writes-asymmetrical" (func $rmw-reads-modifies-and-writes-asymmetrical)) (func $rmw-reads-modifies-and-writes-asymmetrical (type $1) (drop diff --git a/test/passes/fuzz-exec_all-features.wast b/test/passes/fuzz-exec_all-features.wast index 2c9d95d16c9..bab6afb79e1 100644 --- a/test/passes/fuzz-exec_all-features.wast +++ b/test/passes/fuzz-exec_all-features.wast @@ -32,7 +32,7 @@ ) (module (import "fuzzing-support" "log-i32" (func $fimport$0 (param i32))) - (memory $0 (shared 1 1)) + (memory $0 1 1 shared) (func $unaligned_load (export "unaligned_load") (result i32) (i32.atomic.load (i32.const 1) ;; unaligned ptr @@ -78,7 +78,7 @@ ) ) (module - (memory $0 (shared 1 1)) + (memory $0 1 1 shared) (data (i32.const 0) "\ff\ff") (func $unsigned_2_bytes (export "unsigned_2_bytes") (result i32) (i32.atomic.rmw16.xor_u ;; should be unsigned @@ -89,7 +89,7 @@ ) (module (import "fuzzing-support" "log-i32" (func $fimport$0 (param i32))) - (memory $0 (shared 1 1)) + (memory $0 1 1 shared) (func $rmw-reads-modifies-and-writes (export "rmw-reads-modifies-and-writes") (drop (i64.atomic.rmw16.and_u offset=4 @@ -106,7 +106,7 @@ ) (module (import "fuzzing-support" "log-i32" (func $fimport$0 (param i32))) - (memory $0 (shared 1 1)) + (memory $0 1 1 shared) (func $rmw-reads-modifies-and-writes-asymmetrical (export "rmw-reads-modifies-and-writes-asymmetrical") (drop (i32.atomic.rmw8.sub_u diff --git a/test/passes/pick-load-signs_all-features.txt b/test/passes/pick-load-signs_all-features.txt index 9b73de23e82..4bb3c1c98f5 100644 --- a/test/passes/pick-load-signs_all-features.txt +++ b/test/passes/pick-load-signs_all-features.txt @@ -1,6 +1,6 @@ (module (type $0 (func (result i32))) - (memory $0 (shared 16 16)) + (memory $0 16 16) (func $atomics-are-always-unsigned (type $0) (result i32) (local $0 i32) (drop diff --git a/test/passes/pick-load-signs_all-features.wast b/test/passes/pick-load-signs_all-features.wast index 20a77eae489..4b7e11f10da 100644 --- a/test/passes/pick-load-signs_all-features.wast +++ b/test/passes/pick-load-signs_all-features.wast @@ -1,5 +1,5 @@ (module - (memory $0 (shared 16 16)) + (memory $0 16 16) (func $atomics-are-always-unsigned (result i32) (local $0 i32) (drop diff --git a/test/passes/precompute_all-features.txt b/test/passes/precompute_all-features.txt index e5cdbb20914..affa325310d 100644 --- a/test/passes/precompute_all-features.txt +++ b/test/passes/precompute_all-features.txt @@ -8,7 +8,7 @@ (type $6 (func (result externref))) (global $global i32 (i32.const 1)) (global $global-mut (mut i32) (i32.const 2)) - (memory $0 512 512) + (memory $0 6 65536) (data $0 (i32.const 0) "hello!") (elem declare func $dummy) (func $x (type $0) (param $x i32) diff --git a/test/passes/precompute_all-features.wast b/test/passes/precompute_all-features.wast index cef6d4cc834..45000153353 100644 --- a/test/passes/precompute_all-features.wast +++ b/test/passes/precompute_all-features.wast @@ -1,7 +1,5 @@ (module - (memory 512 512 - (data "hello!") - ) + (memory (data "hello!") 512 512) (type $0 (func (param i32))) (global $global i32 (i32.const 1)) (global $global-mut (mut i32) (i32.const 2)) diff --git a/test/passes/remove-memory.txt b/test/passes/remove-memory.txt index ee65d237e23..ddfdde49329 100644 --- a/test/passes/remove-memory.txt +++ b/test/passes/remove-memory.txt @@ -1,3 +1,3 @@ (module - (memory $0 1024 1024) + (memory $mem 1024 1024) ) diff --git a/test/passes/remove-memory.wast b/test/passes/remove-memory.wast index bbb99900794..26b4949a81f 100644 --- a/test/passes/remove-memory.wast +++ b/test/passes/remove-memory.wast @@ -1,6 +1,5 @@ (module - (memory 1024 1024 - (segment 10 "123") - (segment 20 "149") - ) + (memory $mem 1024 1024) + (data (memory $mem) (i32.const 10) "123") + (data (memory $mem) (i32.const 20) "149") ) diff --git a/test/passes/remove-unused-names_merge-blocks_all-features.txt b/test/passes/remove-unused-names_merge-blocks_all-features.txt index e10a8707ca2..ac7647507b7 100644 --- a/test/passes/remove-unused-names_merge-blocks_all-features.txt +++ b/test/passes/remove-unused-names_merge-blocks_all-features.txt @@ -5,7 +5,7 @@ (type $ii (func (param i32 i32))) (type $iii (func (param i32 i32 i32))) (type $5 (func (result f64))) - (memory $0 (shared 256 256)) + (memory $0 256 256 shared) (table $0 1 1 funcref) (elem $0 (i32.const 0) $call-i) (func $call-i (type $i) (param $0 i32) diff --git a/test/passes/remove-unused-names_merge-blocks_all-features.wast b/test/passes/remove-unused-names_merge-blocks_all-features.wast index 3ec2768e0a9..1063e246331 100644 --- a/test/passes/remove-unused-names_merge-blocks_all-features.wast +++ b/test/passes/remove-unused-names_merge-blocks_all-features.wast @@ -1,5 +1,5 @@ (module - (memory (shared 256 256)) + (memory 256 256 shared) (type $i (func (param i32))) (type $ii (func (param i32 i32))) (type $iii (func (param i32 i32 i32))) diff --git a/test/passes/remove-unused-nonfunction-module-elements_all-features.txt b/test/passes/remove-unused-nonfunction-module-elements_all-features.txt index d19fcc5140d..b54087b8176 100644 --- a/test/passes/remove-unused-nonfunction-module-elements_all-features.txt +++ b/test/passes/remove-unused-nonfunction-module-elements_all-features.txt @@ -132,7 +132,7 @@ ) (module (type $0 (func)) - (memory $0 (shared 23 256)) + (memory $0 23 256 shared) (export "user" (func $user)) (func $user (type $0) (i32.store @@ -143,7 +143,7 @@ ) (module (type $0 (func (result i32))) - (memory $0 (shared 23 256)) + (memory $0 23 256 shared) (export "user" (func $user)) (func $user (type $0) (result i32) (i32.atomic.rmw.add @@ -154,7 +154,7 @@ ) (module (type $0 (func (result i32))) - (memory $0 (shared 23 256)) + (memory $0 23 256 shared) (export "user" (func $user)) (func $user (type $0) (result i32) (i32.atomic.rmw8.cmpxchg_u @@ -166,7 +166,7 @@ ) (module (type $0 (func)) - (memory $0 (shared 23 256)) + (memory $0 23 256 shared) (export "user" (func $user)) (func $user (type $0) (local $0 i32) @@ -182,7 +182,7 @@ ) (module (type $0 (func (result i32))) - (memory $0 (shared 23 256)) + (memory $0 23 256 shared) (export "user" (func $user)) (func $user (type $0) (result i32) (memory.atomic.notify diff --git a/test/passes/remove-unused-nonfunction-module-elements_all-features.wast b/test/passes/remove-unused-nonfunction-module-elements_all-features.wast index 057088798e0..942a20ee7e1 100644 --- a/test/passes/remove-unused-nonfunction-module-elements_all-features.wast +++ b/test/passes/remove-unused-nonfunction-module-elements_all-features.wast @@ -101,28 +101,28 @@ ) ) (module ;; more use checks - (memory $0 (shared 23 256)) + (memory $0 23 256 shared) (export "user" $user) (func $user (i32.store (i32.const 0) (i32.const 0)) ) ) (module ;; more use checks - (memory $0 (shared 23 256)) + (memory $0 23 256 shared) (export "user" $user) (func $user (result i32) (i32.atomic.rmw.add (i32.const 0) (i32.const 0)) ) ) (module ;; more use checks - (memory $0 (shared 23 256)) + (memory $0 23 256 shared) (export "user" $user) (func $user (result i32) (i32.atomic.rmw8.cmpxchg_u (i32.const 0) (i32.const 0) (i32.const 0)) ) ) (module ;; more use checks - (memory $0 (shared 23 256)) + (memory $0 23 256 shared) (export "user" $user) (func $user (local $0 i32) @@ -137,7 +137,7 @@ ) ) (module ;; more use checks - (memory $0 (shared 23 256)) + (memory $0 23 256 shared) (export "user" $user) (func $user (result i32) (memory.atomic.notify (i32.const 0) (i32.const 0)) diff --git a/test/passes/safe-heap_enable-threads_enable-simd.txt b/test/passes/safe-heap_enable-threads_enable-simd.txt index 3d00dc96db2..c1f8110077c 100644 --- a/test/passes/safe-heap_enable-threads_enable-simd.txt +++ b/test/passes/safe-heap_enable-threads_enable-simd.txt @@ -14,7 +14,7 @@ (import "env" "emscripten_get_sbrk_ptr" (func $emscripten_get_sbrk_ptr (result i32))) (import "env" "segfault" (func $segfault)) (import "env" "alignfault" (func $alignfault)) - (memory $0 (shared 100 100)) + (memory $0 100 100 shared) (func $loads (drop (call $SAFE_HEAP_LOAD_i32_4_4 @@ -5441,7 +5441,7 @@ (import "env" "segfault" (func $segfault)) (import "env" "alignfault" (func $alignfault)) (import "env" "emscripten_get_sbrk_ptr" (func $emscripten_get_sbrk_ptr (result i32))) - (memory $0 (shared 100 100)) + (memory $0 100 100 shared) (func $actions (drop (call $SAFE_HEAP_LOAD_i32_4_4 diff --git a/test/passes/safe-heap_enable-threads_enable-simd.wast b/test/passes/safe-heap_enable-threads_enable-simd.wast index b1cd1f05080..a973230a527 100644 --- a/test/passes/safe-heap_enable-threads_enable-simd.wast +++ b/test/passes/safe-heap_enable-threads_enable-simd.wast @@ -1,5 +1,5 @@ (module - (memory (shared 100 100)) + (memory 100 100 shared) (func $loads (drop (i32.load (i32.const 1))) (drop (i32.atomic.load (i32.const 1))) @@ -47,7 +47,7 @@ (type $FUNCSIG$v (func)) (import "env" "segfault" (func $segfault)) (import "env" "alignfault" (func $alignfault)) - (memory $0 (shared 100 100)) + (memory $0 100 100 shared) (func $actions (drop (i32.load (i32.const 1))) (i32.store (i32.const 1) (i32.const 100)) diff --git a/test/passes/safe-heap_enable-threads_enable-simd64.txt b/test/passes/safe-heap_enable-threads_enable-simd64.txt index 0e282f0ce1e..49319377e44 100644 --- a/test/passes/safe-heap_enable-threads_enable-simd64.txt +++ b/test/passes/safe-heap_enable-threads_enable-simd64.txt @@ -14,7 +14,7 @@ (import "env" "emscripten_get_sbrk_ptr" (func $emscripten_get_sbrk_ptr (result i64))) (import "env" "segfault" (func $segfault)) (import "env" "alignfault" (func $alignfault)) - (memory $0 (shared i64 100 100)) + (memory $0 i64 100 100 shared) (func $loads (drop (call $SAFE_HEAP_LOAD_i32_4_4 @@ -5627,7 +5627,7 @@ (import "env" "emscripten_get_sbrk_ptr" (func $foo (result i64))) (import "env" "segfault" (func $segfault)) (import "env" "alignfault" (func $alignfault)) - (memory $0 (shared i64 100 100)) + (memory $0 i64 100 100 shared) (func $actions (drop (call $SAFE_HEAP_LOAD_i32_4_4 diff --git a/test/passes/safe-heap_enable-threads_enable-simd64.wast b/test/passes/safe-heap_enable-threads_enable-simd64.wast index d34c5772bd8..dc70a037b1c 100644 --- a/test/passes/safe-heap_enable-threads_enable-simd64.wast +++ b/test/passes/safe-heap_enable-threads_enable-simd64.wast @@ -1,5 +1,5 @@ (module - (memory (shared i64 100 100)) + (memory i64 100 100 shared) (func $loads (drop (i32.load (i64.const 1))) (drop (i32.atomic.load (i64.const 1))) @@ -48,7 +48,7 @@ (import "env" "emscripten_get_sbrk_ptr" (func $foo (result i64))) (import "env" "segfault" (func $segfault)) (import "env" "alignfault" (func $alignfault)) - (memory $0 (shared i64 100 100)) + (memory $0 i64 100 100 shared) (func $actions (drop (i32.load (i64.const 1))) (i32.store (i64.const 1) (i32.const 100)) diff --git a/test/passes/safe-heap_low-memory-unused_enable-threads_enable-simd.txt b/test/passes/safe-heap_low-memory-unused_enable-threads_enable-simd.txt index 26c45953637..53b048331a7 100644 --- a/test/passes/safe-heap_low-memory-unused_enable-threads_enable-simd.txt +++ b/test/passes/safe-heap_low-memory-unused_enable-threads_enable-simd.txt @@ -14,7 +14,7 @@ (import "env" "emscripten_get_sbrk_ptr" (func $emscripten_get_sbrk_ptr (result i32))) (import "env" "segfault" (func $segfault)) (import "env" "alignfault" (func $alignfault)) - (memory $0 (shared 100 100)) + (memory $0 100 100 shared) (func $loads (drop (call $SAFE_HEAP_LOAD_i32_4_4 @@ -5441,7 +5441,7 @@ (import "env" "emscripten_get_sbrk_ptr" (func $foo (result i32))) (import "env" "segfault" (func $segfault)) (import "env" "alignfault" (func $alignfault)) - (memory $0 (shared 100 100)) + (memory $0 100 100 shared) (func $actions (drop (call $SAFE_HEAP_LOAD_i32_4_4 diff --git a/test/passes/safe-heap_low-memory-unused_enable-threads_enable-simd.wast b/test/passes/safe-heap_low-memory-unused_enable-threads_enable-simd.wast index bad9fb8d4b8..6b0adf3e3cd 100644 --- a/test/passes/safe-heap_low-memory-unused_enable-threads_enable-simd.wast +++ b/test/passes/safe-heap_low-memory-unused_enable-threads_enable-simd.wast @@ -1,5 +1,5 @@ (module - (memory (shared 100 100)) + (memory 100 100 shared) (func $loads (drop (i32.load (i32.const 1))) (drop (i32.atomic.load (i32.const 1))) @@ -48,7 +48,7 @@ (import "env" "emscripten_get_sbrk_ptr" (func $foo (result i32))) (import "env" "segfault" (func $segfault)) (import "env" "alignfault" (func $alignfault)) - (memory $0 (shared 100 100)) + (memory $0 100 100 shared) (func $actions (drop (i32.load (i32.const 1))) (i32.store (i32.const 1) (i32.const 100)) diff --git a/test/passes/simplify-locals_all-features.txt b/test/passes/simplify-locals_all-features.txt index 5e5478ddf34..4225a70336e 100644 --- a/test/passes/simplify-locals_all-features.txt +++ b/test/passes/simplify-locals_all-features.txt @@ -1136,7 +1136,7 @@ (import "fuzzing-support" "log2" (func $fimport$1 (type $4) (param i32))) (import "fuzzing-support" "log3" (func $fimport$2 (type $5) (param f32))) (global $global$0 (mut i32) (i32.const 10)) - (memory $0 (shared 256 256)) + (memory $0 256 256 shared) (func $nonatomics (type $FUNCSIG$i) (result i32) (local $x i32) (nop) @@ -1884,7 +1884,7 @@ ) (module (type $0 (func (result i32))) - (memory $0 (shared 1 1)) + (memory $0 1 1 shared) (data $0 "data") (export "foo" (func $foo)) (func $foo (type $0) (result i32) diff --git a/test/passes/simplify-locals_all-features.wast b/test/passes/simplify-locals_all-features.wast index a2868b45dd9..f46f9fd7129 100644 --- a/test/passes/simplify-locals_all-features.wast +++ b/test/passes/simplify-locals_all-features.wast @@ -1087,7 +1087,7 @@ ) ) (module - (memory (shared 256 256)) + (memory 256 256 shared) (type $FUNCSIG$v (func)) (type $FUNCSIG$i (func (result i32))) (type $FUNCSIG$iiiii (func (param i32 i32 i32 i32) (result i32))) @@ -1673,7 +1673,7 @@ ) ;; data.drop has global side effects (module - (memory $0 (shared 1 1)) + (memory $0 1 1 shared) (data "data") (func $foo (export "foo") (result i32) (local $0 i32) diff --git a/test/passes/simplify-locals_all-features_disable-exception-handling.txt b/test/passes/simplify-locals_all-features_disable-exception-handling.txt index 6e5e3871662..6ee89372d20 100644 --- a/test/passes/simplify-locals_all-features_disable-exception-handling.txt +++ b/test/passes/simplify-locals_all-features_disable-exception-handling.txt @@ -1130,7 +1130,7 @@ (import "fuzzing-support" "log2" (func $fimport$1 (type $4) (param i32))) (import "fuzzing-support" "log3" (func $fimport$2 (type $5) (param f32))) (global $global$0 (mut i32) (i32.const 10)) - (memory $0 (shared 256 256)) + (memory $0 256 256 shared) (func $nonatomics (type $FUNCSIG$i) (result i32) (local $x i32) (nop) diff --git a/test/passes/simplify-locals_all-features_disable-exception-handling.wast b/test/passes/simplify-locals_all-features_disable-exception-handling.wast index 25b452511e6..1f308723a65 100644 --- a/test/passes/simplify-locals_all-features_disable-exception-handling.wast +++ b/test/passes/simplify-locals_all-features_disable-exception-handling.wast @@ -1087,7 +1087,7 @@ ) ) (module - (memory (shared 256 256)) + (memory 256 256 shared) (type $FUNCSIG$v (func)) (type $FUNCSIG$i (func (result i32))) (type $FUNCSIG$iiiii (func (param i32 i32 i32 i32) (result i32))) diff --git a/test/passes/ssa_fuzz-exec_enable-threads.txt b/test/passes/ssa_fuzz-exec_enable-threads.txt index 6334b35a7b5..f9d49d5bbaa 100644 --- a/test/passes/ssa_fuzz-exec_enable-threads.txt +++ b/test/passes/ssa_fuzz-exec_enable-threads.txt @@ -2,7 +2,7 @@ [fuzz-exec] note result: func_0 => 16384 (module (type $0 (func (result i32))) - (memory $0 (shared 1 1)) + (memory $0 1 1 shared) (table $0 0 0 funcref) (export "func_0" (func $0)) (func $0 (result i32) diff --git a/test/passes/ssa_fuzz-exec_enable-threads.wast b/test/passes/ssa_fuzz-exec_enable-threads.wast index 1ad1e2a6f8e..5917a3eb360 100644 --- a/test/passes/ssa_fuzz-exec_enable-threads.wast +++ b/test/passes/ssa_fuzz-exec_enable-threads.wast @@ -2,7 +2,7 @@ (type $0 (func (result i32))) (type $1 (func)) (table 0 0 funcref) - (memory $0 (shared 1 1)) + (memory $0 1 1 shared) (export "func_0" (func $0)) (func $0 (; 0 ;) (type $0) (result i32) (local $var$0 i32) @@ -109,4 +109,3 @@ ) ) ) - diff --git a/test/print/memory-import-shared.minified.txt b/test/print/memory-import-shared.minified.txt index 8691f813cae..75cbecb8bd3 100644 --- a/test/print/memory-import-shared.minified.txt +++ b/test/print/memory-import-shared.minified.txt @@ -1 +1 @@ -(module(import "env" "memory" (memory $0 (shared 256 256)))) \ No newline at end of file +(module(import "env" "memory" (memory $0 256 256 shared))) \ No newline at end of file diff --git a/test/print/memory-import-shared.txt b/test/print/memory-import-shared.txt index ba5a0463ca2..30374cff029 100644 --- a/test/print/memory-import-shared.txt +++ b/test/print/memory-import-shared.txt @@ -1,3 +1,3 @@ (module - (import "env" "memory" (memory $0 (shared 256 256))) + (import "env" "memory" (memory $0 256 256 shared)) ) diff --git a/test/print/memory-import-shared.wast b/test/print/memory-import-shared.wast index ba5a0463ca2..30374cff029 100644 --- a/test/print/memory-import-shared.wast +++ b/test/print/memory-import-shared.wast @@ -1,3 +1,3 @@ (module - (import "env" "memory" (memory $0 (shared 256 256))) + (import "env" "memory" (memory $0 256 256 shared)) ) diff --git a/test/print/memory-shared.minified.txt b/test/print/memory-shared.minified.txt index c6aeccdcd99..3f07a008007 100644 --- a/test/print/memory-shared.minified.txt +++ b/test/print/memory-shared.minified.txt @@ -1,2 +1,2 @@ -(module(memory $0 (shared 23 256)) +(module(memory $0 23 256 shared) ) \ No newline at end of file diff --git a/test/print/memory-shared.txt b/test/print/memory-shared.txt index ee02979b117..daff79f22f1 100644 --- a/test/print/memory-shared.txt +++ b/test/print/memory-shared.txt @@ -1,3 +1,3 @@ (module - (memory $0 (shared 23 256)) + (memory $0 23 256 shared) ) diff --git a/test/print/memory-shared.wast b/test/print/memory-shared.wast index ee02979b117..daff79f22f1 100644 --- a/test/print/memory-shared.wast +++ b/test/print/memory-shared.wast @@ -1,3 +1,3 @@ (module - (memory $0 (shared 23 256)) + (memory $0 23 256 shared) ) diff --git a/test/spec/atomics.wast b/test/spec/atomics.wast index 4e6dd35638c..4ff91ddafb0 100644 --- a/test/spec/atomics.wast +++ b/test/spec/atomics.wast @@ -1,5 +1,5 @@ (module - (memory $0 (shared 23 256)) + (memory $0 23 256 shared) (func (export "atomic-fence") (atomic.fence) ) diff --git a/test/wasm2js/atomic_fence.wast b/test/wasm2js/atomic_fence.wast index 2e605b690a3..cb1837dc4d8 100644 --- a/test/wasm2js/atomic_fence.wast +++ b/test/wasm2js/atomic_fence.wast @@ -1,5 +1,5 @@ (module - (memory $0 (shared 23 256)) + (memory $0 23 256 shared) (func (export "atomic-fence") (atomic.fence) ) diff --git a/test/wasm2js/atomics_32.wast b/test/wasm2js/atomics_32.wast index eeec9337631..e366b7f4e81 100644 --- a/test/wasm2js/atomics_32.wast +++ b/test/wasm2js/atomics_32.wast @@ -1,5 +1,5 @@ (module - (memory (shared 256 256)) + (memory 256 256 shared) (data "hello,") (data "world!") (func $test (export "test") From 7196dd296950e9bc1dec885ce64835eaa99428d1 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 3 Jan 2024 12:53:40 -0800 Subject: [PATCH 2/2] update binaryenjs tests --- test/binaryen.js/atomics.js | 2 +- test/binaryen.js/atomics.js.txt | 2 +- test/binaryen.js/kitchen-sink.js.txt | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/binaryen.js/atomics.js b/test/binaryen.js/atomics.js index ce68656e02d..471e4c52923 100644 --- a/test/binaryen.js/atomics.js +++ b/test/binaryen.js/atomics.js @@ -1,6 +1,6 @@ var wast = ` (module - (memory $0 (shared 1 1)) + (memory $0 1 1 shared) ) `; diff --git a/test/binaryen.js/atomics.js.txt b/test/binaryen.js/atomics.js.txt index 40d2be26aae..aec17b82af1 100644 --- a/test/binaryen.js/atomics.js.txt +++ b/test/binaryen.js/atomics.js.txt @@ -1,6 +1,6 @@ (module (type $0 (func)) - (memory $0 (shared 1 1)) + (memory $0 1 1 shared) (func $main (i32.atomic.store (i32.const 0) diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt index 8c6138413a9..bbef03377e6 100644 --- a/test/binaryen.js/kitchen-sink.js.txt +++ b/test/binaryen.js/kitchen-sink.js.txt @@ -139,7 +139,7 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} (import "module" "base" (func $an-imported (type $2) (param i32 f64) (result f32))) (import "module" "base" (tag $a-tag-imp (param i32))) (global $a-global i32 (i32.const 1)) - (memory $0 (shared 1 256)) + (memory $0 1 256 shared) (data $0 (i32.const 10) "hello, world") (data $1 "I am passive") (table $t0 1 funcref) @@ -2243,7 +2243,7 @@ getExpressionInfo(tuple[3])={"id":14,"type":5,"value":3.7} (import "module" "base" (func $an-imported (type $2) (param i32 f64) (result f32))) (import "module" "base" (tag $a-tag-imp (param i32))) (global $a-global i32 (i32.const 1)) - (memory $0 (shared 1 256)) + (memory $0 1 256 shared) (data $0 (i32.const 10) "hello, world") (data $1 "I am passive") (table $t0 1 funcref)