diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 36 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.txt | 2 |
2 files changed, 19 insertions, 19 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, diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index e3a8e5676..8e04ff3fe 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -63,8 +63,8 @@ BinaryenFeatureAll: 122879 (elem $0 (table $0) (i32.const 0) func "$kitchen()sinker") (elem $passive func "$kitchen()sinker") (tag $a-tag (param i32)) - (export "kitchen_sinker" (func "$kitchen()sinker")) (export "mem" (memory $0)) + (export "kitchen_sinker" (func "$kitchen()sinker")) (start $starter) (func "$kitchen()sinker" (param $0 i32) (param $1 i64) (param $2 f32) (param $3 f64) (result i32) (local $4 i32) |