1 // This is a small "shim" program which is used when wasm32 unit tests are run
2 // in this repository. This program is intended to be run in node.js and will
3 // load a wasm module into memory, instantiate it with a set of imports, and
6 // There's a bunch of helper functions defined here in `imports.env`, but note
7 // that most of them aren't actually needed to execute most programs. Many of
8 // these are just intended for completeness or debugging. Hopefully over time
9 // nothing here is needed for completeness.
11 const fs = require('fs');
12 const process = require('process');
13 const buffer = fs.readFileSync(process.argv[2]);
15 Error.stackTraceLimit = 20;
17 let m = new WebAssembly.Module(buffer);
18 let instance = new WebAssembly.Instance(m, {});
20 instance.exports.main();