diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/atomics.wast | 3 | ||||
-rw-r--r-- | test/atomics.wast.from-wast | 3 | ||||
-rw-r--r-- | test/atomics.wast.fromBinary | 3 | ||||
-rw-r--r-- | test/atomics.wast.fromBinary.noDebugInfo | 3 | ||||
-rw-r--r-- | test/binaryen.js/atomics.js | 25 | ||||
-rw-r--r-- | test/binaryen.js/atomics.js.txt | 21 | ||||
-rw-r--r-- | test/binaryen.js/exception-handling.js.txt | 8 | ||||
-rw-r--r-- | test/binaryen.js/kitchen-sink.js | 24 | ||||
-rw-r--r-- | test/binaryen.js/kitchen-sink.js.txt | 228 | ||||
-rw-r--r-- | test/binaryen.js/push-pop.js.txt | 14 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 12 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.txt | 91 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.txt.txt | 22 | ||||
-rw-r--r-- | test/passes/translate-to-fuzz_all-features.txt | 344 | ||||
-rw-r--r-- | test/passes/translate-to-fuzz_no-fuzz-nans_all-features.txt | 1352 | ||||
-rw-r--r-- | test/spec/atomics.wast | 8 |
16 files changed, 1361 insertions, 800 deletions
diff --git a/test/atomics.wast b/test/atomics.wast index 2dcad6459..8ba9906c5 100644 --- a/test/atomics.wast +++ b/test/atomics.wast @@ -158,4 +158,7 @@ ) ) ) + (func $atomic-fence (type $0) + (atomic.fence) + ) ) diff --git a/test/atomics.wast.from-wast b/test/atomics.wast.from-wast index 2869d5da4..c3fdd375d 100644 --- a/test/atomics.wast.from-wast +++ b/test/atomics.wast.from-wast @@ -158,4 +158,7 @@ ) ) ) + (func $atomic-fence (; 4 ;) (type $0) + (atomic.fence) + ) ) diff --git a/test/atomics.wast.fromBinary b/test/atomics.wast.fromBinary index dc5cb0145..78d086a0c 100644 --- a/test/atomics.wast.fromBinary +++ b/test/atomics.wast.fromBinary @@ -158,5 +158,8 @@ ) ) ) + (func $atomic-fence (; 4 ;) (type $0) + (atomic.fence) + ) ) diff --git a/test/atomics.wast.fromBinary.noDebugInfo b/test/atomics.wast.fromBinary.noDebugInfo index 77fb51917..86860c907 100644 --- a/test/atomics.wast.fromBinary.noDebugInfo +++ b/test/atomics.wast.fromBinary.noDebugInfo @@ -158,5 +158,8 @@ ) ) ) + (func $4 (; 4 ;) (type $0) + (atomic.fence) + ) ) diff --git a/test/binaryen.js/atomics.js b/test/binaryen.js/atomics.js index a1f8fc842..40c3ea0ab 100644 --- a/test/binaryen.js/atomics.js +++ b/test/binaryen.js/atomics.js @@ -60,7 +60,30 @@ module.addFunction("main", signature, [], module.block("", [ module.i64.atomic.load32_u(0, module.i32.const(0) ) - ) + ), + // wait and notify + module.drop( + module.i32.atomic.wait( + module.i32.const(0), + module.i32.const(0), + module.i64.const(0) + ) + ), + module.drop( + module.i64.atomic.wait( + module.i32.const(0), + module.i64.const(0), + module.i64.const(0) + ) + ), + module.drop( + module.atomic.notify( + module.i32.const(0), + module.i32.const(0) + ) + ), + // fence + module.atomic.fence() ])); module.setFeatures(Binaryen.Features.Atomics); diff --git a/test/binaryen.js/atomics.js.txt b/test/binaryen.js/atomics.js.txt index 177ba34a6..0a8659acf 100644 --- a/test/binaryen.js/atomics.js.txt +++ b/test/binaryen.js/atomics.js.txt @@ -44,6 +44,27 @@ (i32.const 0) ) ) + (drop + (i32.atomic.wait + (i32.const 0) + (i32.const 0) + (i64.const 0) + ) + ) + (drop + (i64.atomic.wait + (i32.const 0) + (i64.const 0) + (i64.const 0) + ) + ) + (drop + (atomic.notify + (i32.const 0) + (i32.const 0) + ) + ) + (atomic.fence) ) ) diff --git a/test/binaryen.js/exception-handling.js.txt b/test/binaryen.js/exception-handling.js.txt index cdf45aeaa..463743ff6 100644 --- a/test/binaryen.js/exception-handling.js.txt +++ b/test/binaryen.js/exception-handling.js.txt @@ -26,7 +26,7 @@ ) ) -getExpressionInfo(throw) = {"id":39,"type":8,"event":"e"} -getExpressionInfo(br_on_exn) = {"id":41,"type":7,"name":"l","event":"e"} -getExpressionInfo(rethrow) = {"id":40,"type":8} -getExpressionInfo(try) = {"id":38,"type":0} +getExpressionInfo(throw) = {"id":40,"type":8,"event":"e"} +getExpressionInfo(br_on_exn) = {"id":42,"type":7,"name":"l","event":"e"} +getExpressionInfo(rethrow) = {"id":41,"type":8} +getExpressionInfo(try) = {"id":39,"type":0} diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js index f2a78ab34..89e7fdfc6 100644 --- a/test/binaryen.js/kitchen-sink.js +++ b/test/binaryen.js/kitchen-sink.js @@ -428,6 +428,28 @@ function test_core() { ) ), + // Atomics + module.i32.atomic.store(0, + module.i32.const(0), + module.i32.atomic.load(0, + module.i32.const(0) + ) + ), + module.drop( + module.i32.atomic.wait( + module.i32.const(0), + module.i32.const(0), + module.i64.const(0) + ) + ), + module.drop( + module.atomic.notify( + module.i32.const(0), + module.i32.const(0) + ) + ), + module.atomic.fence(), + // Push and pop module.push(module.i32.pop()), module.push(module.i64.pop()), @@ -492,7 +514,7 @@ function test_core() { offset: null, data: "I am passive".split('').map(function(x) { return x.charCodeAt(0) }) } - ]); + ], true); // Start function. One per module diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt index b1f269a30..d4ca83b1c 100644 --- a/test/binaryen.js/kitchen-sink.js.txt +++ b/test/binaryen.js/kitchen-sink.js.txt @@ -44,21 +44,21 @@ BinaryenAtomicCmpxchgId: 24 BinaryenAtomicRMWId: 23 BinaryenAtomicWaitId: 25 BinaryenAtomicNotifyId: 26 -BinaryenSIMDExtractId: 27 -BinaryenSIMDReplaceId: 28 -BinaryenSIMDShuffleId: 29 -BinaryenSIMDBitselectId: 30 -BinaryenSIMDShiftId: 31 -MemoryInitId: 32 -DataDropId: 33 -MemoryCopyId: 34 -MemoryFillId: 35 -TryId: 38 -ThrowId: 39 -RethrowId: 40 -BrOnExnId: 41 -PushId: 36 -PopId: 37 +BinaryenSIMDExtractId: 28 +BinaryenSIMDReplaceId: 29 +BinaryenSIMDShuffleId: 30 +BinaryenSIMDBitselectId: 31 +BinaryenSIMDShiftId: 32 +MemoryInitId: 33 +DataDropId: 34 +MemoryCopyId: 35 +MemoryFillId: 36 +TryId: 39 +ThrowId: 40 +RethrowId: 41 +BrOnExnId: 42 +PushId: 37 +PopId: 38 getExpressionInfo={"id":15,"type":3,"op":6} (f32.neg (f32.const -33.61199951171875) @@ -77,7 +77,7 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5} (import "module" "base" (global $a-global-imp i32)) (import "module" "base" (func $an-imported (param i32 f64) (result f32))) (import "module" "base" (event $a-event-imp (attr 0) (param i32))) - (memory $0 1 256) + (memory $0 (shared 1 256)) (data (i32.const 10) "hello, world") (data passive "I am passive") (table $0 1 funcref) @@ -1456,6 +1456,26 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5} ) ) ) + (i32.atomic.store + (i32.const 0) + (i32.atomic.load + (i32.const 0) + ) + ) + (drop + (i32.atomic.wait + (i32.const 0) + (i32.const 0) + (i64.const 0) + ) + ) + (drop + (atomic.notify + (i32.const 0) + (i32.const 0) + ) + ) + (atomic.fence) (push (i32.pop) ) @@ -1496,7 +1516,7 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5} (import "module" "base" (global $a-global-imp i32)) (import "module" "base" (func $an-imported (param i32 f64) (result f32))) (import "module" "base" (event $a-event-imp (attr 0) (param i32))) - (memory $0 1 256) + (memory $0 (shared 1 256)) (data (i32.const 10) "hello, world") (data passive "I am passive") (table $0 1 funcref) @@ -2875,6 +2895,26 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5} ) ) ) + (i32.atomic.store + (i32.const 0) + (i32.atomic.load + (i32.const 0) + ) + ) + (drop + (i32.atomic.wait + (i32.const 0) + (i32.const 0) + (i64.const 0) + ) + ) + (drop + (atomic.notify + (i32.const 0) + (i32.const 0) + ) + ) + (atomic.fence) (push (i32.pop) ) @@ -4775,20 +4815,34 @@ int main() { expressions[665] = BinaryenBlock(the_module, NULL, children, 2, 0); } expressions[666] = BinaryenTry(the_module, expressions[657], expressions[665]); - expressions[667] = BinaryenPop(the_module, 1); - expressions[668] = BinaryenPush(the_module, expressions[667]); - expressions[669] = BinaryenPop(the_module, 2); - expressions[670] = BinaryenPush(the_module, expressions[669]); - expressions[671] = BinaryenPop(the_module, 3); - expressions[672] = BinaryenPush(the_module, expressions[671]); - expressions[673] = BinaryenPop(the_module, 4); - expressions[674] = BinaryenPush(the_module, expressions[673]); - expressions[675] = BinaryenPop(the_module, 5); - expressions[676] = BinaryenPush(the_module, expressions[675]); - expressions[677] = BinaryenPop(the_module, 7); - expressions[678] = BinaryenPush(the_module, expressions[677]); - expressions[679] = BinaryenNop(the_module); - expressions[680] = BinaryenUnreachable(the_module); + expressions[667] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); + expressions[668] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); + expressions[669] = BinaryenAtomicLoad(the_module, 4, 0, 1, expressions[668]); + expressions[670] = BinaryenAtomicStore(the_module, 4, 0, expressions[667], expressions[669], 1); + expressions[671] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); + expressions[672] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); + expressions[673] = BinaryenConst(the_module, BinaryenLiteralInt64(0)); + expressions[674] = BinaryenAtomicWait(the_module, expressions[671], expressions[672], expressions[673], 1); + expressions[675] = BinaryenDrop(the_module, expressions[674]); + expressions[676] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); + expressions[677] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); + expressions[678] = BinaryenAtomicNotify(the_module, expressions[676], expressions[677]); + expressions[679] = BinaryenDrop(the_module, expressions[678]); + expressions[680] = BinaryenAtomicFence(the_module); + expressions[681] = BinaryenPop(the_module, 1); + expressions[682] = BinaryenPush(the_module, expressions[681]); + expressions[683] = BinaryenPop(the_module, 2); + expressions[684] = BinaryenPush(the_module, expressions[683]); + expressions[685] = BinaryenPop(the_module, 3); + expressions[686] = BinaryenPush(the_module, expressions[685]); + expressions[687] = BinaryenPop(the_module, 4); + expressions[688] = BinaryenPush(the_module, expressions[687]); + expressions[689] = BinaryenPop(the_module, 5); + expressions[690] = BinaryenPush(the_module, expressions[689]); + expressions[691] = BinaryenPop(the_module, 7); + expressions[692] = BinaryenPush(the_module, expressions[691]); + expressions[693] = BinaryenNop(the_module); + expressions[694] = BinaryenUnreachable(the_module); BinaryenExpressionGetId(expressions[30]); BinaryenExpressionGetType(expressions[30]); BinaryenUnaryGetOp(expressions[30]); @@ -4799,26 +4853,26 @@ getExpressionInfo={"id":15,"type":3,"op":6} (f32.const -33.61199951171875) ) - expressions[681] = BinaryenConst(the_module, BinaryenLiteralInt32(5)); - BinaryenExpressionGetId(expressions[681]); - BinaryenExpressionGetType(expressions[681]); - BinaryenConstGetValueI32(expressions[681]); + expressions[695] = BinaryenConst(the_module, BinaryenLiteralInt32(5)); + BinaryenExpressionGetId(expressions[695]); + BinaryenExpressionGetType(expressions[695]); + BinaryenConstGetValueI32(expressions[695]); getExpressionInfo(i32.const)={"id":14,"type":1,"value":5} - expressions[682] = BinaryenConst(the_module, BinaryenLiteralInt64(30064771078)); - BinaryenExpressionGetId(expressions[682]); - BinaryenExpressionGetType(expressions[682]); - BinaryenConstGetValueI64Low(expressions[682]); - BinaryenConstGetValueI64High(expressions[682]); + expressions[696] = BinaryenConst(the_module, BinaryenLiteralInt64(30064771078)); + BinaryenExpressionGetId(expressions[696]); + BinaryenExpressionGetType(expressions[696]); + BinaryenConstGetValueI64Low(expressions[696]); + BinaryenConstGetValueI64High(expressions[696]); getExpressionInfo(i64.const)={"id":14,"type":2,"value":{"low":6,"high":7}} - expressions[683] = BinaryenConst(the_module, BinaryenLiteralFloat32(8.5)); - BinaryenExpressionGetId(expressions[683]); - BinaryenExpressionGetType(expressions[683]); - BinaryenConstGetValueF32(expressions[683]); + expressions[697] = BinaryenConst(the_module, BinaryenLiteralFloat32(8.5)); + BinaryenExpressionGetId(expressions[697]); + BinaryenExpressionGetType(expressions[697]); + BinaryenConstGetValueF32(expressions[697]); getExpressionInfo(f32.const)={"id":14,"type":3,"value":8.5} - expressions[684] = BinaryenConst(the_module, BinaryenLiteralFloat64(9.5)); - BinaryenExpressionGetId(expressions[684]); - BinaryenExpressionGetType(expressions[684]); - BinaryenConstGetValueF64(expressions[684]); + expressions[698] = BinaryenConst(the_module, BinaryenLiteralFloat64(9.5)); + BinaryenExpressionGetId(expressions[698]); + BinaryenExpressionGetType(expressions[698]); + BinaryenConstGetValueF64(expressions[698]); getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5} { BinaryenExpressionRef children[] = { expressions[24], expressions[26], expressions[28], expressions[30], expressions[32], @@ -4862,26 +4916,26 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5} expressions[606], expressions[612], expressions[617], expressions[624], expressions[626], expressions[628], expressions[631], expressions[633], expressions[635], expressions[637], expressions[639], expressions[640], expressions[641], expressions[642], expressions[644], expressions[649], expressions[655], expressions[666], - expressions[668], expressions[670], expressions[672], expressions[674], expressions[676], expressions[678], - expressions[679], expressions[680] }; - expressions[685] = BinaryenBlock(the_module, "the-value", children, 253, 0); + expressions[670], expressions[675], expressions[679], expressions[680], expressions[682], expressions[684], + expressions[686], expressions[688], expressions[690], expressions[692], expressions[693], expressions[694] }; + expressions[699] = BinaryenBlock(the_module, "the-value", children, 257, 0); } - expressions[686] = BinaryenDrop(the_module, expressions[685]); + expressions[700] = BinaryenDrop(the_module, expressions[699]); { - BinaryenExpressionRef children[] = { expressions[686] }; - expressions[687] = BinaryenBlock(the_module, "the-nothing", children, 1, 0); + BinaryenExpressionRef children[] = { expressions[700] }; + expressions[701] = BinaryenBlock(the_module, "the-nothing", children, 1, 0); } - expressions[688] = BinaryenConst(the_module, BinaryenLiteralInt32(42)); + expressions[702] = BinaryenConst(the_module, BinaryenLiteralInt32(42)); { - BinaryenExpressionRef children[] = { expressions[687], expressions[688] }; - expressions[689] = BinaryenBlock(the_module, "the-body", children, 2, 0); + BinaryenExpressionRef children[] = { expressions[701], expressions[702] }; + expressions[703] = BinaryenBlock(the_module, "the-body", children, 2, 0); } { BinaryenType varTypes[] = { 1, 7 }; - functions[0] = BinaryenAddFunction(the_module, "kitchen()sinker", functionTypes[1], varTypes, 2, expressions[689]); + functions[0] = BinaryenAddFunction(the_module, "kitchen()sinker", functionTypes[1], varTypes, 2, expressions[703]); } - expressions[690] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); - globals[0] = BinaryenAddGlobal(the_module, "a-global", 1, 0, expressions[690]); + expressions[704] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); + globals[0] = BinaryenAddGlobal(the_module, "a-global", 1, 0, expressions[704]); { BinaryenType paramTypes[] = { 1, 4 }; functionTypes[2] = BinaryenAddFunctionType(the_module, "fiF", 3, paramTypes, 2); @@ -4910,24 +4964,24 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5} const char* funcNames[] = { "kitchen()sinker" }; BinaryenSetFunctionTable(the_module, 1, 4294967295, funcNames, 1); } - expressions[691] = BinaryenConst(the_module, BinaryenLiteralInt32(10)); + expressions[705] = BinaryenConst(the_module, BinaryenLiteralInt32(10)); { const char segment0[] = { 104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100 }; const char segment1[] = { 73, 32, 97, 109, 32, 112, 97, 115, 115, 105, 118, 101 }; const char* segments[] = { segment0, segment1 }; int8_t segmentPassive[] = { 0, 1 }; - BinaryenExpressionRef segmentOffsets[] = { expressions[691], expressions[0] }; + BinaryenExpressionRef segmentOffsets[] = { expressions[705], expressions[0] }; BinaryenIndex segmentSizes[] = { 12, 12 }; - BinaryenSetMemory(the_module, 1, 256, "mem", segments, segmentPassive, segmentOffsets, segmentSizes, 2, 0); + BinaryenSetMemory(the_module, 1, 256, "mem", segments, segmentPassive, segmentOffsets, segmentSizes, 2, 1); } { BinaryenType paramTypes[] = { 0 }; functionTypes[3] = BinaryenAddFunctionType(the_module, "v", 0, paramTypes, 0); } - expressions[692] = BinaryenNop(the_module); + expressions[706] = BinaryenNop(the_module); { BinaryenType varTypes[] = { 0 }; - functions[1] = BinaryenAddFunction(the_module, "starter", functionTypes[3], varTypes, 0, expressions[692]); + functions[1] = BinaryenAddFunction(the_module, "starter", functionTypes[3], varTypes, 0, expressions[706]); } BinaryenSetStart(the_module, functions[1]); { @@ -4947,7 +5001,7 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5} (import "module" "base" (global $a-global-imp i32)) (import "module" "base" (func $an-imported (param i32 f64) (result f32))) (import "module" "base" (event $a-event-imp (attr 0) (param i32))) - (memory $0 1 256) + (memory $0 (shared 1 256)) (data (i32.const 10) "hello, world") (data passive "I am passive") (table $0 1 funcref) @@ -6326,6 +6380,26 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5} ) ) ) + (i32.atomic.store + (i32.const 0) + (i32.atomic.load + (i32.const 0) + ) + ) + (drop + (i32.atomic.wait + (i32.const 0) + (i32.const 0) + (i64.const 0) + ) + ) + (drop + (atomic.notify + (i32.const 0) + (i32.const 0) + ) + ) + (atomic.fence) (push (i32.pop) ) @@ -6368,7 +6442,7 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5} (import "module" "base" (global $a-global-imp i32)) (import "module" "base" (func $an-imported (param i32 f64) (result f32))) (import "module" "base" (event $a-event-imp (attr 0) (param i32))) - (memory $0 1 256) + (memory $0 (shared 1 256)) (data (i32.const 10) "hello, world") (data passive "I am passive") (table $0 1 funcref) @@ -7747,6 +7821,26 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5} ) ) ) + (i32.atomic.store + (i32.const 0) + (i32.atomic.load + (i32.const 0) + ) + ) + (drop + (i32.atomic.wait + (i32.const 0) + (i32.const 0) + (i64.const 0) + ) + ) + (drop + (atomic.notify + (i32.const 0) + (i32.const 0) + ) + ) + (atomic.fence) (push (i32.pop) ) diff --git a/test/binaryen.js/push-pop.js.txt b/test/binaryen.js/push-pop.js.txt index c9689831f..80166906a 100644 --- a/test/binaryen.js/push-pop.js.txt +++ b/test/binaryen.js/push-pop.js.txt @@ -22,10 +22,10 @@ ) ) -getExpressionInfo(i32.pop) = {"id":37,"type":1} -getExpressionInfo(i64.pop) = {"id":37,"type":2} -getExpressionInfo(f32.pop) = {"id":37,"type":3} -getExpressionInfo(f64.pop) = {"id":37,"type":4} -getExpressionInfo(v128.pop) = {"id":37,"type":5} -getExpressionInfo(exnref.pop) = {"id":37,"type":7} -getExpressionInfo(push) = {"id":36} +getExpressionInfo(i32.pop) = {"id":38,"type":1} +getExpressionInfo(i64.pop) = {"id":38,"type":2} +getExpressionInfo(f32.pop) = {"id":38,"type":3} +getExpressionInfo(f64.pop) = {"id":38,"type":4} +getExpressionInfo(v128.pop) = {"id":38,"type":5} +getExpressionInfo(exnref.pop) = {"id":38,"type":7} +getExpressionInfo(push) = {"id":37} diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 3d9d42fa1..77349529b 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -520,6 +520,16 @@ void test_core() { module, makeInt32(module, 2449), callOperands4b, 4, "iiIfF"), // Exception handling BinaryenTry(module, tryBody, catchBody), + // Atomics + BinaryenAtomicStore(module, 4, 0, temp6, + BinaryenAtomicLoad(module, 4, 0, BinaryenTypeInt32(), temp6), + BinaryenTypeInt32() + ), + BinaryenDrop(module, + BinaryenAtomicWait(module, temp6, temp6, temp16, BinaryenTypeInt32()) + ), + BinaryenDrop(module, BinaryenAtomicNotify(module, temp6, temp6)), + BinaryenAtomicFence(module), // TODO: Host BinaryenNop(module), @@ -565,7 +575,7 @@ void test_core() { int8_t segmentPassive[] = { 0, 1 }; BinaryenExpressionRef segmentOffsets[] = { BinaryenConst(module, BinaryenLiteralInt32(10)), NULL }; BinaryenIndex segmentSizes[] = { 12, 12 }; - BinaryenSetMemory(module, 1, 256, "mem", segments, segmentPassive, segmentOffsets, segmentSizes, 2, 0); + BinaryenSetMemory(module, 1, 256, "mem", segments, segmentPassive, segmentOffsets, segmentSizes, 2, 1); // Start function. One per module diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index a46190fb4..a5c300653 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -27,7 +27,7 @@ BinaryenFeatureAll: 511 (type $v (func)) (type $4 (func)) (import "module" "base" (func $an-imported (param i32 f64) (result f32))) - (memory $0 1 256) + (memory $0 (shared 1 256)) (data (i32.const 10) "hello, world") (data passive "I am passive") (table $0 1 1 funcref) @@ -1414,6 +1414,26 @@ BinaryenFeatureAll: 511 ) ) ) + (i32.atomic.store + (i32.const 0) + (i32.atomic.load + (i32.const 0) + ) + ) + (drop + (i32.atomic.wait + (i32.const 0) + (i32.const 0) + (i64.const 111) + ) + ) + (drop + (atomic.notify + (i32.const 0) + (i32.const 0) + ) + ) + (atomic.fence) (nop) (unreachable) ) @@ -3310,8 +3330,15 @@ int main() { expressions[658] = BinaryenReturnCallIndirect(the_module, expressions[657], operands, 4, "iiIfF"); } expressions[659] = BinaryenTry(the_module, expressions[35], expressions[43]); - expressions[660] = BinaryenNop(the_module); - expressions[661] = BinaryenUnreachable(the_module); + expressions[660] = BinaryenAtomicLoad(the_module, 4, 0, 1, expressions[23]); + expressions[661] = BinaryenAtomicStore(the_module, 4, 0, expressions[23], expressions[660], 1); + expressions[662] = BinaryenAtomicWait(the_module, expressions[23], expressions[23], expressions[33], 1); + expressions[663] = BinaryenDrop(the_module, expressions[662]); + expressions[664] = BinaryenAtomicNotify(the_module, expressions[23], expressions[23]); + expressions[665] = BinaryenDrop(the_module, expressions[664]); + expressions[666] = BinaryenAtomicFence(the_module); + expressions[667] = BinaryenNop(the_module); + expressions[668] = BinaryenUnreachable(the_module); BinaryenExpressionPrint(expressions[51]); (f32.neg (f32.const -33.61199951171875) @@ -3358,27 +3385,27 @@ int main() { expressions[627], expressions[629], expressions[632], expressions[635], expressions[637], expressions[639], expressions[642], expressions[644], expressions[646], expressions[648], expressions[650], expressions[651], expressions[652], expressions[653], expressions[655], expressions[656], expressions[658], expressions[659], - expressions[660], expressions[661] }; - expressions[662] = BinaryenBlock(the_module, "the-value", children, 247, BinaryenTypeAuto()); + expressions[661], expressions[663], expressions[665], expressions[666], expressions[667], expressions[668] }; + expressions[669] = BinaryenBlock(the_module, "the-value", children, 251, BinaryenTypeAuto()); } - expressions[663] = BinaryenDrop(the_module, expressions[662]); + expressions[670] = BinaryenDrop(the_module, expressions[669]); { - BinaryenExpressionRef children[] = { expressions[663] }; - expressions[664] = BinaryenBlock(the_module, "the-nothing", children, 1, BinaryenTypeAuto()); + BinaryenExpressionRef children[] = { expressions[670] }; + expressions[671] = BinaryenBlock(the_module, "the-nothing", children, 1, BinaryenTypeAuto()); } - expressions[665] = BinaryenConst(the_module, BinaryenLiteralInt32(42)); + expressions[672] = BinaryenConst(the_module, BinaryenLiteralInt32(42)); { - BinaryenExpressionRef children[] = { expressions[664], expressions[665] }; - expressions[666] = BinaryenBlock(the_module, "the-body", children, 2, BinaryenTypeAuto()); + BinaryenExpressionRef children[] = { expressions[671], expressions[672] }; + expressions[673] = BinaryenBlock(the_module, "the-body", children, 2, BinaryenTypeAuto()); } { BinaryenType varTypes[] = { 1, 7 }; - functions[0] = BinaryenAddFunction(the_module, "kitchen()sinker", functionTypes[0], varTypes, 2, expressions[666]); + functions[0] = BinaryenAddFunction(the_module, "kitchen()sinker", functionTypes[0], varTypes, 2, expressions[673]); } - expressions[667] = BinaryenConst(the_module, BinaryenLiteralInt32(7)); - globals[0] = BinaryenAddGlobal(the_module, "a-global", 1, 0, expressions[667]); - expressions[668] = BinaryenConst(the_module, BinaryenLiteralFloat32(7.5)); - globals[1] = BinaryenAddGlobal(the_module, "a-mutable-global", 3, 1, expressions[668]); + expressions[674] = BinaryenConst(the_module, BinaryenLiteralInt32(7)); + globals[0] = BinaryenAddGlobal(the_module, "a-global", 1, 0, expressions[674]); + expressions[675] = BinaryenConst(the_module, BinaryenLiteralFloat32(7.5)); + globals[1] = BinaryenAddGlobal(the_module, "a-mutable-global", 3, 1, expressions[675]); { BinaryenType paramTypes[] = { 1, 4 }; functionTypes[2] = BinaryenAddFunctionType(the_module, "fiF", 3, paramTypes, 2); @@ -3390,24 +3417,24 @@ int main() { const char* funcNames[] = { "kitchen()sinker" }; BinaryenSetFunctionTable(the_module, 1, 1, funcNames, 1); } - expressions[669] = BinaryenConst(the_module, BinaryenLiteralInt32(10)); + expressions[676] = BinaryenConst(the_module, BinaryenLiteralInt32(10)); { const char segment0[] = { 104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100 }; const char segment1[] = { 73, 32, 97, 109, 32, 112, 97, 115, 115, 105, 118, 101 }; const char* segments[] = { segment0, segment1 }; int8_t segmentPassive[] = { 0, 1 }; - BinaryenExpressionRef segmentOffsets[] = { expressions[669], expressions[0] }; + BinaryenExpressionRef segmentOffsets[] = { expressions[676], expressions[0] }; BinaryenIndex segmentSizes[] = { 12, 12 }; - BinaryenSetMemory(the_module, 1, 256, "mem", segments, segmentPassive, segmentOffsets, segmentSizes, 2, 0); + BinaryenSetMemory(the_module, 1, 256, "mem", segments, segmentPassive, segmentOffsets, segmentSizes, 2, 1); } { BinaryenType paramTypes[] = { 0 }; functionTypes[3] = BinaryenAddFunctionType(the_module, "v", 0, paramTypes, 0); } - expressions[670] = BinaryenNop(the_module); + expressions[677] = BinaryenNop(the_module); { BinaryenType varTypes[] = { 0 }; - functions[1] = BinaryenAddFunction(the_module, "starter", functionTypes[3], varTypes, 0, expressions[670]); + functions[1] = BinaryenAddFunction(the_module, "starter", functionTypes[3], varTypes, 0, expressions[677]); } BinaryenSetStart(the_module, functions[1]); { @@ -3426,7 +3453,7 @@ int main() { (type $v (func)) (type $4 (func)) (import "module" "base" (func $an-imported (param i32 f64) (result f32))) - (memory $0 1 256) + (memory $0 (shared 1 256)) (data (i32.const 10) "hello, world") (data passive "I am passive") (table $0 1 1 funcref) @@ -4813,6 +4840,26 @@ int main() { ) ) ) + (i32.atomic.store + (i32.const 0) + (i32.atomic.load + (i32.const 0) + ) + ) + (drop + (i32.atomic.wait + (i32.const 0) + (i32.const 0) + (i64.const 111) + ) + ) + (drop + (atomic.notify + (i32.const 0) + (i32.const 0) + ) + ) + (atomic.fence) (nop) (unreachable) ) diff --git a/test/example/c-api-kitchen-sink.txt.txt b/test/example/c-api-kitchen-sink.txt.txt index 181b16718..792656d96 100644 --- a/test/example/c-api-kitchen-sink.txt.txt +++ b/test/example/c-api-kitchen-sink.txt.txt @@ -8,7 +8,7 @@ (type $v (func)) (type $4 (func)) (import "module" "base" (func $an-imported (param i32 f64) (result f32))) - (memory $0 1 256) + (memory $0 (shared 1 256)) (data (i32.const 10) "hello, world") (data passive "I am passive") (table $0 1 1 funcref) @@ -1395,6 +1395,26 @@ ) ) ) + (i32.atomic.store + (i32.const 0) + (i32.atomic.load + (i32.const 0) + ) + ) + (drop + (i32.atomic.wait + (i32.const 0) + (i32.const 0) + (i64.const 111) + ) + ) + (drop + (atomic.notify + (i32.const 0) + (i32.const 0) + ) + ) + (atomic.fence) (nop) (unreachable) ) diff --git a/test/passes/translate-to-fuzz_all-features.txt b/test/passes/translate-to-fuzz_all-features.txt index efbe0c232..a0481ba60 100644 --- a/test/passes/translate-to-fuzz_all-features.txt +++ b/test/passes/translate-to-fuzz_all-features.txt @@ -9,10 +9,9 @@ (import "fuzzing-support" "log-i64" (func $log-i64 (param i64))) (import "fuzzing-support" "log-f32" (func $log-f32 (param f32))) (import "fuzzing-support" "log-f64" (func $log-f64 (param f64))) - (memory $0 (shared 1 1)) + (memory $0 1 1) (data (i32.const 0) "N\0fN\f5\f9\b1\ff\fa\eb\e5\fe\a7\ec\fb\fc\f4\a6\e4\ea\f0\ae\e3") - (table $0 3 3 funcref) - (elem (i32.const 0) $func_5 $func_5 $func_5) + (table $0 0 funcref) (global $global$0 (mut i32) (i32.const 975663930)) (global $global$1 (mut i32) (i32.const 2066300474)) (global $global$2 (mut i64) (i64.const 20510)) @@ -276,341 +275,20 @@ ) (block $label$0 (br_if $label$0 - (i32.const 1376786182) - ) - (local.set $4 - (v128.const i32x4 0x0e0a0e0d 0x0709060c 0x764b6f6f 0x00040000) - ) - (local.set $4 - (if (result v128) - (i32.eqz - (if (result i32) - (if (result i32) - (i32.eqz - (if (result i32) - (i32.eqz - (if - (i32.const 1329942351) - (local.tee $2 - (local.tee $2 - (loop $label$38 - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (if - (i32.eqz - (local.get $2) - ) - (block $label$39 - (nop) - (br $label$0) - ) - (block $label$40 - (local.set $4 - (v128.const i32x4 0x05050505 0x46190000 0xc6800000 0x4a031a19) - ) - (br $label$0) - ) - ) - ) - ) - ) - (block $label$41 - (nop) - (br $label$0) - ) - ) - ) - (local.get $2) - (local.get $2) - ) - ) - (block $label$47 - (local.set $2 - (local.get $2) - ) - (br $label$0) - ) - (block $label$48 (result i32) - (loop $label$49 - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block - (local.set $5 - (f32.const 9.625223197211503e-38) - ) - (br_if $label$49 - (if (result i32) - (block $label$57 - (local.set $5 - (local.tee $5 - (block $label$58 (result f32) - (local.set $4 - (local.get $4) - ) - (local.get $5) - ) - ) - ) - (br $label$0) - ) - (if (result i32) - (i32.const 1376786182) - (block $label$60 - (if - (block $label$61 (result i32) - (i32.const 925442358) - ) - (block $label$62 - (br_if $label$62 - (i32.const 256) - ) - ) - (block $label$63 - (if - (local.get $2) - (local.set $1 - (local.get $1) - ) - (block $label$67 - (if - (i32.eqz - (i32.const 0) - ) - (block $label$68 - (local.set $1 - (local.get $1) - ) - (block $label$69 - (nop) - (local.set $4 - (local.get $4) - ) - ) - ) - (if - (i32.eqz - (br_if $label$48 - (i32.const 32768) - (local.get $2) - ) - ) - (local.set $4 - (v128.const i32x4 0xffffff81 0xffffffeb 0x80000000 0x74273131) - ) - (local.set $2 - (local.get $2) - ) - ) - ) - (local.set $0 - (i64.const -2097152) - ) - ) - ) - (local.set $1 - (local.get $1) - ) - ) - ) - (br $label$0) - ) - (block $label$70 (result i32) - (loop $label$71 (result i32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block (result i32) - (loop $label$72 - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (local.set $4 - (local.tee $4 - (local.get $4) - ) - ) - ) - (br_if $label$71 - (i32.eqz - (loop $label$73 - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block $label$74 - (local.set $4 - (v128.const i32x4 0xf8f8ff00 0x000000a5 0x0000000e 0xffff00ff) - ) - (br $label$73) - ) - ) - ) - ) - (i32.const -131072) - ) - ) - ) - ) - (if (result i32) - (local.get $2) - (block $label$75 - (call $log-i32 - (local.tee $2 - (i32.const 5) - ) - ) - (br $label$49) - ) - (block $label$76 (result i32) - (nop) - (local.tee $2 - (i32.const 1276448839) - ) - ) - ) - ) - ) - (local.set $2 - (local.get $2) - ) - ) - ) - (loop $label$90 - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block - (local.set $1 - (local.get $1) - ) - (br_if $label$90 - (i32.eqz - (local.tee $2 - (i32.const -93) - ) - ) - ) - (nop) - ) - ) - (local.get $2) - ) - ) - (block $label$91 (result i32) - (local.set $5 - (block $label$92 (result f32) - (local.set $1 - (loop $label$19 (result f64) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block (result f64) - (nop) - (br_if $label$19 - (i32.eqz - (i32.const -129) - ) - ) - (local.tee $1 - (f64.const -nan:0xffffffffffff0) - ) - ) - ) - ) - (local.get $5) - ) - ) - (local.get $2) - ) - (block $label$95 (result i32) - (local.get $2) + (i32.eqz + (local.tee $2 + (local.tee $2 + (local.tee $2 + (i32.const 512) ) ) ) - (local.get $4) - (block $label$96 (result v128) - (v128.const i32x4 0x80800000 0xdf800000 0xcf000000 0x4f800000) - ) ) ) + (local.set $4 + (v128.const i32x4 0x0e0a0e0d 0x0709060c 0x764b6f6f 0x00040000) + ) + (nop) ) ) (func $hangLimitInitializer (; 6 ;) diff --git a/test/passes/translate-to-fuzz_no-fuzz-nans_all-features.txt b/test/passes/translate-to-fuzz_no-fuzz-nans_all-features.txt index ba8dec2d4..91ed6ceca 100644 --- a/test/passes/translate-to-fuzz_no-fuzz-nans_all-features.txt +++ b/test/passes/translate-to-fuzz_no-fuzz-nans_all-features.txt @@ -9,7 +9,7 @@ (import "fuzzing-support" "log-i64" (func $log-i64 (param i64))) (import "fuzzing-support" "log-f32" (func $log-f32 (param f32))) (import "fuzzing-support" "log-f64" (func $log-f64 (param f64))) - (memory $0 (shared 1 1)) + (memory $0 1 1) (data (i32.const 0) "N\0fN\f5\f9\b1\ff\fa\eb\e5\fe\a7\ec\fb\fc\f4\a6\e4\ea\f0\ae\e3") (table $0 0 funcref) (global $global$0 (mut i32) (i32.const 975663930)) @@ -20,6 +20,7 @@ (event $event$0 (attr 0) (param i32 f32 i32 f64 i32)) (export "hashMemory" (func $hashMemory)) (export "memory" (memory $0)) + (export "func_5" (func $func_5)) (export "hangLimitInitializer" (func $hangLimitInitializer)) (func $hashMemory (; 4 ;) (type $FUNCSIG$i) (result i32) (local $0 i32) @@ -252,7 +253,7 @@ ) (local.get $0) ) - (func $func_5 (; 5 ;) (param $0 i64) + (func $func_5 (; 5 ;) (type $FUNCSIG$vj) (param $0 i64) (local $1 f64) (local $2 i32) (local $3 i64) @@ -293,235 +294,306 @@ (if (result v128) (i32.eqz (if (result i32) - (if (result i32) - (i32.eqz - (if (result i32) - (i32.eqz - (if - (i32.eqz - (if (result i32) - (i32.eqz - (if (result i32) - (i32.eqz - (if (result i32) - (local.get $2) - (loop $label$1 (result i32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) + (i32.eqz + (if (result i32) + (i32.eqz + (if (result i32) + (if (result i32) + (if (result i32) + (i32.eqz + (if + (i32.eqz + (if (result i32) + (local.get $2) + (loop $label$1 (result i32) + (block + (if + (i32.eqz + (global.get $hangLimit) ) + (return) ) - (block (result i32) - (block $label$2 - (local.set $3 - (i64.const 15662) - ) - (local.set $2 - (local.get $2) - ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) ) - (br_if $label$1 - (local.get $2) + ) + ) + (block (result i32) + (block $label$2 + (local.set $3 + (i64.const 15662) ) - (if (result i32) - (i32.eqz - (local.get $2) + (local.set $2 + (local.tee $2 + (i32.const 1010006831) ) - (local.get $2) + ) + ) + (br_if $label$1 + (local.get $2) + ) + (if (result i32) + (i32.eqz (local.get $2) ) + (local.get $2) + (local.get $2) ) ) - (block $label$3 (result i32) - (local.tee $2 - (i32.const 286267661) - ) + ) + (block $label$3 (result i32) + (local.tee $2 + (i32.const 286267661) ) ) ) - (block $label$4 - (loop $label$5 - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return) + ) + (block $label$4 + (loop $label$5 + (block + (if + (i32.eqz + (global.get $hangLimit) ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) + (return) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) ) ) - (block - (block $label$6 - (if - (i32.eqz - (loop $label$7 (result i32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return) + ) + (block + (block $label$6 + (if + (i32.eqz + (loop $label$7 (result i32) + (block + (if + (i32.eqz + (global.get $hangLimit) ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) + (return) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) ) ) - (i32.const 6506) ) - ) - (block $label$8 - (local.set $2 - (local.tee $2 - (local.get $2) + (block (result i32) + (local.set $1 + (f64.const -131072) + ) + (br_if $label$7 + (i32.const 387334656) ) + (local.get $2) ) - (local.set $5 - (local.get $5) + ) + ) + (block $label$8 + (local.set $2 + (local.tee $2 + (local.get $2) ) ) - (block $label$9 - (if - (local.tee $2 - (if (result i32) - (local.get $2) - (local.get $2) - (loop $label$10 (result i32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return) + (local.set $5 + (local.get $5) + ) + ) + (block $label$9 + (if + (local.tee $2 + (if (result i32) + (i32.const 1899592761) + (local.get $2) + (loop $label$10 (result i32) + (block + (if + (i32.eqz + (global.get $hangLimit) ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) + (return) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) ) ) - (block (result i32) - (nop) - (br_if $label$10 - (i32.eqz - (i32.const 64) - ) + ) + (block (result i32) + (nop) + (br_if $label$10 + (i32.eqz + (i32.const 64) ) - (local.tee $2 - (loop $label$11 (result i32) - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return) + ) + (local.tee $2 + (loop $label$11 (result i32) + (block + (if + (i32.eqz + (global.get $hangLimit) ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) + (return) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) ) ) - (i32.const 512) ) + (i32.const 512) ) ) ) ) ) - (local.set $3 - (local.get $3) - ) - (loop $label$12 - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) + ) + (local.set $3 + (local.get $3) + ) + (loop $label$12 + (block + (if + (i32.eqz + (global.get $hangLimit) ) + (return) ) - (local.set $1 - (local.get $1) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) ) ) - ) - (local.set $2 - (i32.const 170) + (local.set $1 + (local.get $1) + ) ) ) - ) - (call $log-i32 - (local.get $2) + (local.set $2 + (i32.const 170) + ) ) ) - (br_if $label$5 - (i32.eqz - (i32.const 2376257) - ) + (call $log-i32 + (i32.const 0) ) - (local.set $4 - (local.tee $4 - (v128.const i32x4 0xfff70000 0x007f700e 0x07420400 0x8000007f) - ) + ) + (br_if $label$5 + (i32.eqz + (i32.const 2376257) + ) + ) + (local.set $4 + (local.tee $4 + (v128.const i32x4 0xfff70000 0x007f700e 0x07420400 0x8000007f) ) ) ) - (block $label$13 - (if - (i32.eqz - (block $label$14 (result i32) - (local.set $4 - (v128.const i32x4 0x80000000 0x00000080 0xfffffffc 0x00007fff) - ) - (i32.const -123) + ) + (block $label$13 + (if + (i32.eqz + (block $label$14 (result i32) + (local.set $4 + (v128.const i32x4 0x80000000 0x00000080 0xfffffffc 0x00007fff) ) + (i32.const -123) ) - (local.set $1 - (local.get $1) + ) + (block $label$15 + (local.set $4 + (v128.const i32x4 0x00200000 0xc1e00000 0x00000000 0xc3e00000) ) - (local.set $5 - (local.get $5) + (local.set $4 + (v128.const i32x4 0x01ef00e4 0x7009efff 0x53000c13 0x0000153a) + ) + ) + (block $label$16 + (if + (local.get $2) + (local.set $0 + (local.tee $3 + (local.get $3) + ) + ) + (if + (i32.eqz + (local.get $2) + ) + (local.set $5 + (f32.const 12732744) + ) + (local.set $0 + (local.get $3) + ) + ) ) ) - (br $label$0) ) + (br $label$0) ) - (block $label$17 (result i32) - (i64.atomic.store offset=3 - (i32.const 640629291) - (local.tee $0 - (i64.const -16) - ) + ) + (block $label$17 + (if + (i32.eqz + (local.get $2) ) - (if (result i32) - (block $label$18 - (local.set $1 - (loop $label$19 (result f64) + (block $label$18 + (if + (local.tee $2 + (i32.const 127) + ) + (block $label$19 + (local.set $4 + (v128.const i32x4 0x0000001b 0x00000014 0x161b00bf 0x00402000) + ) + (local.set $1 + (f64.const 0) + ) + ) + (block $label$20 + (local.set $3 + (i64.const -67108864) + ) + (local.set $5 + (local.get $5) + ) + ) + ) + (loop $label$21 + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block + (local.set $4 + (local.get $4) + ) + (br_if $label$21 + (i32.const 85) + ) + (loop $label$22 (block (if (i32.eqz @@ -536,61 +608,113 @@ ) ) ) - (block (result f64) - (nop) - (br_if $label$19 + (block + (local.set $1 + (local.get $1) + ) + (br_if $label$22 (i32.eqz - (local.get $2) + (block $label$23 + (nop) + (br $label$21) + ) ) ) - (local.tee $1 - (f64.const 0) - ) + (nop) ) ) ) - (return) ) - (local.tee $2 - (local.get $2) + ) + (block $label$24 + (loop $label$25 + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block + (local.set $0 + (local.get $0) + ) + (br_if $label$25 + (i32.const -67108864) + ) + (local.set $5 + (local.get $5) + ) + ) ) - (block $label$20 - (loop $label$21 - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return) + (loop $label$26 + (block + (if + (i32.eqz + (global.get $hangLimit) ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) + (return) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block + (local.set $3 + (i64.const 128) + ) + (br_if $label$26 + (block $label$27 (result i32) + (local.set $4 + (v128.const i32x4 0x01010101 0x00000000 0x00000059 0x00000000) ) + (local.get $2) ) ) - (local.set $1 - (local.get $1) + (local.set $3 + (loop $label$28 (result i64) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (i64.const 246) + ) ) ) - (return) ) ) ) + (br $label$0) ) ) - (block $label$22 (result i32) - (local.set $5 - (f32.const 10160664) - ) - (if (result i32) + ) + (i32.const -31) + (block $label$29 (result i32) + (local.tee $3 + (if (i32.eqz - (i32.const 0) - ) - (block $label$23 - (local.set $1 - (loop $label$24 (result f64) + (br_if $label$29 + (loop $label$30 (result i32) (block (if (i32.eqz @@ -605,52 +729,133 @@ ) ) ) - (block (result f64) - (local.set $3 - (local.get $0) + (block (result i32) + (local.set $5 + (f32.const 49) ) - (br_if $label$24 - (i32.const -9) + (br_if $label$30 + (local.get $2) ) - (f64.const -18446744073709551615) + (local.get $2) ) ) + (local.tee $2 + (i32.const 342496264) + ) ) - (br $label$0) ) - (block $label$25 (result i32) - (loop $label$26 - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return) + (block $label$32 + (call $log-i32 + (call $hashMemory) + ) + (block + (block $label$33 + (local.set $3 + (i64.const -65535) ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) + (br $label$0) + ) + (drop + (local.get $2) + ) + ) + ) + (if + (i32.const -32768) + (block $label$34 + (br $label$0) + ) + (block $label$35 + (block $label$36 + (local.set $3 + (local.get $3) + ) + (local.set $4 + (local.get $4) ) ) - (block - (local.set $2 - (local.get $2) + (br $label$0) + ) + ) + ) + ) + (local.get $2) + ) + ) + (block $label$37 (result i32) + (loop $label$38 + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block + (block $label$39 + (local.set $5 + (f32.const 1.1754943508222875e-38) + ) + (local.set $2 + (i32.const -65535) + ) + ) + (br_if $label$38 + (loop $label$40 (result i32) + (block + (if + (i32.eqz + (global.get $hangLimit) ) - (br_if $label$26 - (i32.eqz - (if (result i32) - (br_if $label$25 - (i32.const -8) - (local.get $2) + (return) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block (result i32) + (block $label$41 + (local.set $0 + (local.tee $3 + (local.tee $3 + (local.get $0) + ) + ) + ) + (call $log-i32 + (call $hashMemory) + ) + ) + (br_if $label$40 + (loop $label$42 (result i32) + (block + (if + (i32.eqz + (global.get $hangLimit) ) - (local.get $2) - (block $label$29 (result i32) - (call $log-i32 - (call $hashMemory) - ) - (loop $label$30 (result i32) + (return) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block (result i32) + (block $label$43 + (local.set $4 + (loop $label$44 (result v128) (block (if (i32.eqz @@ -665,67 +870,394 @@ ) ) ) - (local.get $2) + (v128.const i32x4 0x00000000 0x40d1c680 0xffffffff 0xffefffff) + ) + ) + (nop) + ) + (br_if $label$42 + (loop $label$45 + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block + (local.set $5 + (local.get $5) + ) + (br_if $label$45 + (i32.const 101975070) + ) + (block $label$46 + (br $label$45) + ) ) ) ) + (local.tee $2 + (i32.const 32768) + ) ) ) - (local.set $5 + ) + (local.get $2) + ) + ) + ) + (loop $label$47 + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block + (drop + (v128.const i32x4 0x0000007f 0x00000000 0x372e2e2e 0x35373022) + ) + (br_if $label$47 + (i32.eqz + (local.get $2) + ) + ) + (local.set $5 + (local.tee $5 + (if (result f32) + (local.get $2) + (f32.const -8) (local.get $5) ) ) ) - (local.get $2) ) ) ) - (block $label$35 - (local.set $1 - (f64.const 1414944843) - ) - (br $label$0) - ) ) - ) - (local.tee $2 (local.tee $2 - (loop $label$38 - (block - (if - (i32.eqz - (global.get $hangLimit) + (local.tee $2 + (local.tee $2 + (local.tee $2 + (local.tee $2 + (local.get $2) ) - (return) ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) + ) + ) + ) + ) + (block $label$48 + (local.set $5 + (local.tee $5 + (local.tee $5 + (block $label$49 (result f32) + (local.set $4 + (local.get $4) ) + (local.get $5) ) ) - (if + ) + ) + (br $label$0) + ) + ) + (block $label$50 (result i32) + (if + (i32.eqz + (i32.const 2097152) + ) + (if + (i32.eqz + (if (result i32) (i32.eqz - (local.get $2) + (loop $label$51 (result i32) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block (result i32) + (block $label$52 + (local.set $5 + (local.tee $5 + (local.get $5) + ) + ) + (local.set $0 + (i64.const 128) + ) + ) + (br_if $label$51 + (i32.const 2) + ) + (i32.const 1667136122) + ) + ) ) - (block $label$39 - (nop) + (block $label$53 + (drop + (if (result f32) + (i32.eqz + (if (result i32) + (i32.eqz + (local.tee $2 + (br_if $label$50 + (local.get $2) + (local.get $2) + ) + ) + ) + (br_if $label$50 + (local.get $2) + (i32.const 8192) + ) + (local.get $2) + ) + ) + (block $label$54 (result f32) + (local.set $4 + (v128.const i32x4 0x040f1919 0x00800000 0x4a000000 0x00000000) + ) + (local.tee $5 + (f32.const 1.1754943508222875e-38) + ) + ) + (if (result f32) + (loop $label$55 (result i32) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (local.tee $2 + (local.tee $2 + (i32.const 470239259) + ) + ) + ) + (local.get $5) + (f32.const 20288) + ) + ) + ) (br $label$0) ) - (block $label$40 - (local.set $1 - (local.get $1) + (block $label$56 (result i32) + (br_if $label$0 + (i32.eqz + (br_if $label$56 + (i32.const 4096) + (i32.const 1048576) + ) + ) ) (br $label$0) ) ) ) + (block $label$57 + (block $label$58 + (local.set $0 + (local.tee $0 + (local.get $3) + ) + ) + (loop $label$59 + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block + (block $label$60 + (local.set $5 + (f32.const 1.7096404532038735e-33) + ) + (data.drop 0) + ) + (br_if $label$59 + (i32.eqz + (i32.const 235539981) + ) + ) + (local.set $5 + (local.tee $5 + (f32.const 1364283776) + ) + ) + ) + ) + ) + (block $label$61 + (local.set $4 + (v128.const i32x4 0x21474459 0xff7fffff 0x4cc3ca60 0x4b800000) + ) + (local.set $2 + (i32.const 32767) + ) + ) + ) + (block $label$62 + (local.set $2 + (if (result i32) + (loop $label$63 (result i32) + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block (result i32) + (block $label$64 + (if + (local.get $2) + (nop) + (nop) + ) + (block $label$65 + (local.set $0 + (local.get $0) + ) + (local.set $2 + (local.get $2) + ) + ) + ) + (br_if $label$63 + (br_if $label$50 + (local.get $2) + (i32.eqz + (local.get $2) + ) + ) + ) + (local.get $2) + ) + ) + (br_if $label$50 + (i32.const -86) + (i32.eqz + (if (result i32) + (i32.const -8192) + (i32.const 437327895) + (i32.const 32767) + ) + ) + ) + (block $label$66 + (local.set $4 + (v128.const i32x4 0x00000070 0x31313113 0x0000780c 0xffff8000) + ) + (loop $label$67 + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block $label$68 + (local.set $4 + (v128.const i32x4 0x657b077d 0x1113ff82 0x6c650000 0x0000fff8) + ) + (br $label$62) + ) + ) + ) + ) + ) + (local.set $5 + (local.get $5) + ) + ) + ) + (block $label$69 + (local.set $1 + (local.get $1) + ) + (local.set $1 + (local.get $1) + ) + ) + ) + (local.tee $2 + (local.tee $2 + (local.tee $2 + (local.tee $2 + (local.tee $2 + (local.tee $2 + (i32.const 32) + ) + ) + ) + ) ) ) - (block $label$41 - (memory.copy - (loop $label$42 (result i32) + ) + (block $label$70 (result i32) + (if + (i32.eqz + (loop $label$71 (result i32) (block (if (i32.eqz @@ -740,8 +1272,93 @@ ) ) ) - (if (result i32) - (loop $label$43 (result i32) + (block (result i32) + (memory.fill + (i32.and + (if (result i32) + (f32.gt + (local.get $5) + (local.tee $5 + (f32.const 504699424) + ) + ) + (block $label$72 + (local.set $2 + (i32.const -4) + ) + (br $label$0) + ) + (local.tee $2 + (i32.const 825172795) + ) + ) + (i32.const 15) + ) + (i32.and + (local.tee $2 + (i32.const -32768) + ) + (i32.const 15) + ) + (block $label$73 (result i32) + (loop $label$74 + (block + (if + (i32.eqz + (global.get $hangLimit) + ) + (return) + ) + (global.set $hangLimit + (i32.sub + (global.get $hangLimit) + (i32.const 1) + ) + ) + ) + (block + (block $label$75 + (local.set $4 + (local.get $4) + ) + (br_if $label$71 + (i32.const 359954033) + ) + ) + (br_if $label$74 + (i32.eqz + (local.get $2) + ) + ) + (local.set $5 + (local.get $5) + ) + ) + ) + (i32.const -127) + ) + ) + (br_if $label$71 + (i32.eqz + (i32.const 0) + ) + ) + (i32.const 0) + ) + ) + ) + (block $label$76 + (if + (i32.eqz + (block $label$77 + (local.set $5 + (local.get $5) + ) + (br $label$0) + ) + ) + (br_if $label$76 + (loop $label$78 (result i32) (block (if (i32.eqz @@ -756,119 +1373,128 @@ ) ) ) - (block $label$44 (result i32) - (local.set $3 - (i64.const 2097574720517510216) + (block (result i32) + (local.tee $2 + (block $label$79 + (local.set $2 + (local.tee $2 + (i32.const 1196248392) + ) + ) + (br $label$76) + ) ) - (if (result i32) + (br_if $label$78 (i32.eqz - (local.get $2) - ) - (i32.const 1296450369) - (local.tee $2 - (i32.const -14) + (i32.const 0) ) ) + (local.get $2) + ) + ) + ) + (local.set $1 + (local.tee $1 + (f64.const -2147483648) + ) + ) + ) + (local.set $4 + (local.tee $4 + (local.tee $4 + (local.tee $4 + (local.tee $4 + (local.get $4) + ) ) ) - (block $label$45 - (local.set $2 - (i32.const 235407412) + ) + ) + ) + (block $label$80 + (block $label$81 + (local.set $4 + (local.tee $4 + (local.tee $4 + (v128.const i32x4 0x080f185d 0x46aca200 0x41800000 0x4b060a0c) ) - (br $label$0) ) - (block $label$46 (result i32) - (local.set $2 - (local.tee $2 - (local.tee $2 - (local.tee $2 - (i32.const 1179009606) + ) + (block $label$82 + (if + (i32.eqz + (br_if $label$70 + (br_if $label$70 + (i32.const -65536) + (i32.eqz + (i32.const 757217343) ) ) + (i32.const -65535) + ) + ) + (local.set $3 + (local.tee $0 + (local.get $3) ) ) - (i32.const 1073741824) + (block $label$83 + (local.set $0 + (if (result i64) + (local.get $2) + (block $label$84 + (local.set $5 + (f32.const 119) + ) + (br $label$82) + ) + (local.get $0) + ) + ) + (local.set $3 + (block $label$85 (result i64) + (local.set $3 + (i64.const -82) + ) + (local.get $3) + ) + ) + ) + ) + (local.set $5 + (local.get $5) ) ) ) - (local.get $2) - (i32.const 1073741824) + (local.set $5 + (f32.const 10282366454988800) + ) ) - (return) ) - ) - ) - (local.get $2) - (local.get $2) - ) - ) - (block $label$47 - (local.set $2 - (local.get $2) - ) - (br $label$0) - ) - (block $label$48 (result i32) - (loop $label$49 - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (local.set $5 - (local.get $5) - ) - ) - (loop $label$90 - (block - (if - (i32.eqz - (global.get $hangLimit) - ) - (return) - ) - (global.set $hangLimit - (i32.sub - (global.get $hangLimit) - (i32.const 1) - ) - ) - ) - (block - (local.set $1 - (local.get $1) - ) - (local.set $2 (local.get $2) ) - (nop) ) ) (local.get $2) - ) - ) - (block $label$91 (result i32) - (local.set $5 - (block $label$92 (result f32) - (f32.const 6) + (block $label$88 (result i32) + (i32.const -16) ) ) + ) + (block $label$89 (result i32) + (local.get $2) + ) + (block $label$90 (result i32) (local.get $2) ) - (local.get $2) ) ) - (v128.const i32x4 0xffffffc0 0x00001f16 0x00008000 0x505c1a13) - (v128.const i32x4 0xc7007b11 0x721d0901 0x01810043 0x441f1201) + (block $label$91 (result v128) + (v128.const i32x4 0x00000000 0x41600000 0x00000000 0x42400000) + ) + (block $label$92 (result v128) + (v128.const i32x4 0x00000001 0x00001d6e 0x4f0affed 0x00020054) + ) ) ) ) diff --git a/test/spec/atomics.wast b/test/spec/atomics.wast new file mode 100644 index 000000000..4e6dd3563 --- /dev/null +++ b/test/spec/atomics.wast @@ -0,0 +1,8 @@ +(module + (memory $0 (shared 23 256)) + (func (export "atomic-fence") + (atomic.fence) + ) +) + +(assert_return (invoke "atomic-fence")) |