diff options
author | Ashley Nelson <nashley@google.com> | 2022-08-17 18:44:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-17 18:44:29 -0700 |
commit | 3aff4c6e85623c970280219c6699a66bc9de5f9b (patch) | |
tree | e5440bc966e523a7404ae2cec3458dacbe1281d1 /test/example | |
parent | b70fe755aa4c90727edfd91dc0a9a51febf0239d (diff) | |
download | binaryen-3aff4c6e85623c970280219c6699a66bc9de5f9b.tar.gz binaryen-3aff4c6e85623c970280219c6699a66bc9de5f9b.tar.bz2 binaryen-3aff4c6e85623c970280219c6699a66bc9de5f9b.zip |
Mutli-Memories Support in IR (#4811)
This PR removes the single memory restriction in IR, adding support for a single module to reference multiple memories. To support this change, a new memory name field was added to 13 memory instructions in order to identify the memory for the instruction.
It is a goal of this PR to maintain backwards compatibility with existing text and binary wasm modules, so memory indexes remain optional for memory instructions. Similarly, the JS API makes assumptions about which memory is intended when only one memory is present in the module. Another goal of this PR is that existing tests behavior be unaffected. That said, tests must now explicitly define a memory before invoking memory instructions or exporting a memory, and memory names are now printed for each memory instruction in the text format.
There remain quite a few places where a hardcoded reference to the first memory persist (memory flattening, for example, will return early if more than one memory is present in the module). Many of these call-sites, particularly within passes, will require us to rethink how the optimization works in a multi-memories world. Other call-sites may necessitate more invasive code restructuring to fully convert away from relying on a globally available, single memory pointer.
Diffstat (limited to 'test/example')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 92 | ||||
-rw-r--r-- | test/example/c-api-relooper-unreachable-if.cpp | 216 | ||||
-rw-r--r-- | test/example/c-api-unused-mem.cpp | 30 | ||||
-rw-r--r-- | test/example/relooper-fuzz.c | 47 | ||||
-rw-r--r-- | test/example/relooper-fuzz1.c | 47 | ||||
-rw-r--r-- | test/example/relooper-fuzz2.c | 472 | ||||
-rw-r--r-- | test/example/relooper-merge1.c | 44 | ||||
-rw-r--r-- | test/example/relooper-merge2.c | 44 | ||||
-rw-r--r-- | test/example/relooper-merge3.c | 44 | ||||
-rw-r--r-- | test/example/relooper-merge4.c | 44 | ||||
-rw-r--r-- | test/example/relooper-merge5.c | 44 | ||||
-rw-r--r-- | test/example/relooper-merge6.c | 44 |
12 files changed, 668 insertions, 500 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index dab64522a..cb8349f89 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -160,7 +160,7 @@ BinaryenExpressionRef makeMemoryInit(BinaryenModuleRef module) { BinaryenExpressionRef dest = makeInt32(module, 1024); BinaryenExpressionRef offset = makeInt32(module, 0); BinaryenExpressionRef size = makeInt32(module, 12); - return BinaryenMemoryInit(module, 0, dest, offset, size); + return BinaryenMemoryInit(module, 0, dest, offset, size, "0"); }; BinaryenExpressionRef makeDataDrop(BinaryenModuleRef module) { @@ -171,14 +171,14 @@ BinaryenExpressionRef makeMemoryCopy(BinaryenModuleRef module) { BinaryenExpressionRef dest = makeInt32(module, 2048); BinaryenExpressionRef source = makeInt32(module, 1024); BinaryenExpressionRef size = makeInt32(module, 12); - return BinaryenMemoryCopy(module, dest, source, size); + return BinaryenMemoryCopy(module, dest, source, size, "0", "0"); }; BinaryenExpressionRef makeMemoryFill(BinaryenModuleRef module) { BinaryenExpressionRef dest = makeInt32(module, 0); BinaryenExpressionRef value = makeInt32(module, 42); BinaryenExpressionRef size = makeInt32(module, 1024); - return BinaryenMemoryFill(module, dest, value, size); + return BinaryenMemoryFill(module, dest, value, size, "0"); }; // tests @@ -488,7 +488,8 @@ void test_core() { segmentOffsets, segmentSizes, 2, - 1); + 1, + "0"); BinaryenExpressionRef valueList[] = { // Unary @@ -784,29 +785,29 @@ void test_core() { makeSIMDShift(module, BinaryenShrUVecI64x2()), // SIMD load BinaryenSIMDLoad( - module, BinaryenLoad8SplatVec128(), 0, 1, makeInt32(module, 128)), + module, BinaryenLoad8SplatVec128(), 0, 1, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad16SplatVec128(), 16, 1, makeInt32(module, 128)), + module, BinaryenLoad16SplatVec128(), 16, 1, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad32SplatVec128(), 16, 4, makeInt32(module, 128)), + module, BinaryenLoad32SplatVec128(), 16, 4, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad64SplatVec128(), 0, 4, makeInt32(module, 128)), + module, BinaryenLoad64SplatVec128(), 0, 4, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad8x8SVec128(), 0, 8, makeInt32(module, 128)), + module, BinaryenLoad8x8SVec128(), 0, 8, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad8x8UVec128(), 0, 8, makeInt32(module, 128)), + module, BinaryenLoad8x8UVec128(), 0, 8, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad16x4SVec128(), 0, 8, makeInt32(module, 128)), + module, BinaryenLoad16x4SVec128(), 0, 8, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad16x4UVec128(), 0, 8, makeInt32(module, 128)), + module, BinaryenLoad16x4UVec128(), 0, 8, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad32x2SVec128(), 0, 8, makeInt32(module, 128)), + module, BinaryenLoad32x2SVec128(), 0, 8, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad32x2UVec128(), 0, 8, makeInt32(module, 128)), + module, BinaryenLoad32x2UVec128(), 0, 8, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad32ZeroVec128(), 0, 4, makeInt32(module, 128)), + module, BinaryenLoad32ZeroVec128(), 0, 4, makeInt32(module, 128), "0"), BinaryenSIMDLoad( - module, BinaryenLoad64ZeroVec128(), 0, 8, makeInt32(module, 128)), + module, BinaryenLoad64ZeroVec128(), 0, 8, makeInt32(module, 128), "0"), // SIMD load/store lane BinaryenSIMDLoadStoreLane(module, BinaryenLoad8LaneVec128(), @@ -814,57 +815,64 @@ void test_core() { 1, 0, makeInt32(module, 128), - makeVec128(module, v128_bytes)), + makeVec128(module, v128_bytes), + "0"), BinaryenSIMDLoadStoreLane(module, BinaryenLoad16LaneVec128(), 0, 2, 0, makeInt32(module, 128), - makeVec128(module, v128_bytes)), + makeVec128(module, v128_bytes), + "0"), BinaryenSIMDLoadStoreLane(module, BinaryenLoad32LaneVec128(), 0, 4, 0, makeInt32(module, 128), - makeVec128(module, v128_bytes)), + makeVec128(module, v128_bytes), + "0"), BinaryenSIMDLoadStoreLane(module, BinaryenLoad64LaneVec128(), 0, 8, 0, makeInt32(module, 128), - makeVec128(module, v128_bytes)), - + makeVec128(module, v128_bytes), + "0"), BinaryenSIMDLoadStoreLane(module, BinaryenStore8LaneVec128(), 0, 1, 0, makeInt32(module, 128), - makeVec128(module, v128_bytes)), + makeVec128(module, v128_bytes), + "0"), BinaryenSIMDLoadStoreLane(module, BinaryenStore16LaneVec128(), 0, 2, 0, makeInt32(module, 128), - makeVec128(module, v128_bytes)), + makeVec128(module, v128_bytes), + "0"), BinaryenSIMDLoadStoreLane(module, BinaryenStore32LaneVec128(), 0, 4, 0, makeInt32(module, 128), - makeVec128(module, v128_bytes)), + makeVec128(module, v128_bytes), + "0"), BinaryenSIMDLoadStoreLane(module, BinaryenStore64LaneVec128(), 0, 8, 0, makeInt32(module, 128), - makeVec128(module, v128_bytes)), + makeVec128(module, v128_bytes), + "0"), // Other SIMD makeSIMDShuffle(module), makeSIMDTernary(module, BinaryenBitselectVec128()), @@ -914,14 +922,16 @@ void test_core() { BinaryenDrop( module, BinaryenLocalTee(module, 0, makeInt32(module, 102), BinaryenTypeInt32())), - BinaryenLoad(module, 4, 0, 0, 0, BinaryenTypeInt32(), makeInt32(module, 1)), - BinaryenLoad(module, 2, 1, 2, 1, BinaryenTypeInt64(), makeInt32(module, 8)), BinaryenLoad( - module, 4, 0, 0, 0, BinaryenTypeFloat32(), makeInt32(module, 2)), + module, 4, 0, 0, 0, BinaryenTypeInt32(), makeInt32(module, 1), "0"), + BinaryenLoad( + module, 2, 1, 2, 1, BinaryenTypeInt64(), makeInt32(module, 8), "0"), + BinaryenLoad( + module, 4, 0, 0, 0, BinaryenTypeFloat32(), makeInt32(module, 2), "0"), BinaryenLoad( - module, 8, 0, 2, 8, BinaryenTypeFloat64(), makeInt32(module, 9)), - BinaryenStore(module, 4, 0, 0, temp13, temp14, BinaryenTypeInt32()), - BinaryenStore(module, 8, 2, 4, temp15, temp16, BinaryenTypeInt64()), + module, 8, 0, 2, 8, BinaryenTypeFloat64(), makeInt32(module, 9), "0"), + BinaryenStore(module, 4, 0, 0, temp13, temp14, BinaryenTypeInt32(), "0"), + BinaryenStore(module, 8, 2, 4, temp15, temp16, BinaryenTypeInt64(), "0"), BinaryenSelect(module, temp10, temp11, temp12, BinaryenTypeAuto()), BinaryenReturn(module, makeInt32(module, 1337)), // Tail call @@ -1002,12 +1012,13 @@ void test_core() { 4, 0, temp6, - BinaryenAtomicLoad(module, 4, 0, BinaryenTypeInt32(), temp6), - BinaryenTypeInt32()), - BinaryenDrop( - module, - BinaryenAtomicWait(module, temp6, temp6, temp16, BinaryenTypeInt32())), - BinaryenDrop(module, BinaryenAtomicNotify(module, temp6, temp6)), + BinaryenAtomicLoad(module, 4, 0, BinaryenTypeInt32(), temp6, "0"), + BinaryenTypeInt32(), + "0"), + BinaryenDrop(module, + BinaryenAtomicWait( + module, temp6, temp6, temp16, BinaryenTypeInt32(), "0")), + BinaryenDrop(module, BinaryenAtomicNotify(module, temp6, temp6, "0")), BinaryenAtomicFence(module), // Tuples BinaryenTupleMake(module, tupleElements4a, 4), @@ -1022,8 +1033,8 @@ void test_core() { BinaryenPop(module, BinaryenTypeExternref()), BinaryenPop(module, iIfF), // Memory - BinaryenMemorySize(module), - BinaryenMemoryGrow(module, makeInt32(module, 0)), + BinaryenMemorySize(module, "0"), + BinaryenMemoryGrow(module, makeInt32(module, 0), "0"), // GC BinaryenI31New(module, makeInt32(module, 0)), BinaryenI31Get(module, i31refExpr, 1), @@ -1683,7 +1694,8 @@ void test_for_each() { segmentOffsets, segmentSizes, 2, - 0); + 0, + "0"); BinaryenAddGlobal(module, "a-global", BinaryenTypeInt32(), diff --git a/test/example/c-api-relooper-unreachable-if.cpp b/test/example/c-api-relooper-unreachable-if.cpp index e8bfc43bc..c63ca0204 100644 --- a/test/example/c-api-relooper-unreachable-if.cpp +++ b/test/example/c-api-relooper-unreachable-if.cpp @@ -28,13 +28,20 @@ int main() { segmentOffsets, segmentSizes, 0, - 0); + 0, + "0"); } the_relooper = RelooperCreate(the_module); expressions[1] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[2] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[3] = BinaryenStore( - the_module, 4, 0, 0, expressions[2], expressions[1], BinaryenTypeInt32()); + expressions[3] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[2], + expressions[1], + BinaryenTypeInt32(), + "0"); expressions[4] = BinaryenReturn(the_module, expressions[0]); { BinaryenExpressionRef children[] = {expressions[3], expressions[4]}; @@ -43,8 +50,8 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[5]); expressions[6] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[7] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[6]); + expressions[7] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[6], "0"); expressions[8] = BinaryenLocalSet(the_module, 0, expressions[7]); relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[8]); RelooperAddBranch( @@ -66,8 +73,14 @@ int main() { the_relooper = RelooperCreate(the_module); expressions[10] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[11] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[12] = BinaryenStore( - the_module, 4, 0, 0, expressions[11], expressions[10], BinaryenTypeInt32()); + expressions[12] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[11], + expressions[10], + BinaryenTypeInt32(), + "0"); expressions[13] = BinaryenReturn(the_module, expressions[0]); { BinaryenExpressionRef children[] = {expressions[12], expressions[13]}; @@ -76,8 +89,8 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[14]); expressions[15] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[16] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[15]); + expressions[16] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[15], "0"); expressions[17] = BinaryenLocalSet(the_module, 0, expressions[16]); relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[17]); RelooperAddBranch( @@ -115,8 +128,8 @@ int main() { RelooperAddBranch( relooperBlocks[1], relooperBlocks[1], expressions[0], expressions[0]); expressions[21] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[22] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[21]); + expressions[22] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[21], "0"); expressions[23] = BinaryenLocalSet(the_module, 0, expressions[22]); relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[23]); RelooperAddBranch( @@ -139,8 +152,14 @@ int main() { the_relooper = RelooperCreate(the_module); expressions[25] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[26] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[27] = BinaryenStore( - the_module, 4, 0, 0, expressions[26], expressions[25], BinaryenTypeInt32()); + expressions[27] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[26], + expressions[25], + BinaryenTypeInt32(), + "0"); expressions[28] = BinaryenReturn(the_module, expressions[0]); { BinaryenExpressionRef children[] = {expressions[27], expressions[28]}; @@ -149,8 +168,8 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[29]); expressions[30] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[31] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[30]); + expressions[31] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[30], "0"); expressions[32] = BinaryenLocalSet(the_module, 0, expressions[31]); relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[32]); RelooperAddBranch( @@ -174,8 +193,14 @@ int main() { the_relooper = RelooperCreate(the_module); expressions[34] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[35] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[36] = BinaryenStore( - the_module, 4, 0, 0, expressions[35], expressions[34], BinaryenTypeInt32()); + expressions[36] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[35], + expressions[34], + BinaryenTypeInt32(), + "0"); expressions[37] = BinaryenReturn(the_module, expressions[0]); { BinaryenExpressionRef children[] = {expressions[36], expressions[37]}; @@ -184,8 +209,8 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[38]); expressions[39] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[40] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[39]); + expressions[40] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[39], "0"); expressions[41] = BinaryenLocalSet(the_module, 0, expressions[40]); relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[41]); RelooperAddBranch( @@ -232,8 +257,14 @@ int main() { relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[49]); expressions[50] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt32()); expressions[51] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[52] = BinaryenStore( - the_module, 4, 0, 0, expressions[51], expressions[50], BinaryenTypeInt32()); + expressions[52] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[51], + expressions[50], + BinaryenTypeInt32(), + "0"); expressions[53] = BinaryenReturn(the_module, expressions[0]); { BinaryenExpressionRef children[] = {expressions[52], expressions[53]}; @@ -244,8 +275,8 @@ int main() { RelooperAddBranch( relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]); expressions[55] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[56] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[55]); + expressions[56] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[55], "0"); expressions[57] = BinaryenLocalSet(the_module, 3, expressions[56]); relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[57]); RelooperAddBranch( @@ -287,20 +318,38 @@ int main() { BinaryenBinary(the_module, 36, expressions[72], expressions[71]); expressions[74] = BinaryenUnary(the_module, 24, expressions[73]); expressions[75] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[76] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[75]); + expressions[76] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[75], "0"); expressions[77] = BinaryenConst(the_module, BinaryenLiteralInt32(128)); expressions[78] = BinaryenBinary(the_module, 1, expressions[76], expressions[77]); expressions[79] = BinaryenLocalTee(the_module, 3, expressions[78], BinaryenTypeInt32()); - expressions[80] = BinaryenStore( - the_module, 4, 0, 0, expressions[75], expressions[79], BinaryenTypeInt32()); + expressions[80] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[75], + expressions[79], + BinaryenTypeInt32(), + "0"); expressions[81] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt32()); - expressions[82] = BinaryenStore( - the_module, 4, 0, 0, expressions[81], expressions[70], BinaryenTypeInt32()); - expressions[83] = BinaryenStore( - the_module, 4, 4, 0, expressions[81], expressions[74], BinaryenTypeInt32()); + expressions[82] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[81], + expressions[70], + BinaryenTypeInt32(), + "0"); + expressions[83] = BinaryenStore(the_module, + 4, + 4, + 0, + expressions[81], + expressions[74], + BinaryenTypeInt32(), + "0"); { BinaryenExpressionRef children[] = {expressions[60], expressions[62], @@ -313,8 +362,8 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[84]); expressions[85] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt32()); - expressions[86] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[85]); + expressions[86] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[85], "0"); expressions[87] = BinaryenLocalSet(the_module, 1, expressions[86]); expressions[88] = BinaryenLocalGet(the_module, 1, BinaryenTypeInt32()); expressions[89] = BinaryenLocalSet(the_module, 4, expressions[88]); @@ -322,8 +371,14 @@ int main() { expressions[91] = BinaryenLocalSet(the_module, 5, expressions[90]); expressions[92] = BinaryenLocalGet(the_module, 6, BinaryenTypeInt32()); expressions[93] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[94] = BinaryenStore( - the_module, 4, 0, 0, expressions[93], expressions[92], BinaryenTypeInt32()); + expressions[94] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[93], + expressions[92], + BinaryenTypeInt32(), + "0"); expressions[95] = BinaryenLocalGet(the_module, 5, BinaryenTypeInt32()); expressions[96] = BinaryenReturn(the_module, expressions[95]); { @@ -337,8 +392,8 @@ int main() { } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[97]); expressions[98] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt32()); - expressions[99] = - BinaryenLoad(the_module, 4, 0, 8, 0, BinaryenTypeInt32(), expressions[98]); + expressions[99] = BinaryenLoad( + the_module, 4, 0, 8, 0, BinaryenTypeInt32(), expressions[98], "0"); RelooperAddBranch( relooperBlocks[0], relooperBlocks[1], expressions[99], expressions[0]); expressions[100] = BinaryenUnreachable(the_module); @@ -346,8 +401,8 @@ int main() { RelooperAddBranch( relooperBlocks[0], relooperBlocks[2], expressions[0], expressions[0]); expressions[101] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[102] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[101]); + expressions[102] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[101], "0"); expressions[103] = BinaryenLocalSet(the_module, 6, expressions[102]); relooperBlocks[3] = RelooperAddBlock(the_relooper, expressions[103]); RelooperAddBranch( @@ -403,8 +458,8 @@ int main() { BinaryenBinary(the_module, 36, expressions[119], expressions[118]); expressions[121] = BinaryenUnary(the_module, 24, expressions[120]); expressions[122] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[123] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[122]); + expressions[123] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[122], "0"); expressions[124] = BinaryenConst(the_module, BinaryenLiteralInt32(128)); expressions[125] = BinaryenBinary(the_module, 1, expressions[123], expressions[124]); @@ -416,7 +471,8 @@ int main() { 0, expressions[122], expressions[126], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); expressions[128] = BinaryenLocalGet(the_module, 5, BinaryenTypeInt32()); expressions[129] = BinaryenStore(the_module, 4, @@ -424,14 +480,16 @@ int main() { 0, expressions[128], expressions[117], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); expressions[130] = BinaryenStore(the_module, 4, 4, 0, expressions[128], expressions[121], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); { BinaryenExpressionRef children[] = { expressions[115], expressions[127], expressions[129], expressions[130]}; @@ -440,8 +498,8 @@ int main() { } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[131]); expressions[132] = BinaryenLocalGet(the_module, 5, BinaryenTypeInt32()); - expressions[133] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[132]); + expressions[133] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[132], "0"); expressions[134] = BinaryenLocalSet(the_module, 3, expressions[133]); expressions[135] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt32()); expressions[136] = BinaryenLocalSet(the_module, 6, expressions[135]); @@ -470,7 +528,8 @@ int main() { 0, expressions[145], expressions[144], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); expressions[147] = BinaryenLocalGet(the_module, 8, BinaryenTypeInt32()); expressions[148] = BinaryenReturn(the_module, expressions[147]); { @@ -483,8 +542,8 @@ int main() { RelooperAddBranch( relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]); expressions[150] = BinaryenLocalGet(the_module, 5, BinaryenTypeInt32()); - expressions[151] = - BinaryenLoad(the_module, 4, 0, 8, 0, BinaryenTypeInt32(), expressions[150]); + expressions[151] = BinaryenLoad( + the_module, 4, 0, 8, 0, BinaryenTypeInt32(), expressions[150], "0"); RelooperAddBranch( relooperBlocks[1], relooperBlocks[2], expressions[151], expressions[0]); expressions[152] = BinaryenUnreachable(the_module); @@ -494,8 +553,8 @@ int main() { RelooperAddBranch( relooperBlocks[2], relooperBlocks[3], expressions[0], expressions[0]); expressions[153] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[154] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[153]); + expressions[154] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[153], "0"); expressions[155] = BinaryenLocalSet(the_module, 9, expressions[154]); relooperBlocks[5] = RelooperAddBlock(the_relooper, expressions[155]); RelooperAddBranch( @@ -538,7 +597,8 @@ int main() { segmentOffsets, segmentSizes, 0, - 0); + 0, + "0"); } expressions[157] = BinaryenConst(the_module, BinaryenLiteralInt32(65535)); expressions[158] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); @@ -548,7 +608,8 @@ int main() { 0, expressions[158], expressions[157], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); expressions[160] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); expressions[161] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); { @@ -598,8 +659,8 @@ int main() { BinaryenBinary(the_module, 36, expressions[182], expressions[181]); expressions[184] = BinaryenUnary(the_module, 24, expressions[183]); expressions[185] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[186] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[185]); + expressions[186] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[185], "0"); expressions[187] = BinaryenConst(the_module, BinaryenLiteralInt32(128)); expressions[188] = BinaryenBinary(the_module, 1, expressions[186], expressions[187]); @@ -611,7 +672,8 @@ int main() { 0, expressions[185], expressions[189], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); expressions[191] = BinaryenLocalGet(the_module, 6, BinaryenTypeInt32()); expressions[192] = BinaryenStore(the_module, 4, @@ -619,14 +681,16 @@ int main() { 0, expressions[191], expressions[180], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); expressions[193] = BinaryenStore(the_module, 4, 4, 0, expressions[191], expressions[184], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); { BinaryenExpressionRef children[] = {expressions[166], expressions[168], @@ -641,8 +705,8 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[194]); expressions[195] = BinaryenLocalGet(the_module, 6, BinaryenTypeInt32()); - expressions[196] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[195]); + expressions[196] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[195], "0"); expressions[197] = BinaryenLocalSet(the_module, 7, expressions[196]); expressions[198] = BinaryenLocalGet(the_module, 8, BinaryenTypeInt32()); expressions[199] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); @@ -652,7 +716,8 @@ int main() { 0, expressions[199], expressions[198], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); expressions[201] = BinaryenLocalGet(the_module, 7, BinaryenTypeInt32()); expressions[202] = BinaryenReturn(the_module, expressions[201]); { @@ -663,8 +728,8 @@ int main() { } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[203]); expressions[204] = BinaryenLocalGet(the_module, 6, BinaryenTypeInt32()); - expressions[205] = - BinaryenLoad(the_module, 4, 0, 8, 0, BinaryenTypeInt32(), expressions[204]); + expressions[205] = BinaryenLoad( + the_module, 4, 0, 8, 0, BinaryenTypeInt32(), expressions[204], "0"); RelooperAddBranch( relooperBlocks[0], relooperBlocks[1], expressions[205], expressions[0]); expressions[206] = BinaryenUnreachable(the_module); @@ -672,8 +737,8 @@ int main() { RelooperAddBranch( relooperBlocks[0], relooperBlocks[2], expressions[0], expressions[0]); expressions[207] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[208] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[207]); + expressions[208] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[207], "0"); expressions[209] = BinaryenLocalSet(the_module, 8, expressions[208]); relooperBlocks[3] = RelooperAddBlock(the_relooper, expressions[209]); RelooperAddBranch( @@ -719,7 +784,8 @@ int main() { 0, expressions[219], expressions[218], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); expressions[221] = BinaryenLocalGet(the_module, 3, BinaryenTypeInt32()); expressions[222] = BinaryenReturn(the_module, expressions[221]); { @@ -733,8 +799,8 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[223]); expressions[224] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[225] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[224]); + expressions[225] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[224], "0"); expressions[226] = BinaryenLocalSet(the_module, 4, expressions[225]); relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[226]); RelooperAddBranch( @@ -780,7 +846,8 @@ int main() { 0, expressions[241], expressions[240], - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); expressions[243] = BinaryenLocalGet(the_module, 6, BinaryenTypeInt32()); expressions[244] = BinaryenReturn(the_module, expressions[243]); { @@ -796,8 +863,8 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[245]); expressions[246] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[247] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[246]); + expressions[247] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[246], "0"); expressions[248] = BinaryenLocalSet(the_module, 7, expressions[247]); relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[248]); RelooperAddBranch( @@ -848,7 +915,8 @@ int main() { 0, expressions[263], expressions[262], - BinaryenTypeInt64()); + BinaryenTypeInt64(), + "0"); expressions[265] = BinaryenLocalGet(the_module, 6, BinaryenTypeInt32()); expressions[266] = BinaryenReturn(the_module, expressions[265]); { @@ -864,8 +932,8 @@ int main() { } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[267]); expressions[268] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[269] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt64(), expressions[268]); + expressions[269] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt64(), expressions[268], "0"); expressions[270] = BinaryenLocalSet(the_module, 7, expressions[269]); relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[270]); RelooperAddBranch( diff --git a/test/example/c-api-unused-mem.cpp b/test/example/c-api-unused-mem.cpp index d395753f7..6c0fd14c1 100644 --- a/test/example/c-api-unused-mem.cpp +++ b/test/example/c-api-unused-mem.cpp @@ -29,7 +29,8 @@ int main() { segmentOffsets, segmentSizes, 0, - 0); + 0, + "0"); } the_relooper = RelooperCreate(the_module); { @@ -40,8 +41,14 @@ int main() { relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[1]); expressions[2] = BinaryenLocalGet(the_module, 0, BinaryenTypeInt32()); expressions[3] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[4] = BinaryenStore( - the_module, 4, 0, 0, expressions[3], expressions[2], BinaryenTypeInt32()); + expressions[4] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[3], + expressions[2], + BinaryenTypeInt32(), + "0"); expressions[5] = BinaryenReturn(the_module, expressions[0]); { BinaryenExpressionRef children[] = {expressions[4], expressions[5]}; @@ -52,8 +59,8 @@ int main() { RelooperAddBranch( relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]); expressions[7] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[8] = - BinaryenLoad(the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[7]); + expressions[8] = BinaryenLoad( + the_module, 4, 0, 0, 0, BinaryenTypeInt32(), expressions[7], "0"); expressions[9] = BinaryenLocalSet(the_module, 0, expressions[8]); relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[9]); RelooperAddBranch( @@ -86,12 +93,19 @@ int main() { segmentOffsets, segmentSizes, 0, - 0); + 0, + "0"); } expressions[11] = BinaryenConst(the_module, BinaryenLiteralInt32(65535)); expressions[12] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); - expressions[13] = BinaryenStore( - the_module, 4, 0, 0, expressions[12], expressions[11], BinaryenTypeInt32()); + expressions[13] = BinaryenStore(the_module, + 4, + 0, + 0, + expressions[12], + expressions[11], + BinaryenTypeInt32(), + "0"); { BinaryenExpressionRef operands[] = {0}; expressions[14] = diff --git a/test/example/relooper-fuzz.c b/test/example/relooper-fuzz.c index d953d9cf2..f0b727f4c 100644 --- a/test/example/relooper-fuzz.c +++ b/test/example/relooper-fuzz.c @@ -25,7 +25,8 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 27)) // jumps of 4 bytes ), BinaryenUnreachable(module), @@ -45,29 +46,32 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); // optionally, print the return value BinaryenExpressionRef args[] = {BinaryenBinary( module, BinaryenSubInt32(), BinaryenConst(module, BinaryenLiteralInt32(0)), - BinaryenLoad( - module, - 4, - 0, - 4, - 0, - BinaryenTypeInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))))}; + BinaryenLoad(module, + 4, + 0, + 4, + 0, + BinaryenTypeInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"))}; BinaryenExpressionRef debugger; if (1) debugger = BinaryenCall(module, "print", args, 1, BinaryenTypeNone()); @@ -89,7 +93,9 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))); + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"); BinaryenExpressionRef checkBodyList[] = {halter, incer, debugger, returner}; BinaryenExpressionRef checkBody = BinaryenBlock(module, @@ -338,7 +344,8 @@ int main() { 0, BinaryenConst(module, BinaryenLiteralInt32(8 + 4 * i)), BinaryenConst(module, BinaryenLiteralInt32(decisions[i])), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); } } full[numDecisions] = body; @@ -362,7 +369,7 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0); + BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, "0"); assert(BinaryenModuleValidate(module)); diff --git a/test/example/relooper-fuzz1.c b/test/example/relooper-fuzz1.c index 9e49fbcd3..f481fe713 100644 --- a/test/example/relooper-fuzz1.c +++ b/test/example/relooper-fuzz1.c @@ -23,7 +23,8 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 30)) // jumps of 4 bytes ), BinaryenUnreachable(module), @@ -43,29 +44,32 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); // optionally, print the return value BinaryenExpressionRef args[] = {BinaryenBinary( module, BinaryenSubInt32(), BinaryenConst(module, BinaryenLiteralInt32(0)), - BinaryenLoad( - module, - 4, - 0, - 4, - 0, - BinaryenTypeInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))))}; + BinaryenLoad(module, + 4, + 0, + 4, + 0, + BinaryenTypeInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"))}; BinaryenExpressionRef debugger; if (1) debugger = BinaryenCall(module, "print", args, 1, BinaryenTypeNone()); @@ -87,7 +91,9 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))); + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"); BinaryenExpressionRef checkBodyList[] = {halter, incer, debugger, returner}; BinaryenExpressionRef checkBody = BinaryenBlock(module, @@ -337,7 +343,8 @@ int main() { 0, BinaryenConst(module, BinaryenLiteralInt32(8 + 4 * i)), BinaryenConst(module, BinaryenLiteralInt32(decisions[i])), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); } } full[numDecisions] = body; @@ -359,7 +366,7 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0); + BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, "0"); assert(BinaryenModuleValidate(module)); diff --git a/test/example/relooper-fuzz2.c b/test/example/relooper-fuzz2.c index a48b86e2a..c179606a0 100644 --- a/test/example/relooper-fuzz2.c +++ b/test/example/relooper-fuzz2.c @@ -23,7 +23,8 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 27)) // jumps of 4 bytes ), BinaryenUnreachable(module), @@ -43,29 +44,32 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); // optionally, print the return value BinaryenExpressionRef args[] = {BinaryenBinary( module, BinaryenSubInt32(), BinaryenConst(module, BinaryenLiteralInt32(0)), - BinaryenLoad( - module, - 4, - 0, - 4, - 0, - BinaryenTypeInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))))}; + BinaryenLoad(module, + 4, + 0, + 4, + 0, + BinaryenTypeInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"))}; BinaryenExpressionRef debugger; if (1) debugger = BinaryenCall(module, "print", args, 1, BinaryenTypeNone()); @@ -87,7 +91,9 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))); + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"); BinaryenExpressionRef checkBodyList[] = {halter, incer, debugger, returner}; BinaryenExpressionRef checkBody = BinaryenBlock(module, @@ -266,47 +272,49 @@ int main() { b0, b1, NULL, - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 4))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 4))), + BinaryenTypeInt32(), + "0")); RelooperAddBranch( b1, b1, NULL, - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 4))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 4))), + BinaryenTypeInt32(), + "0")); { BinaryenIndex values[] = {0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, @@ -333,9 +341,11 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 6))), - BinaryenTypeInt32())); + BinaryenTypeInt32(), + "0")); } RelooperAddBranchForSwitch( @@ -343,48 +353,50 @@ int main() { b4, NULL, 0, - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 4))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 4))), + BinaryenTypeInt32(), + "0")); RelooperAddBranchForSwitch( b3, b6, NULL, 0, - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 5))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 5))), + BinaryenTypeInt32(), + "0")); RelooperAddBranch( b4, @@ -397,71 +409,74 @@ int main() { BinaryenLocalGet(module, 0, BinaryenTypeInt32()), BinaryenConst(module, BinaryenLiteralInt32(2))), BinaryenConst(module, BinaryenLiteralInt32(0))), - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 5))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 5))), + BinaryenTypeInt32(), + "0")); RelooperAddBranch( b4, b3, NULL, - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 3))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 3))), + BinaryenTypeInt32(), + "0")); RelooperAddBranchForSwitch( b5, b1, NULL, 0, - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 4))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 4))), + BinaryenTypeInt32(), + "0")); { BinaryenIndex values[] = {0, 3, 6, 9, 12, 15, 18, 21, 24, 27, @@ -488,9 +503,11 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 2))), - BinaryenTypeInt32())); + BinaryenTypeInt32(), + "0")); } { @@ -519,9 +536,11 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 3))), - BinaryenTypeInt32())); + BinaryenTypeInt32(), + "0")); } RelooperAddBranchForSwitch( @@ -529,24 +548,25 @@ int main() { b2, NULL, 0, - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 3))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 3))), + BinaryenTypeInt32(), + "0")); RelooperAddBranch( b7, @@ -559,70 +579,73 @@ int main() { BinaryenLocalGet(module, 0, BinaryenTypeInt32()), BinaryenConst(module, BinaryenLiteralInt32(2))), BinaryenConst(module, BinaryenLiteralInt32(0))), - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 1))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 1))), + BinaryenTypeInt32(), + "0")); RelooperAddBranch( b7, b1, NULL, - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 4))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 4))), + BinaryenTypeInt32(), + "0")); RelooperAddBranch( b8, b8, NULL, - BinaryenStore( - module, - 4, - 0, - 0, - BinaryenConst(module, BinaryenLiteralInt32(4)), - BinaryenBinary( - module, - BinaryenAddInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenConst(module, BinaryenLiteralInt32(4 * 2))), - BinaryenTypeInt32())); + BinaryenStore(module, + 4, + 0, + 0, + BinaryenConst(module, BinaryenLiteralInt32(4)), + BinaryenBinary( + module, + BinaryenAddInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + BinaryenConst(module, BinaryenLiteralInt32(4 * 2))), + BinaryenTypeInt32(), + "0")); BinaryenExpressionRef body = RelooperRenderAndDispose(relooper, b0, 1); @@ -644,7 +667,8 @@ int main() { 0, BinaryenConst(module, BinaryenLiteralInt32(8 + 4 * i)), BinaryenConst(module, BinaryenLiteralInt32(decisions[i])), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); } } full[numDecisions] = body; @@ -666,7 +690,7 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0); + BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, "0"); // optionally, optimize if (0) diff --git a/test/example/relooper-merge1.c b/test/example/relooper-merge1.c index 491839f36..f7939adc6 100644 --- a/test/example/relooper-merge1.c +++ b/test/example/relooper-merge1.c @@ -23,7 +23,8 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 12)) // jumps of 4 bytes ), BinaryenUnreachable(module), @@ -43,29 +44,32 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); // optionally, print the return value BinaryenExpressionRef args[] = {BinaryenBinary( module, BinaryenSubInt32(), BinaryenConst(module, BinaryenLiteralInt32(0)), - BinaryenLoad( - module, - 4, - 0, - 4, - 0, - BinaryenTypeInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))))}; + BinaryenLoad(module, + 4, + 0, + 4, + 0, + BinaryenTypeInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"))}; BinaryenExpressionRef debugger; if (1) debugger = BinaryenCall(module, "print", args, 1, BinaryenTypeNone()); @@ -87,7 +91,9 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))); + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"); BinaryenExpressionRef checkBodyList[] = {halter, incer, debugger, returner}; BinaryenExpressionRef checkBody = BinaryenBlock(module, @@ -226,7 +232,7 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0); + BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, "0"); // optionally, optimize if (0) diff --git a/test/example/relooper-merge2.c b/test/example/relooper-merge2.c index ed5fc0f4d..be8fba500 100644 --- a/test/example/relooper-merge2.c +++ b/test/example/relooper-merge2.c @@ -23,7 +23,8 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 12)) // jumps of 4 bytes ), BinaryenUnreachable(module), @@ -43,29 +44,32 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); // optionally, print the return value BinaryenExpressionRef args[] = {BinaryenBinary( module, BinaryenSubInt32(), BinaryenConst(module, BinaryenLiteralInt32(0)), - BinaryenLoad( - module, - 4, - 0, - 4, - 0, - BinaryenTypeInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))))}; + BinaryenLoad(module, + 4, + 0, + 4, + 0, + BinaryenTypeInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"))}; BinaryenExpressionRef debugger; if (1) debugger = BinaryenCall(module, "print", args, 1, BinaryenTypeNone()); @@ -87,7 +91,9 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))); + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"); BinaryenExpressionRef checkBodyList[] = {halter, incer, debugger, returner}; BinaryenExpressionRef checkBody = BinaryenBlock(module, @@ -241,7 +247,7 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0); + BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, "0"); // optionally, optimize if (0) diff --git a/test/example/relooper-merge3.c b/test/example/relooper-merge3.c index 655b4d22b..f1e3d8a54 100644 --- a/test/example/relooper-merge3.c +++ b/test/example/relooper-merge3.c @@ -23,7 +23,8 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 12)) // jumps of 4 bytes ), BinaryenUnreachable(module), @@ -43,29 +44,32 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); // optionally, print the return value BinaryenExpressionRef args[] = {BinaryenBinary( module, BinaryenSubInt32(), BinaryenConst(module, BinaryenLiteralInt32(0)), - BinaryenLoad( - module, - 4, - 0, - 4, - 0, - BinaryenTypeInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))))}; + BinaryenLoad(module, + 4, + 0, + 4, + 0, + BinaryenTypeInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"))}; BinaryenExpressionRef debugger; if (1) debugger = BinaryenCall(module, "print", args, 1, BinaryenTypeNone()); @@ -87,7 +91,9 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))); + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"); BinaryenExpressionRef checkBodyList[] = {halter, incer, debugger, returner}; BinaryenExpressionRef checkBody = BinaryenBlock(module, @@ -225,7 +231,7 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0); + BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, "0"); // optionally, optimize if (0) diff --git a/test/example/relooper-merge4.c b/test/example/relooper-merge4.c index 2e5624421..b379800dd 100644 --- a/test/example/relooper-merge4.c +++ b/test/example/relooper-merge4.c @@ -23,7 +23,8 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 12)) // jumps of 4 bytes ), BinaryenUnreachable(module), @@ -43,29 +44,32 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); // optionally, print the return value BinaryenExpressionRef args[] = {BinaryenBinary( module, BinaryenSubInt32(), BinaryenConst(module, BinaryenLiteralInt32(0)), - BinaryenLoad( - module, - 4, - 0, - 4, - 0, - BinaryenTypeInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))))}; + BinaryenLoad(module, + 4, + 0, + 4, + 0, + BinaryenTypeInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"))}; BinaryenExpressionRef debugger; if (1) debugger = BinaryenCall(module, "print", args, 1, BinaryenTypeNone()); @@ -87,7 +91,9 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))); + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"); BinaryenExpressionRef checkBodyList[] = {halter, incer, debugger, returner}; BinaryenExpressionRef checkBody = BinaryenBlock(module, @@ -225,7 +231,7 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0); + BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, "0"); // optionally, optimize if (0) diff --git a/test/example/relooper-merge5.c b/test/example/relooper-merge5.c index 41a36c102..d678a630e 100644 --- a/test/example/relooper-merge5.c +++ b/test/example/relooper-merge5.c @@ -23,7 +23,8 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 12)) // jumps of 4 bytes ), BinaryenUnreachable(module), @@ -43,29 +44,32 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); // optionally, print the return value BinaryenExpressionRef args[] = {BinaryenBinary( module, BinaryenSubInt32(), BinaryenConst(module, BinaryenLiteralInt32(0)), - BinaryenLoad( - module, - 4, - 0, - 4, - 0, - BinaryenTypeInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))))}; + BinaryenLoad(module, + 4, + 0, + 4, + 0, + BinaryenTypeInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"))}; BinaryenExpressionRef debugger; if (1) debugger = BinaryenCall(module, "print", args, 1, BinaryenTypeNone()); @@ -87,7 +91,9 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))); + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"); BinaryenExpressionRef checkBodyList[] = {halter, incer, debugger, returner}; BinaryenExpressionRef checkBody = BinaryenBlock(module, @@ -225,7 +231,7 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0); + BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, "0"); // optionally, optimize if (0) diff --git a/test/example/relooper-merge6.c b/test/example/relooper-merge6.c index 23e639cb1..9d9d33361 100644 --- a/test/example/relooper-merge6.c +++ b/test/example/relooper-merge6.c @@ -23,7 +23,8 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4 * 12)) // jumps of 4 bytes ), BinaryenUnreachable(module), @@ -43,29 +44,32 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4))), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), BinaryenConst(module, BinaryenLiteralInt32(4))), - BinaryenTypeInt32()); + BinaryenTypeInt32(), + "0"); // optionally, print the return value BinaryenExpressionRef args[] = {BinaryenBinary( module, BinaryenSubInt32(), BinaryenConst(module, BinaryenLiteralInt32(0)), - BinaryenLoad( - module, - 4, - 0, - 4, - 0, - BinaryenTypeInt32(), - BinaryenLoad(module, - 4, - 0, - 0, - 0, - BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))))}; + BinaryenLoad(module, + 4, + 0, + 4, + 0, + BinaryenTypeInt32(), + BinaryenLoad(module, + 4, + 0, + 0, + 0, + BinaryenTypeInt32(), + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"))}; BinaryenExpressionRef debugger; if (1) debugger = BinaryenCall(module, "print", args, 1, BinaryenTypeNone()); @@ -87,7 +91,9 @@ int main() { 0, 0, BinaryenTypeInt32(), - BinaryenConst(module, BinaryenLiteralInt32(4)))); + BinaryenConst(module, BinaryenLiteralInt32(4)), + "0"), + "0"); BinaryenExpressionRef checkBodyList[] = {halter, incer, debugger, returner}; BinaryenExpressionRef checkBody = BinaryenBlock(module, @@ -228,7 +234,7 @@ int main() { BinaryenTypeNone()); // memory - BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0); + BinaryenSetMemory(module, 1, 1, "mem", NULL, NULL, NULL, NULL, 0, 0, "0"); // optionally, optimize if (0) |