Enable calls to JS. Update some tests. #61
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR enables a few more tests that were previously xfailed or disabled during one of my recent changes.
The most significant change is that we now have a way of importing arbitrary functions from the host. See
tinycore.rs
for an example of how this works. Basically, you create anextern
block with#[link(name)]
. Then mir2wasm will emit imports for each of the functions in the block from the modulename
.Using this new capability,
rustrt.js
now provides apanic
function, which is called by Rust when code panics. Right now this just throws a Javascript error, but we could improve this significantly.Unfortunately, the binaryen interpreter doesn't give us a way to import Javascript (as far as I know), so we can't call into
rustrt.js
. Because of this, I've disabled running in binaryen in the tests. This means from now on our only supported mode of execution is in a proper JS VM.This change also includes some miscellaneous cleanup and refactoring, although more is still needed. Finally, I pointed the binaryen submodule at my own fork because I need a small fix to run on one of my Linux machines, but we can't merge this into binaryen proper because of ASAN failures.