summaryrefslogtreecommitdiff
path: root/test/example
diff options
context:
space:
mode:
Diffstat (limited to 'test/example')
-rw-r--r--test/example/c-api-kitchen-sink.c12
-rw-r--r--test/example/c-api-kitchen-sink.txt91
-rw-r--r--test/example/c-api-kitchen-sink.txt.txt22
3 files changed, 101 insertions, 24 deletions
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)
)