Skip to content

Instantly share code, notes, and snippets.

View bnjbvr's full-sized avatar

Benjamin Bouvier bnjbvr

View GitHub Profile
@bnjbvr
bnjbvr / compile.js
Created April 20, 2020 17:03
Spidermonkey script to compile a single wasm module
// Usage: $jsshell ./compile.js /path/to/wasm-binary.wasm
if (scriptArgs.length !== 1) {
console.log('one argument required: path to wasm binary');
}
let pathToBinary = scriptArgs[0];
let binary;
try {
@bnjbvr
bnjbvr / wasm-shell.js
Created May 5, 2020 12:53
Run a wasm binary in Spidermonkey's shell
if (scriptArgs.length < 1) {
console.log('path to a wasm binary is required');
quit(-1);
}
let binary = os.file.readFile(scriptArgs[0], 'binary');
// If the wasm instance expects imported functions from js, put them in here.
// let maybeImports = { std: { f: function() { }} };
let maybeImports;