Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial webassembly support via LLVM #36317

Closed
9 of 17 tasks
brson opened this issue Sep 7, 2016 · 2 comments
Closed
9 of 17 tasks

Initial webassembly support via LLVM #36317

brson opened this issue Sep 7, 2016 · 2 comments
Labels
A-codegen Area: Code generation E-help-wanted Call for participation: Help is requested to fix this issue. O-wasm Target: WASM (WebAssembly), http://webassembly.org/

Comments

@brson
Copy link
Contributor

brson commented Sep 7, 2016

After a lot of work from a number of people, including @badboy and @tomaka it looks like we're home free. Here's a recent summary. And we still need help, and fast. If you want to volunteer, either say which of these you want to tackle here or on the irlo thread and I'll mark you down.

Immediate tasks to get preliminary asmjs support:

  • ignore-emscripten failing tests
  • Merge the fastcomp squash into the rust llvm fork. It may be worth pushing this to a temporary branch on the assumption that it's not going to land easily in Rust, but I actually think this will go pretty smoothly. Squash of fastcomp commit 4105790f1549808c1f1daa5250b4ada5f41a5c02 llvm#50
  • Land PR in Rust that adds asmjs support with new llvm branch and remaining Rust patches
  • Fix jemalloc being disabled when asmjs is enabled. This causes test failures. liballoc_jemalloc needs to only be disabled for targets that don't support it.
  • Add an auto- builder that builds the asmjs target. We probably won't start testing it right away because testing this target is quite slow.
  • Add a dist- builder to create the asmjs target packages.

The first three here somebody else can pick up. I'll probably need to do the last two.

Remaining tasks:

Many of the failing tests are for multithreading. Let's not try to tackle that, but there are probably plenty that can be fixed. Adding the wasm target is probably the most fun. Ask in emscripten about how to test it. Having a mind-blowing demo is going to be important for us to bring the thunder alongside the wasm launch.

@brson brson added E-help-wanted Call for participation: Help is requested to fix this issue. A-codegen Area: Code generation labels Sep 7, 2016
@brson
Copy link
Contributor Author

brson commented Sep 7, 2016

Work on this is happening in this irlo thread.

bors added a commit that referenced this issue Oct 1, 2016
Working asmjs and wasm targets

This patch set results in a working standard library for the asmjs-unknown-emscripten and wasm32-unknown-emscripten targets. It is based on the work of @badboy and @rschulman.

It does a few things:

- Updates LLVM with the emscripten [fastcomp](rust-lang/llvm#50) patches, which include the pnacl IR legalizer and the asm.js backend. This patch is thought not to have any significant effect on existing targets.
- Teaches rustbuild to correctly link C code with emscripten
- Updates gcc-rs to work correctly with emscripten
- Teaches rustbuild to run crate tests for emscripten with node
- Modifies Thread::new to return an error on emscripten, to facilitate debugging a common failure mode
- Modifies libtest to run in single-threaded mode for emscripten
- Ignores a host of tests that don't work yet, mostly dealing with threads and I/O
- Updates libc with wasm32 definitions (presently the same as asmjs)
- Adds a wasm32-unknown-emscripten target that feeds the output of LLVM's asmjs backend through emcc to generate wasm

Notes and caveats:

- This is only known to work with `--enable-rustbuild`.
- The wasm32 target can't be tested correctly yet because of issues in compiletest and limitations in node emscripten-core/emscripten#4542, but hello.rs does seem to work when run on node via the binaryen interpreter
- This requires an up to date installation of the emscripten sdk from its incoming branch
- Unwinding is very broken
- When enabling the emscripten targets jemalloc is disabled for all targets, which results in test failures for the host

Next steps are to fix the jemalloc issue, start building the two emscripten targets on the auto builders, then start producing nightlies.

#36317 tracks work on this.

Fixes #36515
Fixes #36515
Fixes #36356
@sanxiyn sanxiyn added the O-wasm Target: WASM (WebAssembly), http://webassembly.org/ label Dec 30, 2016
@brson
Copy link
Contributor Author

brson commented Jan 3, 2017

Closing this out-dated tracking issue.

@brson brson closed this as completed Jan 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation E-help-wanted Call for participation: Help is requested to fix this issue. O-wasm Target: WASM (WebAssembly), http://webassembly.org/
Projects
None yet
Development

No branches or pull requests

2 participants