diff options
author | Alon Zakai <alonzakai@gmail.com> | 2018-09-19 15:50:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-19 15:50:30 -0700 |
commit | fe88b47749115009da0447e340cbdc86edf30984 (patch) | |
tree | 7dfd9aba7086c8aa6dff4877ac1ee3b9d78bc5ce /test/example | |
parent | a53356ab155a7d8c2f334dc9a3c1432bacbc78fe (diff) | |
download | binaryen-fe88b47749115009da0447e340cbdc86edf30984.tar.gz binaryen-fe88b47749115009da0447e340cbdc86edf30984.tar.bz2 binaryen-fe88b47749115009da0447e340cbdc86edf30984.zip |
Unify imported and non-imported things (#1678)
Fixes #1649
This moves us to a single object for functions, which can be imported or nor, and likewise for globals (as a result, GetGlobals do not need to check if the global is imported or not, etc.). All imported things now inherit from Importable, which has the module and base of the import, and if they are set then it is an import.
For convenient iteration, there are a few helpers like
ModuleUtils::iterDefinedGlobals(wasm, [&](Global* global) {
.. use global ..
});
as often iteration only cares about imported or defined (non-imported) things.
Diffstat (limited to 'test/example')
-rw-r--r-- | test/example/c-api-kitchen-sink.c | 6 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.txt | 114 | ||||
-rw-r--r-- | test/example/c-api-kitchen-sink.txt.txt | 8 | ||||
-rw-r--r-- | test/example/c-api-relooper-unreachable-if.cpp | 2 | ||||
-rw-r--r-- | test/example/relooper-fuzz.c | 20 | ||||
-rw-r--r-- | test/example/relooper-fuzz.txt | 4 | ||||
-rw-r--r-- | test/example/relooper-fuzz1.c | 22 | ||||
-rw-r--r-- | test/example/relooper-fuzz1.txt | 4 |
8 files changed, 90 insertions, 90 deletions
diff --git a/test/example/c-api-kitchen-sink.c b/test/example/c-api-kitchen-sink.c index 8248dea52..4e4944cda 100644 --- a/test/example/c-api-kitchen-sink.c +++ b/test/example/c-api-kitchen-sink.c @@ -202,7 +202,7 @@ void test_core() { BinaryenUnary(module, BinaryenEqZInt32(), // check the output type of the call node BinaryenUnary(module, BinaryenTruncSFloat32ToInt32(), - BinaryenCallImport(module, "an-imported", callOperands2, 2, BinaryenTypeFloat32()) + BinaryenCall(module, "an-imported", callOperands2, 2, BinaryenTypeFloat32()) ) ), BinaryenUnary(module, BinaryenEqZInt32(), // check the output type of the call node @@ -301,7 +301,7 @@ void test_unreachable() { BinaryenExpressionRef makeCallCheck(BinaryenModuleRef module, int x) { BinaryenExpressionRef callOperands[] = { makeInt32(module, x) }; - return BinaryenCallImport(module, "check", callOperands, 1, BinaryenTypeNone()); + return BinaryenCall(module, "check", callOperands, 1, BinaryenTypeNone()); } void test_relooper() { @@ -543,7 +543,7 @@ void test_interpret() { BinaryenFunctionTypeRef v = BinaryenAddFunctionType(module, "v", BinaryenTypeNone(), NULL, 0); BinaryenExpressionRef callOperands[] = { makeInt32(module, 1234) }; - BinaryenExpressionRef call = BinaryenCallImport(module, "print-i32", callOperands, 1, BinaryenTypeNone()); + BinaryenExpressionRef call = BinaryenCall(module, "print-i32", callOperands, 1, BinaryenTypeNone()); BinaryenFunctionRef starter = BinaryenAddFunction(module, "starter", v, NULL, 0, call); BinaryenSetStart(module, starter); diff --git a/test/example/c-api-kitchen-sink.txt b/test/example/c-api-kitchen-sink.txt index 7fa1b4ea7..5dc884d2b 100644 --- a/test/example/c-api-kitchen-sink.txt +++ b/test/example/c-api-kitchen-sink.txt @@ -13,13 +13,13 @@ BinaryenTypeAuto: -1 (type $fiF (func (param i32 f64) (result f32))) (type $v (func)) (type $3 (func)) + (memory $0 1 256) + (data (i32.const 10) "hello, world") + (table 1 1 anyfunc) + (elem (i32.const 0) "$kitchen()sinker") (import "module" "base" (func $an-imported (param i32 f64) (result f32))) (global $a-global i32 (i32.const 7)) (global $a-mutable-global (mut f32) (f32.const 7.5)) - (table 1 1 anyfunc) - (elem (i32.const 0) "$kitchen()sinker") - (memory $0 1 256) - (data (i32.const 10) "hello, world") (export "kitchen_sinker" (func "$kitchen()sinker")) (export "mem" (memory $0)) (start $starter) @@ -1078,7 +1078,7 @@ int main() { std::map<size_t, BinaryenFunctionTypeRef> functionTypes; std::map<size_t, BinaryenExpressionRef> expressions; std::map<size_t, BinaryenFunctionRef> functions; - std::map<size_t, BinaryenImportRef> imports; + std::map<size_t, BinaryenGlobalRef> globals; std::map<size_t, BinaryenExportRef> exports; std::map<size_t, RelooperBlockRef> relooperBlocks; BinaryenModuleRef the_module = NULL; @@ -1321,7 +1321,7 @@ int main() { expressions[218] = BinaryenUnary(the_module, 20, expressions[217]); { BinaryenExpressionRef operands[] = { expressions[7], expressions[8] }; - expressions[219] = BinaryenCallImport(the_module, "an-imported", operands, 2, 3); + expressions[219] = BinaryenCall(the_module, "an-imported", operands, 2, 3); } expressions[220] = BinaryenUnary(the_module, 25, expressions[219]); expressions[221] = BinaryenUnary(the_module, 20, expressions[220]); @@ -1398,7 +1398,7 @@ int main() { BinaryenType paramTypes[] = { 1, 4 }; functionTypes[1] = BinaryenAddFunctionType(the_module, "fiF", 3, paramTypes, 2); } - imports[0] = BinaryenAddFunctionImport(the_module, "an-imported", "module", "base", functionTypes[1]); + BinaryenAddFunctionImport(the_module, "an-imported", "module", "base", functionTypes[1]); exports[0] = BinaryenAddFunctionExport(the_module, "kitchen()sinker", "kitchen_sinker"); BinaryenFunctionGetName(functions[0]); { @@ -1435,13 +1435,13 @@ int main() { (type $fiF (func (param i32 f64) (result f32))) (type $v (func)) (type $3 (func)) + (memory $0 1 256) + (data (i32.const 10) "hello, world") + (table 1 1 anyfunc) + (elem (i32.const 0) "$kitchen()sinker") (import "module" "base" (func $an-imported (param i32 f64) (result f32))) (global $a-global i32 (i32.const 7)) (global $a-mutable-global (mut f32) (f32.const 7.5)) - (table 1 1 anyfunc) - (elem (i32.const 0) "$kitchen()sinker") - (memory $0 1 256) - (data (i32.const 10) "hello, world") (export "kitchen_sinker" (func "$kitchen()sinker")) (export "mem" (memory $0)) (start $starter) @@ -1966,7 +1966,7 @@ int main() { functionTypes.clear(); expressions.clear(); functions.clear(); - imports.clear(); + globals.clear(); exports.clear(); relooperBlocks.clear(); the_module = BinaryenModuleCreate(); @@ -1979,12 +1979,12 @@ int main() { BinaryenType paramTypes[] = { 1 }; functionTypes[1] = BinaryenAddFunctionType(the_module, "vi", 0, paramTypes, 1); } - imports[0] = BinaryenAddFunctionImport(the_module, "check", "module", "check", functionTypes[1]); + BinaryenAddFunctionImport(the_module, "check", "module", "check", functionTypes[1]); the_relooper = RelooperCreate(); expressions[1] = BinaryenConst(the_module, BinaryenLiteralInt32(1337)); { BinaryenExpressionRef operands[] = { expressions[1] }; - expressions[2] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[2] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[2]); expressions[3] = RelooperRenderAndDispose(the_relooper, relooperBlocks[0], 0, the_module); @@ -1996,13 +1996,13 @@ int main() { expressions[4] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); { BinaryenExpressionRef operands[] = { expressions[4] }; - expressions[5] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[5] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[5]); expressions[6] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); { BinaryenExpressionRef operands[] = { expressions[6] }; - expressions[7] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[7] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[7]); RelooperAddBranch(relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]); @@ -2015,13 +2015,13 @@ int main() { expressions[9] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); { BinaryenExpressionRef operands[] = { expressions[9] }; - expressions[10] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[10] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[10]); expressions[11] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); { BinaryenExpressionRef operands[] = { expressions[11] }; - expressions[12] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[12] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[12]); expressions[13] = BinaryenConst(the_module, BinaryenLiteralInt32(77)); @@ -2036,13 +2036,13 @@ int main() { expressions[16] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); { BinaryenExpressionRef operands[] = { expressions[16] }; - expressions[17] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[17] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[17]); expressions[18] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); { BinaryenExpressionRef operands[] = { expressions[18] }; - expressions[19] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[19] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[19]); RelooperAddBranch(relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]); @@ -2056,13 +2056,13 @@ int main() { expressions[21] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); { BinaryenExpressionRef operands[] = { expressions[21] }; - expressions[22] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[22] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[22]); expressions[23] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); { BinaryenExpressionRef operands[] = { expressions[23] }; - expressions[24] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[24] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[24]); expressions[25] = BinaryenConst(the_module, BinaryenLiteralInt32(33)); @@ -2080,19 +2080,19 @@ int main() { expressions[30] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); { BinaryenExpressionRef operands[] = { expressions[30] }; - expressions[31] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[31] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[31]); expressions[32] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); { BinaryenExpressionRef operands[] = { expressions[32] }; - expressions[33] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[33] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[33]); expressions[34] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); { BinaryenExpressionRef operands[] = { expressions[34] }; - expressions[35] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[35] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[35]); expressions[36] = BinaryenConst(the_module, BinaryenLiteralInt32(55)); @@ -2107,19 +2107,19 @@ int main() { expressions[38] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); { BinaryenExpressionRef operands[] = { expressions[38] }; - expressions[39] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[39] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[39]); expressions[40] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); { BinaryenExpressionRef operands[] = { expressions[40] }; - expressions[41] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[41] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[41]); expressions[42] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); { BinaryenExpressionRef operands[] = { expressions[42] }; - expressions[43] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[43] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[43]); expressions[44] = BinaryenConst(the_module, BinaryenLiteralInt32(10)); @@ -2138,19 +2138,19 @@ int main() { expressions[50] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); { BinaryenExpressionRef operands[] = { expressions[50] }; - expressions[51] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[51] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[51]); expressions[52] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); { BinaryenExpressionRef operands[] = { expressions[52] }; - expressions[53] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[53] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[53]); expressions[54] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); { BinaryenExpressionRef operands[] = { expressions[54] }; - expressions[55] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[55] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[55]); expressions[56] = BinaryenConst(the_module, BinaryenLiteralInt32(55)); @@ -2166,19 +2166,19 @@ int main() { expressions[58] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); { BinaryenExpressionRef operands[] = { expressions[58] }; - expressions[59] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[59] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[59]); expressions[60] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); { BinaryenExpressionRef operands[] = { expressions[60] }; - expressions[61] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[61] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[61]); expressions[62] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); { BinaryenExpressionRef operands[] = { expressions[62] }; - expressions[63] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[63] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[63]); expressions[64] = BinaryenConst(the_module, BinaryenLiteralInt32(-1)); @@ -2200,25 +2200,25 @@ int main() { expressions[72] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); { BinaryenExpressionRef operands[] = { expressions[72] }; - expressions[73] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[73] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[73]); expressions[74] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); { BinaryenExpressionRef operands[] = { expressions[74] }; - expressions[75] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[75] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[75]); expressions[76] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); { BinaryenExpressionRef operands[] = { expressions[76] }; - expressions[77] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[77] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[77]); expressions[78] = BinaryenConst(the_module, BinaryenLiteralInt32(3)); { BinaryenExpressionRef operands[] = { expressions[78] }; - expressions[79] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[79] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[3] = RelooperAddBlock(the_relooper, expressions[79]); expressions[80] = BinaryenConst(the_module, BinaryenLiteralInt32(55)); @@ -2235,19 +2235,19 @@ int main() { expressions[82] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); { BinaryenExpressionRef operands[] = { expressions[82] }; - expressions[83] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[83] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[83]); expressions[84] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); { BinaryenExpressionRef operands[] = { expressions[84] }; - expressions[85] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[85] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[85]); expressions[86] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); { BinaryenExpressionRef operands[] = { expressions[86] }; - expressions[87] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[87] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[87]); RelooperAddBranch(relooperBlocks[0], relooperBlocks[1], expressions[0], expressions[0]); @@ -2263,43 +2263,43 @@ int main() { expressions[90] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); { BinaryenExpressionRef operands[] = { expressions[90] }; - expressions[91] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[91] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[91]); expressions[92] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); { BinaryenExpressionRef operands[] = { expressions[92] }; - expressions[93] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[93] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[93]); expressions[94] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); { BinaryenExpressionRef operands[] = { expressions[94] }; - expressions[95] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[95] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[95]); expressions[96] = BinaryenConst(the_module, BinaryenLiteralInt32(3)); { BinaryenExpressionRef operands[] = { expressions[96] }; - expressions[97] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[97] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[3] = RelooperAddBlock(the_relooper, expressions[97]); expressions[98] = BinaryenConst(the_module, BinaryenLiteralInt32(4)); { BinaryenExpressionRef operands[] = { expressions[98] }; - expressions[99] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[99] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[4] = RelooperAddBlock(the_relooper, expressions[99]); expressions[100] = BinaryenConst(the_module, BinaryenLiteralInt32(5)); { BinaryenExpressionRef operands[] = { expressions[100] }; - expressions[101] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[101] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[5] = RelooperAddBlock(the_relooper, expressions[101]); expressions[102] = BinaryenConst(the_module, BinaryenLiteralInt32(6)); { BinaryenExpressionRef operands[] = { expressions[102] }; - expressions[103] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[103] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[6] = RelooperAddBlock(the_relooper, expressions[103]); expressions[104] = BinaryenConst(the_module, BinaryenLiteralInt32(10)); @@ -2332,25 +2332,25 @@ int main() { expressions[117] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); { BinaryenExpressionRef operands[] = { expressions[117] }; - expressions[118] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[118] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[0] = RelooperAddBlockWithSwitch(the_relooper, expressions[118], expressions[116]); expressions[119] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); { BinaryenExpressionRef operands[] = { expressions[119] }; - expressions[120] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[120] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[120]); expressions[121] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); { BinaryenExpressionRef operands[] = { expressions[121] }; - expressions[122] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[122] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[122]); expressions[123] = BinaryenConst(the_module, BinaryenLiteralInt32(3)); { BinaryenExpressionRef operands[] = { expressions[123] }; - expressions[124] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[124] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[3] = RelooperAddBlock(the_relooper, expressions[124]); { @@ -2376,19 +2376,19 @@ int main() { expressions[128] = BinaryenConst(the_module, BinaryenLiteralInt32(0)); { BinaryenExpressionRef operands[] = { expressions[128] }; - expressions[129] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[129] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[0] = RelooperAddBlock(the_relooper, expressions[129]); expressions[130] = BinaryenConst(the_module, BinaryenLiteralInt32(1)); { BinaryenExpressionRef operands[] = { expressions[130] }; - expressions[131] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[131] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[1] = RelooperAddBlock(the_relooper, expressions[131]); expressions[132] = BinaryenConst(the_module, BinaryenLiteralInt32(2)); { BinaryenExpressionRef operands[] = { expressions[132] }; - expressions[133] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[133] = BinaryenCall(the_module, "check", operands, 1, 0); } relooperBlocks[2] = RelooperAddBlock(the_relooper, expressions[133]); expressions[134] = BinaryenConst(the_module, BinaryenLiteralInt32(10)); @@ -2409,7 +2409,7 @@ int main() { expressions[136] = BinaryenConst(the_module, BinaryenLiteralInt32(42)); { BinaryenExpressionRef operands[] = { expressions[136] }; - expressions[137] = BinaryenCallImport(the_module, "check", operands, 1, 0); + expressions[137] = BinaryenCall(the_module, "check", operands, 1, 0); } expressions[138] = BinaryenConst(the_module, BinaryenLiteralInt32(1337)); expressions[139] = BinaryenReturn(the_module, expressions[138]); @@ -2921,7 +2921,7 @@ optimized: functionTypes.clear(); expressions.clear(); functions.clear(); - imports.clear(); + globals.clear(); exports.clear(); relooperBlocks.clear(); return 0; diff --git a/test/example/c-api-kitchen-sink.txt.txt b/test/example/c-api-kitchen-sink.txt.txt index 986c21bf6..1d2fcfdda 100644 --- a/test/example/c-api-kitchen-sink.txt.txt +++ b/test/example/c-api-kitchen-sink.txt.txt @@ -6,13 +6,13 @@ (type $fiF (func (param i32 f64) (result f32))) (type $v (func)) (type $3 (func)) + (memory $0 1 256) + (data (i32.const 10) "hello, world") + (table 1 1 anyfunc) + (elem (i32.const 0) "$kitchen()sinker") (import "module" "base" (func $an-imported (param i32 f64) (result f32))) (global $a-global i32 (i32.const 7)) (global $a-mutable-global (mut f32) (f32.const 7.5)) - (table 1 1 anyfunc) - (elem (i32.const 0) "$kitchen()sinker") - (memory $0 1 256) - (data (i32.const 10) "hello, world") (export "kitchen_sinker" (func "$kitchen()sinker")) (export "mem" (memory $0)) (start $starter) diff --git a/test/example/c-api-relooper-unreachable-if.cpp b/test/example/c-api-relooper-unreachable-if.cpp index 2fafa88d1..dbd50d116 100644 --- a/test/example/c-api-relooper-unreachable-if.cpp +++ b/test/example/c-api-relooper-unreachable-if.cpp @@ -147,7 +147,7 @@ int main() { expressions[47] = BinaryenGetLocal(the_module, 2, 1); { BinaryenExpressionRef operands[] = { expressions[47] }; - expressions[48] = BinaryenCallImport(the_module, "print_i32", operands, 1, 0); + expressions[48] = BinaryenCall(the_module, "print_i32", operands, 1, 0); } { BinaryenExpressionRef children[] = { expressions[44], expressions[46], expressions[48] }; diff --git a/test/example/relooper-fuzz.c b/test/example/relooper-fuzz.c index 28be4bd90..529014139 100644 --- a/test/example/relooper-fuzz.c +++ b/test/example/relooper-fuzz.c @@ -47,7 +47,7 @@ int main() { ) }; BinaryenExpressionRef debugger; - if (1) debugger = BinaryenCallImport(module, "print", args, 1, BinaryenTypeNone()); + if (1) debugger = BinaryenCall(module, "print", args, 1, BinaryenTypeNone()); else debugger = BinaryenNop(module); // return the decision. need to subtract 4 that we just added, and add 8 since that's where we start, so overall offset 4 @@ -69,7 +69,7 @@ int main() { { BinaryenExpressionRef args[] = { BinaryenConst(module, BinaryenLiteralInt32(0)) }; BinaryenExpressionRef list[] = { - BinaryenCallImport(module, "print", args, 1, BinaryenTypeNone()), + BinaryenCall(module, "print", args, 1, BinaryenTypeNone()), BinaryenSetLocal(module, 0, BinaryenCall(module, "check", NULL, 0, BinaryenTypeInt32())) }; b0 = RelooperAddBlock(relooper, BinaryenBlock(module, NULL, list, 2, BinaryenTypeAuto())); @@ -79,7 +79,7 @@ int main() { { BinaryenExpressionRef args[] = { BinaryenConst(module, BinaryenLiteralInt32(1)) }; BinaryenExpressionRef list[] = { - BinaryenCallImport(module, "print", args, 1, BinaryenTypeNone()), + BinaryenCall(module, "print", args, 1, BinaryenTypeNone()), BinaryenSetLocal(module, 0, BinaryenCall(module, "check", NULL, 0, BinaryenTypeInt32())) }; b1 = RelooperAddBlock(relooper, BinaryenBlock(module, NULL, list, 2, BinaryenTypeAuto())); @@ -89,7 +89,7 @@ int main() { { BinaryenExpressionRef args[] = { BinaryenConst(module, BinaryenLiteralInt32(2)) }; BinaryenExpressionRef list[] = { - BinaryenCallImport(module, "print", args, 1, BinaryenTypeNone()), + BinaryenCall(module, "print", args, 1, BinaryenTypeNone()), BinaryenSetLocal(module, 0, BinaryenCall(module, "check", NULL, 0, BinaryenTypeInt32())) }; b2 = RelooperAddBlock(relooper, BinaryenBlock(module, NULL, list, 2, BinaryenTypeAuto())); @@ -99,7 +99,7 @@ int main() { { BinaryenExpressionRef args[] = { BinaryenConst(module, BinaryenLiteralInt32(3)) }; BinaryenExpressionRef list[] = { - BinaryenCallImport(module, "print", args, 1, BinaryenTypeNone()), + BinaryenCall(module, "print", args, 1, BinaryenTypeNone()), BinaryenSetLocal(module, 0, BinaryenCall(module, "check", NULL, 0, BinaryenTypeInt32())) }; b3 = RelooperAddBlock(relooper, BinaryenBlock(module, NULL, list, 2, BinaryenTypeAuto())); @@ -109,7 +109,7 @@ int main() { { BinaryenExpressionRef args[] = { BinaryenConst(module, BinaryenLiteralInt32(4)) }; BinaryenExpressionRef list[] = { - BinaryenCallImport(module, "print", args, 1, BinaryenTypeNone()), + BinaryenCall(module, "print", args, 1, BinaryenTypeNone()), BinaryenSetLocal(module, 0, BinaryenCall(module, "check", NULL, 0, BinaryenTypeInt32())) }; b4 = RelooperAddBlock(relooper, BinaryenBlock(module, NULL, list, 2, BinaryenTypeAuto())); @@ -119,7 +119,7 @@ int main() { { BinaryenExpressionRef args[] = { BinaryenConst(module, BinaryenLiteralInt32(5)) }; BinaryenExpressionRef list[] = { - BinaryenCallImport(module, "print", args, 1, BinaryenTypeNone()), + BinaryenCall(module, "print", args, 1, BinaryenTypeNone()), BinaryenSetLocal(module, 0, BinaryenCall(module, "check", NULL, 0, BinaryenTypeInt32())) }; b5 = RelooperAddBlock(relooper, BinaryenBlock(module, NULL, list, 2, BinaryenTypeAuto())); @@ -129,7 +129,7 @@ int main() { { BinaryenExpressionRef args[] = { BinaryenConst(module, BinaryenLiteralInt32(6)) }; BinaryenExpressionRef list[] = { - BinaryenCallImport(module, "print", args, 1, BinaryenTypeNone()), + BinaryenCall(module, "print", args, 1, BinaryenTypeNone()), BinaryenSetLocal(module, 0, BinaryenCall(module, "check", NULL, 0, BinaryenTypeInt32())) }; b6 = RelooperAddBlock(relooper, BinaryenBlock(module, NULL, list, 2, BinaryenTypeAuto())); @@ -139,7 +139,7 @@ int main() { { BinaryenExpressionRef args[] = { BinaryenConst(module, BinaryenLiteralInt32(7)) }; BinaryenExpressionRef list[] = { - BinaryenCallImport(module, "print", args, 1, BinaryenTypeNone()), + BinaryenCall(module, "print", args, 1, BinaryenTypeNone()), BinaryenSetLocal(module, 0, BinaryenCall(module, "check", NULL, 0, BinaryenTypeInt32())) }; b7 = RelooperAddBlock(relooper, BinaryenBlock(module, NULL, list, 2, BinaryenTypeAuto())); @@ -149,7 +149,7 @@ int main() { { BinaryenExpressionRef args[] = { BinaryenConst(module, BinaryenLiteralInt32(8)) }; BinaryenExpressionRef list[] = { - BinaryenCallImport(module, "print", args, 1, BinaryenTypeNone()), + BinaryenCall(module, "print", args, 1, BinaryenTypeNone()), BinaryenSetLocal(module, 0, BinaryenCall(module, "check", NULL, 0, BinaryenTypeInt32())) }; b8 = RelooperAddBlock(relooper, BinaryenBlock(module, NULL, list, 2, BinaryenTypeAuto())); diff --git a/test/example/relooper-fuzz.txt b/test/example/relooper-fuzz.txt index bde48af8c..47ebcfbb0 100644 --- a/test/example/relooper-fuzz.txt +++ b/test/example/relooper-fuzz.txt @@ -2,8 +2,8 @@ (type $i (func (result i32))) (type $v (func)) (type $vi (func (param i32))) - (import "spectest" "print" (func $print (param i32))) (memory $0 1 1) + (import "spectest" "print" (func $print (param i32))) (export "mem" (memory $0)) (start $main) (func $check (; 1 ;) (type $i) (result i32) @@ -295,8 +295,8 @@ (type $i (func (result i32))) (type $v (func)) (type $vi (func (param i32))) - (import "spectest" "print" (func $print (param i32))) (memory $0 1 1) + (import "spectest" "print" (func $print (param i32))) (export "mem" (memory $0)) (start $main) (func $check (; 1 ;) (; has Stack IR ;) (type $i) (result i32) diff --git a/test/example/relooper-fuzz1.c b/test/example/relooper-fuzz1.c index 9be2daa10..4aef34fde 100644 --- a/test/example/relooper-fuzz1.c +++ b/test/example/relooper-fuzz1.c @@ -50,7 +50,7 @@ int main() { ) }; BinaryenExpressionRef debugger; - if (1) debugger = BinaryenCallImport(module, "print", args, 1, + if (1) debugger = BinaryenCall(module, "print", args, 1, BinaryenTypeNone()); else debugger = BinaryenNop(module); @@ -83,7 +83,7 @@ int main() { BinaryenConst(module, BinaryenLiteralInt32(0)) }; BinaryenExpressionRef list[] = { - BinaryenCallImport(module, "print", args, 1, BinaryenTypeNone()), + BinaryenCall(module, "print", args, 1, BinaryenTypeNone()), BinaryenSetLocal(module, 0, BinaryenCall(module, "check", NULL, 0, BinaryenTypeInt32())) }; @@ -99,7 +99,7 @@ int main() { BinaryenConst(module, BinaryenLiteralInt32(1)) }; BinaryenExpressionRef list[] = { - BinaryenCallImport(module, "print", args, 1, BinaryenTypeNone()), + BinaryenCall(module, "print", args, 1, BinaryenTypeNone()), BinaryenSetLocal(module, 0, BinaryenCall(module, "check", NULL, 0, BinaryenTypeInt32())) }; @@ -115,7 +115,7 @@ int main() { BinaryenConst(module, BinaryenLiteralInt32(2)) }; BinaryenExpressionRef list[] = { - BinaryenCallImport(module, "print", args, 1, BinaryenTypeNone()), + BinaryenCall(module, "print", args, 1, BinaryenTypeNone()), BinaryenSetLocal(module, 0, BinaryenCall(module, "check", NULL, 0, BinaryenTypeInt32())) }; @@ -131,7 +131,7 @@ int main() { BinaryenConst(module, BinaryenLiteralInt32(3)) }; BinaryenExpressionRef list[] = { - BinaryenCallImport(module, "print", args, 1, BinaryenTypeNone()), + BinaryenCall(module, "print", args, 1, BinaryenTypeNone()), BinaryenSetLocal(module, 0, BinaryenCall(module, "check", NULL, 0, BinaryenTypeInt32())) }; @@ -147,7 +147,7 @@ int main() { BinaryenConst(module, BinaryenLiteralInt32(4)) }; BinaryenExpressionRef list[] = { - BinaryenCallImport(module, "print", args, 1, BinaryenTypeNone()), + BinaryenCall(module, "print", args, 1, BinaryenTypeNone()), BinaryenSetLocal(module, 0, BinaryenCall(module, "check", NULL, 0, BinaryenTypeInt32())) }; @@ -163,7 +163,7 @@ int main() { BinaryenConst(module, BinaryenLiteralInt32(5)) }; BinaryenExpressionRef list[] = { - BinaryenCallImport(module, "print", args, 1, BinaryenTypeNone()), + BinaryenCall(module, "print", args, 1, BinaryenTypeNone()), BinaryenSetLocal(module, 0, BinaryenCall(module, "check", NULL, 0, BinaryenTypeInt32())) }; @@ -179,7 +179,7 @@ int main() { BinaryenConst(module, BinaryenLiteralInt32(6)) }; BinaryenExpressionRef list[] = { - BinaryenCallImport(module, "print", args, 1, BinaryenTypeNone()), + BinaryenCall(module, "print", args, 1, BinaryenTypeNone()), BinaryenSetLocal(module, 0, BinaryenCall(module, "check", NULL, 0, BinaryenTypeInt32())) }; @@ -195,7 +195,7 @@ int main() { BinaryenConst(module, BinaryenLiteralInt32(7)) }; BinaryenExpressionRef list[] = { - BinaryenCallImport(module, "print", args, 1, BinaryenTypeNone()), + BinaryenCall(module, "print", args, 1, BinaryenTypeNone()), BinaryenSetLocal(module, 0, BinaryenCall(module, "check", NULL, 0, BinaryenTypeInt32())) }; @@ -211,7 +211,7 @@ int main() { BinaryenConst(module, BinaryenLiteralInt32(8)) }; BinaryenExpressionRef list[] = { - BinaryenCallImport(module, "print", args, 1, BinaryenTypeNone()), + BinaryenCall(module, "print", args, 1, BinaryenTypeNone()), BinaryenSetLocal(module, 0, BinaryenCall(module, "check", NULL, 0, BinaryenTypeInt32())) }; @@ -227,7 +227,7 @@ int main() { BinaryenConst(module, BinaryenLiteralInt32(9)) }; BinaryenExpressionRef list[] = { - BinaryenCallImport(module, "print", args, 1, BinaryenTypeNone()), + BinaryenCall(module, "print", args, 1, BinaryenTypeNone()), BinaryenSetLocal(module, 0, BinaryenCall(module, "check", NULL, 0, BinaryenTypeInt32())) }; diff --git a/test/example/relooper-fuzz1.txt b/test/example/relooper-fuzz1.txt index af3140f9c..b05da62c5 100644 --- a/test/example/relooper-fuzz1.txt +++ b/test/example/relooper-fuzz1.txt @@ -2,8 +2,8 @@ (type $i (func (result i32))) (type $v (func)) (type $vi (func (param i32))) - (import "spectest" "print" (func $print (param i32))) (memory $0 1 1) + (import "spectest" "print" (func $print (param i32))) (export "mem" (memory $0)) (start $main) (func $check (; 1 ;) (type $i) (result i32) @@ -271,8 +271,8 @@ (type $i (func (result i32))) (type $v (func)) (type $vi (func (param i32))) - (import "spectest" "print" (func $print (param i32))) (memory $0 1 1) + (import "spectest" "print" (func $print (param i32))) (export "mem" (memory $0)) (start $main) (func $check (; 1 ;) (; has Stack IR ;) (type $i) (result i32) |