diff options
author | Alon Zakai <azakai@google.com> | 2019-06-15 12:04:16 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-15 12:04:16 -0700 |
commit | 1cd34c211dffa66fa2f2e45f3f9291e8ad836e07 (patch) | |
tree | 74fc2c7c15872d2c23d8b7eed7865486069549ce /src/passes/pass.cpp | |
parent | 22ba24118ef04720e6c7605dbaf90b22cdba006f (diff) | |
download | binaryen-1cd34c211dffa66fa2f2e45f3f9291e8ad836e07.tar.gz binaryen-1cd34c211dffa66fa2f2e45f3f9291e8ad836e07.tar.bz2 binaryen-1cd34c211dffa66fa2f2e45f3f9291e8ad836e07.zip |
Bysyncify: async transform for wasm (#2172)
This adds a new pass, Bysyncify, which transforms code to allow unwind and rewinding the call stack and local state. This allows things like coroutines, turning synchronous code asynchronous, etc.
The new pass file itself has a large comment on top with docs.
So far the tests here seem to show this works, but this hasn't been tested heavily yet. My next step is to hook this up to emscripten as a replacement for asyncify/emterpreter, see emscripten-core/emscripten#8561
Note that this is completely usable by itself, so it could be useful for any language that needs coroutines etc., and not just ones using LLVM and/or emscripten. See docs on the ABI in the pass source.
Diffstat (limited to 'src/passes/pass.cpp')
-rw-r--r-- | src/passes/pass.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/passes/pass.cpp b/src/passes/pass.cpp index c29bb1e1a..b46a03b5e 100644 --- a/src/passes/pass.cpp +++ b/src/passes/pass.cpp @@ -77,6 +77,9 @@ void PassRegistry::registerPasses() { registerPass("avoid-reinterprets", "Tries to avoid reinterpret operations via more loads", createAvoidReinterpretsPass); + registerPass("bysyncify", + "async/await style transform, allowing pausing and resuming", + createBysyncifyPass); registerPass( "dae", "removes arguments to calls in an lto-like manner", createDAEPass); registerPass("dae-optimizing", |