-
-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat!: Remove js-runner * Implement wasi runner via execSync, call it grainrun * Also move the v8 flag * passthrough exit code * Update workflow step names * provide wasm file as first argv * gracefully show errors during grainrun * Remove remaining js-runner references * Update issue number * Fix missed preopens in merge * Passthrough argv after -- and add to test harness * Remove MTracepoint * Fix test arg * Regenerate lockfile * add hack for fdPrestatGet * Remove argv pass-through stuff from this PR * update timing tests * Update cli/bin/grain.js * move comment because formatter is BROKE --------- Co-authored-by: Blaine Bublitz <blaine.bublitz@gmail.com>
- Loading branch information
Showing
40 changed files
with
225 additions
and
6,915 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,6 @@ setup.data | |
setup.ml | ||
myocamlbuild.ml | ||
.merlin | ||
js-runner/dist | ||
/*.gr | ||
_esy/ | ||
**/_esy/ | ||
|
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,6 @@ setup.data | |
setup.ml | ||
myocamlbuild.ml | ||
.merlin | ||
js-runner/dist | ||
/*.gr | ||
_esy/ | ||
pkg/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{".":"0.5.13","cli":"0.5.13","compiler":"0.5.13","js-runner":"0.5.13","stdlib":"0.5.13"} | ||
{".":"0.5.13","cli":"0.5.13","compiler":"0.5.13","stdlib":"0.5.13"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
require("./pkg"); | ||
|
||
// https://github.com/grain-lang/grain/issues/1816 | ||
const v8 = require("v8"); | ||
/* From the Node.js docs: | ||
* | ||
* The v8.setFlagsFromString() method can be used to programmatically set V8 command-line flags. | ||
* This method should be used with care. Changing settings after the VM has started may result | ||
* in unpredictable behavior, including crashes and data loss; or it may simply do nothing. | ||
* | ||
* This seems to work for our needs with Node 18, but we should be cautious when updating. | ||
*/ | ||
v8.setFlagsFromString("--experimental-wasm-return-call"); | ||
|
||
const { readFile } = require("fs/promises"); | ||
const { WASI } = require("wasi"); | ||
const { argv, env } = require("process"); | ||
|
||
const preopens = JSON.parse(env.PREOPENS); | ||
|
||
delete env.PREOPENS; | ||
delete env.NODE_OPTIONS; | ||
|
||
const wasi = new WASI({ | ||
args: argv.slice(2), | ||
env, | ||
preopens, | ||
}); | ||
|
||
const importObject = { wasi_snapshot_preview1: wasi.wasiImport }; | ||
|
||
async function run(filename) { | ||
try { | ||
const wasm = await WebAssembly.compile(await readFile(filename)); | ||
const instance = await WebAssembly.instantiate(wasm, importObject); | ||
|
||
wasi.start(instance); | ||
} catch (err) { | ||
console.error(err.stack); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
run(argv[2]); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.