summaryrefslogtreecommitdiff
path: root/test/example/c-api-kitchen-sink.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/example/c-api-kitchen-sink.c')
-rw-r--r--test/example/c-api-kitchen-sink.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c
index 90ea43e8a..31d8b7733 100644
--- a/test/example/c-api-kitchen-sink.c
+++ b/test/example/c-api-kitchen-sink.c
@@ -434,6 +434,24 @@ void test_core() {
BinaryenType f64 = BinaryenTypeFloat64();
BinaryenType v128 = BinaryenTypeVec128();
+ // Memory. Add it before creating any memory-using instructions.
+
+ const char* segments[] = {"hello, world", "I am passive"};
+ bool segmentPassive[] = {false, true};
+ BinaryenExpressionRef segmentOffsets[] = {
+ BinaryenConst(module, BinaryenLiteralInt32(10)), NULL};
+ BinaryenIndex segmentSizes[] = {12, 12};
+ BinaryenSetMemory(module,
+ 1,
+ 256,
+ "mem",
+ segments,
+ segmentPassive,
+ segmentOffsets,
+ segmentSizes,
+ 2,
+ 1);
+
BinaryenExpressionRef valueList[] = {
// Unary
makeUnary(module, BinaryenClzInt32(), i32),
@@ -1062,24 +1080,6 @@ void test_core() {
BinaryenTableGrow(module, "0", valueExpr, sizeExpr);
BinaryenExpressionPrint(growExpr);
- // Memory. One per module
-
- const char* segments[] = {"hello, world", "I am passive"};
- bool segmentPassive[] = {false, true};
- BinaryenExpressionRef segmentOffsets[] = {
- BinaryenConst(module, BinaryenLiteralInt32(10)), NULL};
- BinaryenIndex segmentSizes[] = {12, 12};
- BinaryenSetMemory(module,
- 1,
- 256,
- "mem",
- segments,
- segmentPassive,
- segmentOffsets,
- segmentSizes,
- 2,
- 1);
-
// Start function. One per module
BinaryenFunctionRef starter = BinaryenAddFunction(module,