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/relooper-fuzz.c | |
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/relooper-fuzz.c')
-rw-r--r-- | test/example/relooper-fuzz.c | 20 |
1 files changed, 10 insertions, 10 deletions
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())); |