summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/binaryen.js/kitchen-sink.js9
-rw-r--r--test/binaryen.js/kitchen-sink.js.txt253
-rw-r--r--test/bulk-memory.wast29
-rw-r--r--test/bulk-memory.wast.from-wast29
-rw-r--r--test/bulk-memory.wast.fromBinary30
-rw-r--r--test/bulk-memory.wast.fromBinary.noDebugInfo30
-rw-r--r--test/example/c-api-kitchen-sink.c30
-rw-r--r--test/example/c-api-kitchen-sink.txt185
-rw-r--r--test/example/c-api-kitchen-sink.txt.txt16
-rw-r--r--test/lld/em_asm.wast.mem.mem (renamed from test/lld/hello_world.wast.mem)bin581 -> 652 bytes
-rw-r--r--test/lld/em_asm.wast.mem.out117
11 files changed, 556 insertions, 172 deletions
diff --git a/test/binaryen.js/kitchen-sink.js b/test/binaryen.js/kitchen-sink.js
index 27eba3a8c..c5c919035 100644
--- a/test/binaryen.js/kitchen-sink.js
+++ b/test/binaryen.js/kitchen-sink.js
@@ -94,6 +94,10 @@ function test_ids() {
console.log("BinaryenSIMDShuffleId: " + Binaryen.SIMDShuffleId);
console.log("BinaryenSIMDBitselectId: " + Binaryen.SIMDBitselectId);
console.log("BinaryenSIMDShiftId: " + Binaryen.SIMDShiftId);
+ console.log("MemoryInitId: " + Binaryen.MemoryInitId);
+ console.log("DataDropId: " + Binaryen.DataDropId);
+ console.log("MemoryCopyId: " + Binaryen.MemoryCopyId);
+ console.log("MemoryFillId: " + Binaryen.MemoryFillId);
}
function test_core() {
@@ -340,6 +344,11 @@ function test_core() {
// Other SIMD
module.v8x16.shuffle(module.v128.const(v128_bytes), module.v128.const(v128_bytes), v128_bytes),
module.v128.bitselect(module.v128.const(v128_bytes), module.v128.const(v128_bytes), module.v128.const(v128_bytes)),
+ // Bulk memory
+ module.memory.init(0, makeInt32(1024), makeInt32(0), makeInt32(12)),
+ module.data.drop(0),
+ module.memory.copy(makeInt32(2048), makeInt32(1024), makeInt32(12)),
+ module.memory.fill(makeInt32(0), makeInt32(42), makeInt32(1024)),
// All the rest
module.block('', []), // block with no name
module.if(temp1, temp2, temp3),
diff --git a/test/binaryen.js/kitchen-sink.js.txt b/test/binaryen.js/kitchen-sink.js.txt
index 69b971b9c..9ecfcce49 100644
--- a/test/binaryen.js/kitchen-sink.js.txt
+++ b/test/binaryen.js/kitchen-sink.js.txt
@@ -38,6 +38,10 @@ BinaryenSIMDReplaceId: 28
BinaryenSIMDShuffleId: 29
BinaryenSIMDBitselectId: 30
BinaryenSIMDShiftId: 31
+MemoryInitId: 32
+DataDropId: 33
+MemoryCopyId: 34
+MemoryFillId: 35
getExpressionInfo={"id":15,"type":3,"op":6}
(f32.neg
(f32.const -33.61199951171875)
@@ -1251,6 +1255,22 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5}
(v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10)
)
)
+ (memory.init 0
+ (i32.const 1024)
+ (i32.const 0)
+ (i32.const 12)
+ )
+ (data.drop 0)
+ (memory.copy
+ (i32.const 2048)
+ (i32.const 1024)
+ (i32.const 12)
+ )
+ (memory.fill
+ (i32.const 0)
+ (i32.const 42)
+ (i32.const 1024)
+ )
(block
)
(if
@@ -3129,80 +3149,93 @@ int main() {
expressions[576] = BinaryenConst(the_module, BinaryenLiteralVec128(t209));
}
expressions[577] = BinaryenSIMDBitselect(the_module, expressions[574], expressions[575], expressions[576]);
+ expressions[578] = BinaryenConst(the_module, BinaryenLiteralInt32(1024));
+ expressions[579] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
+ expressions[580] = BinaryenConst(the_module, BinaryenLiteralInt32(12));
+ expressions[581] = BinaryenMemoryInit(the_module, 0, expressions[578], expressions[579], expressions[580]);
+ expressions[582] = BinaryenDataDrop(the_module, 0);
+ expressions[583] = BinaryenConst(the_module, BinaryenLiteralInt32(2048));
+ expressions[584] = BinaryenConst(the_module, BinaryenLiteralInt32(1024));
+ expressions[585] = BinaryenConst(the_module, BinaryenLiteralInt32(12));
+ expressions[586] = BinaryenMemoryCopy(the_module, expressions[583], expressions[584], expressions[585]);
+ expressions[587] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
+ expressions[588] = BinaryenConst(the_module, BinaryenLiteralInt32(42));
+ expressions[589] = BinaryenConst(the_module, BinaryenLiteralInt32(1024));
+ expressions[590] = BinaryenMemoryFill(the_module, expressions[587], expressions[588], expressions[589]);
{
BinaryenExpressionRef children[] = { 0 };
- expressions[578] = BinaryenBlock(the_module, NULL, children, 0, 0);
- }
- expressions[579] = BinaryenIf(the_module, expressions[7], expressions[8], expressions[9]);
- expressions[580] = BinaryenIf(the_module, expressions[10], expressions[11], expressions[0]);
- expressions[581] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
- expressions[582] = BinaryenLoop(the_module, "in", expressions[581]);
- expressions[583] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
- expressions[584] = BinaryenLoop(the_module, NULL, expressions[583]);
- expressions[585] = BinaryenBreak(the_module, "the-value", expressions[12], expressions[13]);
- expressions[586] = BinaryenConst(the_module, BinaryenLiteralInt32(2));
- expressions[587] = BinaryenBreak(the_module, "the-nothing", expressions[586], expressions[0]);
- expressions[588] = BinaryenConst(the_module, BinaryenLiteralInt32(3));
- expressions[589] = BinaryenBreak(the_module, "the-value", expressions[0], expressions[588]);
- expressions[590] = BinaryenBreak(the_module, "the-nothing", expressions[0], expressions[0]);
+ expressions[591] = BinaryenBlock(the_module, NULL, children, 0, 0);
+ }
+ expressions[592] = BinaryenIf(the_module, expressions[7], expressions[8], expressions[9]);
+ expressions[593] = BinaryenIf(the_module, expressions[10], expressions[11], expressions[0]);
+ expressions[594] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
+ expressions[595] = BinaryenLoop(the_module, "in", expressions[594]);
+ expressions[596] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
+ expressions[597] = BinaryenLoop(the_module, NULL, expressions[596]);
+ expressions[598] = BinaryenBreak(the_module, "the-value", expressions[12], expressions[13]);
+ expressions[599] = BinaryenConst(the_module, BinaryenLiteralInt32(2));
+ expressions[600] = BinaryenBreak(the_module, "the-nothing", expressions[599], expressions[0]);
+ expressions[601] = BinaryenConst(the_module, BinaryenLiteralInt32(3));
+ expressions[602] = BinaryenBreak(the_module, "the-value", expressions[0], expressions[601]);
+ expressions[603] = BinaryenBreak(the_module, "the-nothing", expressions[0], expressions[0]);
{
const char* names[] = { "the-value" };
- expressions[591] = BinaryenSwitch(the_module, names, 1, "the-value", expressions[14], expressions[15]);
+ expressions[604] = BinaryenSwitch(the_module, names, 1, "the-value", expressions[14], expressions[15]);
}
- expressions[592] = BinaryenConst(the_module, BinaryenLiteralInt32(2));
+ expressions[605] = BinaryenConst(the_module, BinaryenLiteralInt32(2));
{
const char* names[] = { "the-nothing" };
- expressions[593] = BinaryenSwitch(the_module, names, 1, "the-nothing", expressions[592], expressions[0]);
- }
- expressions[594] = BinaryenConst(the_module, BinaryenLiteralInt32(13));
- expressions[595] = BinaryenConst(the_module, BinaryenLiteralInt64(37));
- expressions[596] = BinaryenConst(the_module, BinaryenLiteralFloat32(1.3));
- expressions[597] = BinaryenConst(the_module, BinaryenLiteralFloat64(3.7));
- {
- BinaryenExpressionRef operands[] = { expressions[594], expressions[595], expressions[596], expressions[597] };
- expressions[598] = BinaryenCall(the_module, "kitchen()sinker", operands, 4, 1);
- }
- expressions[599] = BinaryenUnary(the_module, 20, expressions[598]);
- expressions[600] = BinaryenConst(the_module, BinaryenLiteralInt32(13));
- expressions[601] = BinaryenConst(the_module, BinaryenLiteralFloat64(3.7));
- {
- BinaryenExpressionRef operands[] = { expressions[600], expressions[601] };
- expressions[602] = BinaryenCall(the_module, "an-imported", operands, 2, 3);
- }
- expressions[603] = BinaryenUnary(the_module, 25, expressions[602]);
- expressions[604] = BinaryenUnary(the_module, 20, expressions[603]);
- expressions[605] = BinaryenConst(the_module, BinaryenLiteralInt32(2449));
- expressions[606] = BinaryenConst(the_module, BinaryenLiteralInt32(13));
- expressions[607] = BinaryenConst(the_module, BinaryenLiteralInt64(37));
- expressions[608] = BinaryenConst(the_module, BinaryenLiteralFloat32(1.3));
- expressions[609] = BinaryenConst(the_module, BinaryenLiteralFloat64(3.7));
- {
- BinaryenExpressionRef operands[] = { expressions[606], expressions[607], expressions[608], expressions[609] };
- expressions[610] = BinaryenCallIndirect(the_module, expressions[605], operands, 4, "iiIfF");
- }
- expressions[611] = BinaryenUnary(the_module, 20, expressions[610]);
- expressions[612] = BinaryenGetLocal(the_module, 0, 1);
- expressions[613] = BinaryenDrop(the_module, expressions[612]);
- expressions[614] = BinaryenConst(the_module, BinaryenLiteralInt32(101));
- expressions[615] = BinaryenSetLocal(the_module, 0, expressions[614]);
- expressions[616] = BinaryenConst(the_module, BinaryenLiteralInt32(102));
- expressions[617] = BinaryenTeeLocal(the_module, 0, expressions[616]);
- expressions[618] = BinaryenDrop(the_module, expressions[617]);
- expressions[619] = BinaryenConst(the_module, BinaryenLiteralInt32(1));
- expressions[620] = BinaryenLoad(the_module, 4, 1, 0, 0, 1, expressions[619]);
- expressions[621] = BinaryenConst(the_module, BinaryenLiteralInt32(8));
- expressions[622] = BinaryenLoad(the_module, 2, 1, 2, 1, 2, expressions[621]);
- expressions[623] = BinaryenConst(the_module, BinaryenLiteralInt32(2));
- expressions[624] = BinaryenLoad(the_module, 4, 1, 0, 0, 3, expressions[623]);
- expressions[625] = BinaryenConst(the_module, BinaryenLiteralInt32(9));
- expressions[626] = BinaryenLoad(the_module, 8, 1, 2, 8, 4, expressions[625]);
- expressions[627] = BinaryenStore(the_module, 4, 0, 0, expressions[19], expressions[20], 1);
- expressions[628] = BinaryenStore(the_module, 8, 2, 4, expressions[21], expressions[22], 2);
- expressions[629] = BinaryenSelect(the_module, expressions[16], expressions[17], expressions[18]);
- expressions[630] = BinaryenConst(the_module, BinaryenLiteralInt32(1337));
- expressions[631] = BinaryenReturn(the_module, expressions[630]);
- expressions[632] = BinaryenNop(the_module);
- expressions[633] = BinaryenUnreachable(the_module);
+ expressions[606] = BinaryenSwitch(the_module, names, 1, "the-nothing", expressions[605], expressions[0]);
+ }
+ expressions[607] = BinaryenConst(the_module, BinaryenLiteralInt32(13));
+ expressions[608] = BinaryenConst(the_module, BinaryenLiteralInt64(37));
+ expressions[609] = BinaryenConst(the_module, BinaryenLiteralFloat32(1.3));
+ expressions[610] = BinaryenConst(the_module, BinaryenLiteralFloat64(3.7));
+ {
+ BinaryenExpressionRef operands[] = { expressions[607], expressions[608], expressions[609], expressions[610] };
+ expressions[611] = BinaryenCall(the_module, "kitchen()sinker", operands, 4, 1);
+ }
+ expressions[612] = BinaryenUnary(the_module, 20, expressions[611]);
+ expressions[613] = BinaryenConst(the_module, BinaryenLiteralInt32(13));
+ expressions[614] = BinaryenConst(the_module, BinaryenLiteralFloat64(3.7));
+ {
+ BinaryenExpressionRef operands[] = { expressions[613], expressions[614] };
+ expressions[615] = BinaryenCall(the_module, "an-imported", operands, 2, 3);
+ }
+ expressions[616] = BinaryenUnary(the_module, 25, expressions[615]);
+ expressions[617] = BinaryenUnary(the_module, 20, expressions[616]);
+ expressions[618] = BinaryenConst(the_module, BinaryenLiteralInt32(2449));
+ expressions[619] = BinaryenConst(the_module, BinaryenLiteralInt32(13));
+ expressions[620] = BinaryenConst(the_module, BinaryenLiteralInt64(37));
+ expressions[621] = BinaryenConst(the_module, BinaryenLiteralFloat32(1.3));
+ expressions[622] = BinaryenConst(the_module, BinaryenLiteralFloat64(3.7));
+ {
+ BinaryenExpressionRef operands[] = { expressions[619], expressions[620], expressions[621], expressions[622] };
+ expressions[623] = BinaryenCallIndirect(the_module, expressions[618], operands, 4, "iiIfF");
+ }
+ expressions[624] = BinaryenUnary(the_module, 20, expressions[623]);
+ expressions[625] = BinaryenGetLocal(the_module, 0, 1);
+ expressions[626] = BinaryenDrop(the_module, expressions[625]);
+ expressions[627] = BinaryenConst(the_module, BinaryenLiteralInt32(101));
+ expressions[628] = BinaryenSetLocal(the_module, 0, expressions[627]);
+ expressions[629] = BinaryenConst(the_module, BinaryenLiteralInt32(102));
+ expressions[630] = BinaryenTeeLocal(the_module, 0, expressions[629]);
+ expressions[631] = BinaryenDrop(the_module, expressions[630]);
+ expressions[632] = BinaryenConst(the_module, BinaryenLiteralInt32(1));
+ expressions[633] = BinaryenLoad(the_module, 4, 1, 0, 0, 1, expressions[632]);
+ expressions[634] = BinaryenConst(the_module, BinaryenLiteralInt32(8));
+ expressions[635] = BinaryenLoad(the_module, 2, 1, 2, 1, 2, expressions[634]);
+ expressions[636] = BinaryenConst(the_module, BinaryenLiteralInt32(2));
+ expressions[637] = BinaryenLoad(the_module, 4, 1, 0, 0, 3, expressions[636]);
+ expressions[638] = BinaryenConst(the_module, BinaryenLiteralInt32(9));
+ expressions[639] = BinaryenLoad(the_module, 8, 1, 2, 8, 4, expressions[638]);
+ expressions[640] = BinaryenStore(the_module, 4, 0, 0, expressions[19], expressions[20], 1);
+ expressions[641] = BinaryenStore(the_module, 8, 2, 4, expressions[21], expressions[22], 2);
+ expressions[642] = BinaryenSelect(the_module, expressions[16], expressions[17], expressions[18]);
+ expressions[643] = BinaryenConst(the_module, BinaryenLiteralInt32(1337));
+ expressions[644] = BinaryenReturn(the_module, expressions[643]);
+ expressions[645] = BinaryenNop(the_module);
+ expressions[646] = BinaryenUnreachable(the_module);
BinaryenExpressionGetId(expressions[30]);
BinaryenExpressionGetType(expressions[30]);
BinaryenUnaryGetOp(expressions[30]);
@@ -3213,26 +3246,26 @@ getExpressionInfo={"id":15,"type":3,"op":6}
(f32.const -33.61199951171875)
)
- expressions[634] = BinaryenConst(the_module, BinaryenLiteralInt32(5));
- BinaryenExpressionGetId(expressions[634]);
- BinaryenExpressionGetType(expressions[634]);
- BinaryenConstGetValueI32(expressions[634]);
+ expressions[647] = BinaryenConst(the_module, BinaryenLiteralInt32(5));
+ BinaryenExpressionGetId(expressions[647]);
+ BinaryenExpressionGetType(expressions[647]);
+ BinaryenConstGetValueI32(expressions[647]);
getExpressionInfo(i32.const)={"id":14,"type":1,"value":5}
- expressions[635] = BinaryenConst(the_module, BinaryenLiteralInt64(30064771078));
- BinaryenExpressionGetId(expressions[635]);
- BinaryenExpressionGetType(expressions[635]);
- BinaryenConstGetValueI64Low(expressions[635]);
- BinaryenConstGetValueI64High(expressions[635]);
+ expressions[648] = BinaryenConst(the_module, BinaryenLiteralInt64(30064771078));
+ BinaryenExpressionGetId(expressions[648]);
+ BinaryenExpressionGetType(expressions[648]);
+ BinaryenConstGetValueI64Low(expressions[648]);
+ BinaryenConstGetValueI64High(expressions[648]);
getExpressionInfo(i64.const)={"id":14,"type":2,"value":{"low":6,"high":7}}
- expressions[636] = BinaryenConst(the_module, BinaryenLiteralFloat32(8.5));
- BinaryenExpressionGetId(expressions[636]);
- BinaryenExpressionGetType(expressions[636]);
- BinaryenConstGetValueF32(expressions[636]);
+ expressions[649] = BinaryenConst(the_module, BinaryenLiteralFloat32(8.5));
+ BinaryenExpressionGetId(expressions[649]);
+ BinaryenExpressionGetType(expressions[649]);
+ BinaryenConstGetValueF32(expressions[649]);
getExpressionInfo(f32.const)={"id":14,"type":3,"value":8.5}
- expressions[637] = BinaryenConst(the_module, BinaryenLiteralFloat64(9.5));
- BinaryenExpressionGetId(expressions[637]);
- BinaryenExpressionGetType(expressions[637]);
- BinaryenConstGetValueF64(expressions[637]);
+ expressions[650] = BinaryenConst(the_module, BinaryenLiteralFloat64(9.5));
+ BinaryenExpressionGetId(expressions[650]);
+ BinaryenExpressionGetType(expressions[650]);
+ BinaryenConstGetValueF64(expressions[650]);
getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5}
{
BinaryenExpressionRef children[] = { expressions[24], expressions[26], expressions[28], expressions[30], expressions[32],
@@ -3270,27 +3303,27 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5}
expressions[514], expressions[516], expressions[519], expressions[522], expressions[525], expressions[528],
expressions[531], expressions[534], expressions[537], expressions[540], expressions[543], expressions[546],
expressions[549], expressions[552], expressions[555], expressions[558], expressions[561], expressions[564],
- expressions[567], expressions[570], expressions[573], expressions[577], expressions[578], expressions[579],
- expressions[580], expressions[582], expressions[584], expressions[585], expressions[587], expressions[589],
- expressions[590], expressions[591], expressions[593], expressions[599], expressions[604], expressions[611],
- expressions[613], expressions[615], expressions[618], expressions[620], expressions[622], expressions[624],
- expressions[626], expressions[627], expressions[628], expressions[629], expressions[631], expressions[632],
- expressions[633] };
- expressions[638] = BinaryenBlock(the_module, "the-value", children, 240, 0);
+ expressions[567], expressions[570], expressions[573], expressions[577], expressions[581], expressions[582],
+ expressions[586], expressions[590], expressions[591], expressions[592], expressions[593], expressions[595],
+ expressions[597], expressions[598], expressions[600], expressions[602], expressions[603], expressions[604],
+ 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[645], expressions[646] };
+ expressions[651] = BinaryenBlock(the_module, "the-value", children, 244, 0);
}
- expressions[639] = BinaryenDrop(the_module, expressions[638]);
+ expressions[652] = BinaryenDrop(the_module, expressions[651]);
{
- BinaryenExpressionRef children[] = { expressions[639] };
- expressions[640] = BinaryenBlock(the_module, "the-nothing", children, 1, 0);
+ BinaryenExpressionRef children[] = { expressions[652] };
+ expressions[653] = BinaryenBlock(the_module, "the-nothing", children, 1, 0);
}
- expressions[641] = BinaryenConst(the_module, BinaryenLiteralInt32(42));
+ expressions[654] = BinaryenConst(the_module, BinaryenLiteralInt32(42));
{
- BinaryenExpressionRef children[] = { expressions[640], expressions[641] };
- expressions[642] = BinaryenBlock(the_module, "the-body", children, 2, 0);
+ BinaryenExpressionRef children[] = { expressions[653], expressions[654] };
+ expressions[655] = BinaryenBlock(the_module, "the-body", children, 2, 0);
}
{
BinaryenType varTypes[] = { 1 };
- functions[0] = BinaryenAddFunction(the_module, "kitchen()sinker", functionTypes[0], varTypes, 1, expressions[642]);
+ functions[0] = BinaryenAddFunction(the_module, "kitchen()sinker", functionTypes[0], varTypes, 1, expressions[655]);
}
{
BinaryenType paramTypes[] = { 1, 4 };
@@ -3315,11 +3348,11 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5}
const char* funcNames[] = { "kitchen()sinker" };
BinaryenSetFunctionTable(the_module, 1, 4294967295, funcNames, 1);
}
- expressions[643] = BinaryenConst(the_module, BinaryenLiteralInt32(10));
+ expressions[656] = BinaryenConst(the_module, BinaryenLiteralInt32(10));
{
const char segment0[] = { 104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100 };
const char* segments[] = { segment0 };
- BinaryenExpressionRef segmentOffsets[] = { expressions[643] };
+ BinaryenExpressionRef segmentOffsets[] = { expressions[656] };
BinaryenIndex segmentSizes[] = { 12 };
BinaryenSetMemory(the_module, 1, 256, "mem", segments, segmentOffsets, segmentSizes, 1, 0);
}
@@ -3327,10 +3360,10 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5}
BinaryenType paramTypes[] = { 0 };
functionTypes[2] = BinaryenAddFunctionType(the_module, "v", 0, paramTypes, 0);
}
- expressions[644] = BinaryenNop(the_module);
+ expressions[657] = BinaryenNop(the_module);
{
BinaryenType varTypes[] = { 0 };
- functions[1] = BinaryenAddFunction(the_module, "starter", functionTypes[2], varTypes, 0, expressions[644]);
+ functions[1] = BinaryenAddFunction(the_module, "starter", functionTypes[2], varTypes, 0, expressions[657]);
}
BinaryenSetStart(the_module, functions[1]);
{
@@ -4544,6 +4577,22 @@ getExpressionInfo(f64.const)={"id":14,"type":4,"value":9.5}
(v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10)
)
)
+ (memory.init 0
+ (i32.const 1024)
+ (i32.const 0)
+ (i32.const 12)
+ )
+ (data.drop 0)
+ (memory.copy
+ (i32.const 2048)
+ (i32.const 1024)
+ (i32.const 12)
+ )
+ (memory.fill
+ (i32.const 0)
+ (i32.const 42)
+ (i32.const 1024)
+ )
(block
)
(if
diff --git a/test/bulk-memory.wast b/test/bulk-memory.wast
new file mode 100644
index 000000000..91f8c23a2
--- /dev/null
+++ b/test/bulk-memory.wast
@@ -0,0 +1,29 @@
+(module
+ (memory 1024 1024
+ (segment 0 "hello, world")
+ )
+ (func $memory.init
+ (memory.init 0
+ (i32.const 512)
+ (i32.const 0)
+ (i32.const 12)
+ )
+ )
+ (func $data.drop
+ (data.drop 0)
+ )
+ (func $memory.copy
+ (memory.copy
+ (i32.const 512)
+ (i32.const 0)
+ (i32.const 12)
+ )
+ )
+ (func $memory.fill
+ (memory.fill
+ (i32.const 0)
+ (i32.const 42)
+ (i32.const 1024)
+ )
+ )
+)
diff --git a/test/bulk-memory.wast.from-wast b/test/bulk-memory.wast.from-wast
new file mode 100644
index 000000000..0f4ec70fa
--- /dev/null
+++ b/test/bulk-memory.wast.from-wast
@@ -0,0 +1,29 @@
+(module
+ (type $0 (func))
+ (memory $0 1024 1024)
+ (data (i32.const 0) "hello, world")
+ (func $memory.init (; 0 ;) (type $0)
+ (memory.init 0
+ (i32.const 512)
+ (i32.const 0)
+ (i32.const 12)
+ )
+ )
+ (func $data.drop (; 1 ;) (type $0)
+ (data.drop 0)
+ )
+ (func $memory.copy (; 2 ;) (type $0)
+ (memory.copy
+ (i32.const 512)
+ (i32.const 0)
+ (i32.const 12)
+ )
+ )
+ (func $memory.fill (; 3 ;) (type $0)
+ (memory.fill
+ (i32.const 0)
+ (i32.const 42)
+ (i32.const 1024)
+ )
+ )
+)
diff --git a/test/bulk-memory.wast.fromBinary b/test/bulk-memory.wast.fromBinary
new file mode 100644
index 000000000..0659c0184
--- /dev/null
+++ b/test/bulk-memory.wast.fromBinary
@@ -0,0 +1,30 @@
+(module
+ (type $0 (func))
+ (memory $0 1024 1024)
+ (data (i32.const 0) "hello, world")
+ (func $memory.init (; 0 ;) (type $0)
+ (memory.init 0
+ (i32.const 512)
+ (i32.const 0)
+ (i32.const 12)
+ )
+ )
+ (func $data.drop (; 1 ;) (type $0)
+ (data.drop 0)
+ )
+ (func $memory.copy (; 2 ;) (type $0)
+ (memory.copy
+ (i32.const 512)
+ (i32.const 0)
+ (i32.const 12)
+ )
+ )
+ (func $memory.fill (; 3 ;) (type $0)
+ (memory.fill
+ (i32.const 0)
+ (i32.const 42)
+ (i32.const 1024)
+ )
+ )
+)
+
diff --git a/test/bulk-memory.wast.fromBinary.noDebugInfo b/test/bulk-memory.wast.fromBinary.noDebugInfo
new file mode 100644
index 000000000..69d8db333
--- /dev/null
+++ b/test/bulk-memory.wast.fromBinary.noDebugInfo
@@ -0,0 +1,30 @@
+(module
+ (type $0 (func))
+ (memory $0 1024 1024)
+ (data (i32.const 0) "hello, world")
+ (func $0 (; 0 ;) (type $0)
+ (memory.init 0
+ (i32.const 512)
+ (i32.const 0)
+ (i32.const 12)
+ )
+ )
+ (func $1 (; 1 ;) (type $0)
+ (data.drop 0)
+ )
+ (func $2 (; 2 ;) (type $0)
+ (memory.copy
+ (i32.const 512)
+ (i32.const 0)
+ (i32.const 12)
+ )
+ )
+ (func $3 (; 3 ;) (type $0)
+ (memory.fill
+ (i32.const 0)
+ (i32.const 42)
+ (i32.const 1024)
+ )
+ )
+)
+
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c
index cf2ce6c04..244ecc9b5 100644
--- a/test/example/c-api-kitchen-sink.c
+++ b/test/example/c-api-kitchen-sink.c
@@ -121,6 +121,31 @@ BinaryenExpressionRef makeSIMDShift(BinaryenModuleRef module, BinaryenOp op) {
return BinaryenSIMDShift(module, op, vec, makeInt32(module, 1));
}
+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);
+};
+
+BinaryenExpressionRef makeDataDrop(BinaryenModuleRef module) {
+ return BinaryenDataDrop(module, 0);
+};
+
+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);
+};
+
+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);
+};
+
// tests
void test_types() {
@@ -387,6 +412,11 @@ void test_core() {
// Other SIMD
makeSIMDShuffle(module),
makeSIMDBitselect(module),
+ // Bulk memory
+ makeMemoryInit(module),
+ makeDataDrop(module),
+ makeMemoryCopy(module),
+ makeMemoryFill(module),
// All the rest
BinaryenBlock(module, NULL, NULL, 0, -1), // block with no name and no type
BinaryenIf(module, temp1, temp2, temp3),
diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt
index 797d4e5e1..beb4e8f6f 100644
--- a/test/example/c-api-kitchen-sink.txt
+++ b/test/example/c-api-kitchen-sink.txt
@@ -1224,6 +1224,22 @@ BinaryenTypeAuto: -1
(v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10)
)
)
+ (memory.init 0
+ (i32.const 1024)
+ (i32.const 0)
+ (i32.const 12)
+ )
+ (data.drop 0)
+ (memory.copy
+ (i32.const 2048)
+ (i32.const 1024)
+ (i32.const 12)
+ )
+ (memory.fill
+ (i32.const 0)
+ (i32.const 42)
+ (i32.const 1024)
+ )
(block
)
(if
@@ -3115,70 +3131,83 @@ int main() {
expressions[587] = BinaryenConst(the_module, BinaryenLiteralVec128(t210));
}
expressions[588] = BinaryenSIMDBitselect(the_module, expressions[585], expressions[586], expressions[587]);
+ expressions[589] = BinaryenConst(the_module, BinaryenLiteralInt32(1024));
+ expressions[590] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
+ expressions[591] = BinaryenConst(the_module, BinaryenLiteralInt32(12));
+ expressions[592] = BinaryenMemoryInit(the_module, 0, expressions[589], expressions[590], expressions[591]);
+ expressions[593] = BinaryenDataDrop(the_module, 0);
+ expressions[594] = BinaryenConst(the_module, BinaryenLiteralInt32(2048));
+ expressions[595] = BinaryenConst(the_module, BinaryenLiteralInt32(1024));
+ expressions[596] = BinaryenConst(the_module, BinaryenLiteralInt32(12));
+ expressions[597] = BinaryenMemoryCopy(the_module, expressions[594], expressions[595], expressions[596]);
+ expressions[598] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
+ expressions[599] = BinaryenConst(the_module, BinaryenLiteralInt32(42));
+ expressions[600] = BinaryenConst(the_module, BinaryenLiteralInt32(1024));
+ expressions[601] = BinaryenMemoryFill(the_module, expressions[598], expressions[599], expressions[600]);
{
BinaryenExpressionRef children[] = { 0 };
- expressions[589] = BinaryenBlock(the_module, NULL, children, 0, BinaryenTypeAuto());
- }
- expressions[590] = BinaryenIf(the_module, expressions[18], expressions[19], expressions[20]);
- expressions[591] = BinaryenIf(the_module, expressions[21], expressions[22], expressions[0]);
- expressions[592] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
- expressions[593] = BinaryenLoop(the_module, "in", expressions[592]);
- expressions[594] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
- expressions[595] = BinaryenLoop(the_module, NULL, expressions[594]);
- expressions[596] = BinaryenBreak(the_module, "the-value", expressions[23], expressions[24]);
- expressions[597] = BinaryenConst(the_module, BinaryenLiteralInt32(2));
- expressions[598] = BinaryenBreak(the_module, "the-nothing", expressions[597], expressions[0]);
- expressions[599] = BinaryenConst(the_module, BinaryenLiteralInt32(3));
- expressions[600] = BinaryenBreak(the_module, "the-value", expressions[0], expressions[599]);
- expressions[601] = BinaryenBreak(the_module, "the-nothing", expressions[0], expressions[0]);
+ expressions[602] = BinaryenBlock(the_module, NULL, children, 0, BinaryenTypeAuto());
+ }
+ expressions[603] = BinaryenIf(the_module, expressions[18], expressions[19], expressions[20]);
+ expressions[604] = BinaryenIf(the_module, expressions[21], expressions[22], expressions[0]);
+ expressions[605] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
+ expressions[606] = BinaryenLoop(the_module, "in", expressions[605]);
+ expressions[607] = BinaryenConst(the_module, BinaryenLiteralInt32(0));
+ expressions[608] = BinaryenLoop(the_module, NULL, expressions[607]);
+ expressions[609] = BinaryenBreak(the_module, "the-value", expressions[23], expressions[24]);
+ expressions[610] = BinaryenConst(the_module, BinaryenLiteralInt32(2));
+ expressions[611] = BinaryenBreak(the_module, "the-nothing", expressions[610], expressions[0]);
+ expressions[612] = BinaryenConst(the_module, BinaryenLiteralInt32(3));
+ expressions[613] = BinaryenBreak(the_module, "the-value", expressions[0], expressions[612]);
+ expressions[614] = BinaryenBreak(the_module, "the-nothing", expressions[0], expressions[0]);
{
const char* names[] = { "the-value" };
- expressions[602] = BinaryenSwitch(the_module, names, 1, "the-value", expressions[25], expressions[26]);
+ expressions[615] = BinaryenSwitch(the_module, names, 1, "the-value", expressions[25], expressions[26]);
}
- expressions[603] = BinaryenConst(the_module, BinaryenLiteralInt32(2));
+ expressions[616] = BinaryenConst(the_module, BinaryenLiteralInt32(2));
{
const char* names[] = { "the-nothing" };
- expressions[604] = BinaryenSwitch(the_module, names, 1, "the-nothing", expressions[603], expressions[0]);
+ expressions[617] = BinaryenSwitch(the_module, names, 1, "the-nothing", expressions[616], expressions[0]);
}
{
BinaryenExpressionRef operands[] = { expressions[10], expressions[11], expressions[12], expressions[13] };
- expressions[605] = BinaryenCall(the_module, "kitchen()sinker", operands, 4, 1);
+ expressions[618] = BinaryenCall(the_module, "kitchen()sinker", operands, 4, 1);
}
- expressions[606] = BinaryenUnary(the_module, 20, expressions[605]);
+ expressions[619] = BinaryenUnary(the_module, 20, expressions[618]);
{
BinaryenExpressionRef operands[] = { expressions[8], expressions[9] };
- expressions[607] = BinaryenCall(the_module, "an-imported", operands, 2, 3);
+ expressions[620] = BinaryenCall(the_module, "an-imported", operands, 2, 3);
}
- expressions[608] = BinaryenUnary(the_module, 25, expressions[607]);
- expressions[609] = BinaryenUnary(the_module, 20, expressions[608]);
- expressions[610] = BinaryenConst(the_module, BinaryenLiteralInt32(2449));
+ expressions[621] = BinaryenUnary(the_module, 25, expressions[620]);
+ expressions[622] = BinaryenUnary(the_module, 20, expressions[621]);
+ expressions[623] = BinaryenConst(the_module, BinaryenLiteralInt32(2449));
{
BinaryenExpressionRef operands[] = { expressions[14], expressions[15], expressions[16], expressions[17] };
- expressions[611] = BinaryenCallIndirect(the_module, expressions[610], operands, 4, "iiIfF");
- }
- expressions[612] = BinaryenUnary(the_module, 20, expressions[611]);
- expressions[613] = BinaryenGetLocal(the_module, 0, 1);
- expressions[614] = BinaryenDrop(the_module, expressions[613]);
- expressions[615] = BinaryenConst(the_module, BinaryenLiteralInt32(101));
- expressions[616] = BinaryenSetLocal(the_module, 0, expressions[615]);
- expressions[617] = BinaryenConst(the_module, BinaryenLiteralInt32(102));
- expressions[618] = BinaryenTeeLocal(the_module, 0, expressions[617]);
- expressions[619] = BinaryenDrop(the_module, expressions[618]);
- expressions[620] = BinaryenConst(the_module, BinaryenLiteralInt32(1));
- expressions[621] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[620]);
- expressions[622] = BinaryenConst(the_module, BinaryenLiteralInt32(8));
- expressions[623] = BinaryenLoad(the_module, 2, 1, 2, 1, 2, expressions[622]);
- expressions[624] = BinaryenConst(the_module, BinaryenLiteralInt32(2));
- expressions[625] = BinaryenLoad(the_module, 4, 0, 0, 0, 3, expressions[624]);
- expressions[626] = BinaryenConst(the_module, BinaryenLiteralInt32(9));
- expressions[627] = BinaryenLoad(the_module, 8, 0, 2, 8, 4, expressions[626]);
- expressions[628] = BinaryenStore(the_module, 4, 0, 0, expressions[30], expressions[31], 1);
- expressions[629] = BinaryenStore(the_module, 8, 2, 4, expressions[32], expressions[33], 2);
- expressions[630] = BinaryenSelect(the_module, expressions[27], expressions[28], expressions[29]);
- expressions[631] = BinaryenConst(the_module, BinaryenLiteralInt32(1337));
- expressions[632] = BinaryenReturn(the_module, expressions[631]);
- expressions[633] = BinaryenNop(the_module);
- expressions[634] = BinaryenUnreachable(the_module);
+ expressions[624] = BinaryenCallIndirect(the_module, expressions[623], operands, 4, "iiIfF");
+ }
+ expressions[625] = BinaryenUnary(the_module, 20, expressions[624]);
+ expressions[626] = BinaryenGetLocal(the_module, 0, 1);
+ expressions[627] = BinaryenDrop(the_module, expressions[626]);
+ expressions[628] = BinaryenConst(the_module, BinaryenLiteralInt32(101));
+ expressions[629] = BinaryenSetLocal(the_module, 0, expressions[628]);
+ expressions[630] = BinaryenConst(the_module, BinaryenLiteralInt32(102));
+ expressions[631] = BinaryenTeeLocal(the_module, 0, expressions[630]);
+ expressions[632] = BinaryenDrop(the_module, expressions[631]);
+ expressions[633] = BinaryenConst(the_module, BinaryenLiteralInt32(1));
+ expressions[634] = BinaryenLoad(the_module, 4, 0, 0, 0, 1, expressions[633]);
+ expressions[635] = BinaryenConst(the_module, BinaryenLiteralInt32(8));
+ expressions[636] = BinaryenLoad(the_module, 2, 1, 2, 1, 2, expressions[635]);
+ expressions[637] = BinaryenConst(the_module, BinaryenLiteralInt32(2));
+ expressions[638] = BinaryenLoad(the_module, 4, 0, 0, 0, 3, expressions[637]);
+ expressions[639] = BinaryenConst(the_module, BinaryenLiteralInt32(9));
+ expressions[640] = BinaryenLoad(the_module, 8, 0, 2, 8, 4, expressions[639]);
+ expressions[641] = BinaryenStore(the_module, 4, 0, 0, expressions[30], expressions[31], 1);
+ expressions[642] = BinaryenStore(the_module, 8, 2, 4, expressions[32], expressions[33], 2);
+ expressions[643] = BinaryenSelect(the_module, expressions[27], expressions[28], expressions[29]);
+ expressions[644] = BinaryenConst(the_module, BinaryenLiteralInt32(1337));
+ expressions[645] = BinaryenReturn(the_module, expressions[644]);
+ expressions[646] = BinaryenNop(the_module);
+ expressions[647] = BinaryenUnreachable(the_module);
BinaryenExpressionPrint(expressions[41]);
(f32.neg
(f32.const -33.61199951171875)
@@ -3219,32 +3248,32 @@ int main() {
expressions[525], expressions[527], expressions[530], expressions[533], expressions[536], expressions[539],
expressions[542], expressions[545], expressions[548], expressions[551], expressions[554], expressions[557],
expressions[560], expressions[563], expressions[566], expressions[569], expressions[572], expressions[575],
- expressions[578], expressions[581], expressions[584], expressions[588], expressions[589], expressions[590],
- expressions[591], expressions[593], expressions[595], expressions[596], expressions[598], expressions[600],
- expressions[601], expressions[602], expressions[604], expressions[606], expressions[609], expressions[612],
- expressions[614], expressions[616], expressions[619], expressions[621], expressions[623], expressions[625],
- expressions[627], expressions[628], expressions[629], expressions[630], expressions[632], expressions[633],
- expressions[634] };
- expressions[635] = BinaryenBlock(the_module, "the-value", children, 240, BinaryenTypeAuto());
+ expressions[578], expressions[581], expressions[584], expressions[588], expressions[592], expressions[593],
+ expressions[597], expressions[601], expressions[602], expressions[603], expressions[604], expressions[606],
+ expressions[608], expressions[609], expressions[611], expressions[613], expressions[614], expressions[615],
+ expressions[617], expressions[619], expressions[622], expressions[625], expressions[627], expressions[629],
+ expressions[632], expressions[634], expressions[636], expressions[638], expressions[640], expressions[641],
+ expressions[642], expressions[643], expressions[645], expressions[646], expressions[647] };
+ expressions[648] = BinaryenBlock(the_module, "the-value", children, 244, BinaryenTypeAuto());
}
- expressions[636] = BinaryenDrop(the_module, expressions[635]);
+ expressions[649] = BinaryenDrop(the_module, expressions[648]);
{
- BinaryenExpressionRef children[] = { expressions[636] };
- expressions[637] = BinaryenBlock(the_module, "the-nothing", children, 1, BinaryenTypeAuto());
+ BinaryenExpressionRef children[] = { expressions[649] };
+ expressions[650] = BinaryenBlock(the_module, "the-nothing", children, 1, BinaryenTypeAuto());
}
- expressions[638] = BinaryenConst(the_module, BinaryenLiteralInt32(42));
+ expressions[651] = BinaryenConst(the_module, BinaryenLiteralInt32(42));
{
- BinaryenExpressionRef children[] = { expressions[637], expressions[638] };
- expressions[639] = BinaryenBlock(the_module, "the-body", children, 2, BinaryenTypeAuto());
+ BinaryenExpressionRef children[] = { expressions[650], expressions[651] };
+ expressions[652] = BinaryenBlock(the_module, "the-body", children, 2, BinaryenTypeAuto());
}
{
BinaryenType varTypes[] = { 1 };
- functions[0] = BinaryenAddFunction(the_module, "kitchen()sinker", functionTypes[0], varTypes, 1, expressions[639]);
+ functions[0] = BinaryenAddFunction(the_module, "kitchen()sinker", functionTypes[0], varTypes, 1, expressions[652]);
}
- expressions[640] = BinaryenConst(the_module, BinaryenLiteralInt32(7));
- BinaryenAddGlobal(the_module, "a-global", 1, 0, expressions[640]);
- expressions[641] = BinaryenConst(the_module, BinaryenLiteralFloat32(7.5));
- BinaryenAddGlobal(the_module, "a-mutable-global", 3, 1, expressions[641]);
+ expressions[653] = BinaryenConst(the_module, BinaryenLiteralInt32(7));
+ BinaryenAddGlobal(the_module, "a-global", 1, 0, expressions[653]);
+ expressions[654] = BinaryenConst(the_module, BinaryenLiteralFloat32(7.5));
+ BinaryenAddGlobal(the_module, "a-mutable-global", 3, 1, expressions[654]);
{
BinaryenType paramTypes[] = { 1, 4 };
functionTypes[1] = BinaryenAddFunctionType(the_module, "fiF", 3, paramTypes, 2);
@@ -3256,11 +3285,11 @@ int main() {
const char* funcNames[] = { "kitchen()sinker" };
BinaryenSetFunctionTable(the_module, 1, 1, funcNames, 1);
}
- expressions[642] = BinaryenConst(the_module, BinaryenLiteralInt32(10));
+ expressions[655] = BinaryenConst(the_module, BinaryenLiteralInt32(10));
{
const char segment0[] = { 104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100 };
const char* segments[] = { segment0 };
- BinaryenExpressionRef segmentOffsets[] = { expressions[642] };
+ BinaryenExpressionRef segmentOffsets[] = { expressions[655] };
BinaryenIndex segmentSizes[] = { 12 };
BinaryenSetMemory(the_module, 1, 256, "mem", segments, segmentOffsets, segmentSizes, 1, 0);
}
@@ -3268,10 +3297,10 @@ int main() {
BinaryenType paramTypes[] = { 0 };
functionTypes[2] = BinaryenAddFunctionType(the_module, "v", 0, paramTypes, 0);
}
- expressions[643] = BinaryenNop(the_module);
+ expressions[656] = BinaryenNop(the_module);
{
BinaryenType varTypes[] = { 0 };
- functions[1] = BinaryenAddFunction(the_module, "starter", functionTypes[2], varTypes, 0, expressions[643]);
+ functions[1] = BinaryenAddFunction(the_module, "starter", functionTypes[2], varTypes, 0, expressions[656]);
}
BinaryenSetStart(the_module, functions[1]);
{
@@ -4496,6 +4525,22 @@ int main() {
(v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10)
)
)
+ (memory.init 0
+ (i32.const 1024)
+ (i32.const 0)
+ (i32.const 12)
+ )
+ (data.drop 0)
+ (memory.copy
+ (i32.const 2048)
+ (i32.const 1024)
+ (i32.const 12)
+ )
+ (memory.fill
+ (i32.const 0)
+ (i32.const 42)
+ (i32.const 1024)
+ )
(block
)
(if
diff --git a/test/example/c-api-kitchen-sink.txt.txt b/test/example/c-api-kitchen-sink.txt.txt
index 3546b5dd1..32e726abe 100644
--- a/test/example/c-api-kitchen-sink.txt.txt
+++ b/test/example/c-api-kitchen-sink.txt.txt
@@ -1216,6 +1216,22 @@
(v128.const i32 0x1 0x2 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10)
)
)
+ (memory.init 0
+ (i32.const 1024)
+ (i32.const 0)
+ (i32.const 12)
+ )
+ (data.drop 0)
+ (memory.copy
+ (i32.const 2048)
+ (i32.const 1024)
+ (i32.const 12)
+ )
+ (memory.fill
+ (i32.const 0)
+ (i32.const 42)
+ (i32.const 1024)
+ )
(block
)
(if
diff --git a/test/lld/hello_world.wast.mem b/test/lld/em_asm.wast.mem.mem
index 674c410a9..1e5476727 100644
--- a/test/lld/hello_world.wast.mem
+++ b/test/lld/em_asm.wast.mem.mem
Binary files differ
diff --git a/test/lld/em_asm.wast.mem.out b/test/lld/em_asm.wast.mem.out
new file mode 100644
index 000000000..e7c680764
--- /dev/null
+++ b/test/lld/em_asm.wast.mem.out
@@ -0,0 +1,117 @@
+(module
+ (type $0 (func (param i32) (result i32)))
+ (type $1 (func (param i32 i32 i32) (result i32)))
+ (type $2 (func (param i32 i32) (result i32)))
+ (type $3 (func (result i32)))
+ (type $4 (func))
+ (type $FUNCSIG$ii (func (param i32) (result i32)))
+ (type $FUNCSIG$iiii (func (param i32 i32 i32) (result i32)))
+ (type $FUNCSIG$iii (func (param i32 i32) (result i32)))
+ (import "env" "emscripten_asm_const_i" (func $emscripten_asm_const_i (param i32) (result i32)))
+ (import "env" "emscripten_asm_const_iii" (func $emscripten_asm_const_iii (param i32 i32 i32) (result i32)))
+ (import "env" "emscripten_asm_const_ii" (func $emscripten_asm_const_ii (param i32 i32) (result i32)))
+ (memory $0 2)
+ (table $0 1 1 funcref)
+ (global $global$0 (mut i32) (i32.const 16384))
+ (global $global$1 i32 (i32.const 66192))
+ (global $global$2 i32 (i32.const 652))
+ (export "memory" (memory $0))
+ (export "__post_instantiate" (func $__wasm_call_ctors))
+ (export "main" (func $main))
+ (export "__heap_base" (global $global$1))
+ (export "__data_end" (global $global$2))
+ (export "stackSave" (func $stackSave))
+ (export "stackAlloc" (func $stackAlloc))
+ (export "stackRestore" (func $stackRestore))
+ (export "__growWasmMemory" (func $__growWasmMemory))
+ (func $main (; 3 ;) (type $3) (result i32)
+ (drop
+ (call $emscripten_asm_const_i
+ (i32.const 0)
+ )
+ )
+ (drop
+ (call $emscripten_asm_const_ii
+ (i32.const 2)
+ (call $emscripten_asm_const_iii
+ (i32.const 1)
+ (i32.const 13)
+ (i32.const 27)
+ )
+ )
+ )
+ (i32.const 0)
+ )
+ (func $__wasm_call_ctors (; 4 ;) (type $4)
+ (nop)
+ )
+ (func $stackSave (; 5 ;) (result i32)
+ (global.get $global$0)
+ )
+ (func $stackAlloc (; 6 ;) (param $0 i32) (result i32)
+ (local $1 i32)
+ (global.set $global$0
+ (local.tee $1
+ (i32.and
+ (i32.sub
+ (global.get $global$0)
+ (local.get $0)
+ )
+ (i32.const -16)
+ )
+ )
+ )
+ (local.get $1)
+ )
+ (func $stackRestore (; 7 ;) (param $0 i32)
+ (global.set $global$0
+ (local.get $0)
+ )
+ )
+ (func $__growWasmMemory (; 8 ;) (param $newSize i32) (result i32)
+ (grow_memory
+ (local.get $newSize)
+ )
+ )
+)
+(;
+--BEGIN METADATA --
+{
+ "asmConsts": {
+ "2": ["{ Module.print(\"Got \" + $0); }", ["ii"], [""]],
+ "0": ["{ Module.print(\"Hello world\"); }", ["i"], [""]],
+ "1": ["{ return $0 + $1; }", ["iii"], [""]]
+ },
+ "staticBump": 84,
+ "tableSize": 1,
+ "initializers": [
+ "__post_instantiate"
+ ],
+ "declares": [
+ ],
+ "externs": [
+ ],
+ "implementedFunctions": [
+ "___post_instantiate",
+ "_main",
+ "_stackSave",
+ "_stackAlloc",
+ "_stackRestore",
+ "___growWasmMemory"
+ ],
+ "exports": [
+ "memory",
+ "__post_instantiate",
+ "main",
+ "__heap_base",
+ "__data_end",
+ "stackSave",
+ "stackAlloc",
+ "stackRestore",
+ "__growWasmMemory"
+ ],
+ "invokeFuncs": [
+ ]
+}
+-- END METADATA --
+;)