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 an extern block with #[link(name)]. Then mir2wasm will emit imports for each of the functions in the block from the module name.
Using this new capability, rustrt.js now provides a panic 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.
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.