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

Provide support for proposals #367

Open
xtuc opened this Issue May 29, 2018 · 4 comments

Comments

Projects
None yet
4 participants
@xtuc
Copy link
Owner

xtuc commented May 29, 2018

Continuing the discussion on Slack.

Here's a list of proposal that we mentioned.

Sign-extension operators

WebAssembly/design#1178

This impacts the wasm format and type-checker (validation), new instructions needs to be parsed/emitted and checked.

cc @maurobringolf

Multi-value

WebAssembly/design#1146

We can simulate multiple returns values using registers (globals). The transformation itself sounds trivial, but it may have some side effects. Our wast-parser and the typechecker should already work.

More information https://blog.scottlogic.com/2018/05/29/transpiling-webassembly.html

cc @ColinEberhardt

Import/Export of Mutable Globals

WebAssembly/design#1179

This is what is done in Webpack, we don't allow importing globals from JS. The transformation removes the imports and emit "managed" mutable globals instead.

While we can expect compiler to emit such code at the moment, we can do a smaller transformation in Webpack.

cc @xtuc

Other ideas

  • I64 lower to i32, i32?
@dcodeIO

This comment has been minimized.

Copy link

dcodeIO commented May 29, 2018

Sign-extension-ops and mutable-globals are something AssemblyScript can produce behind feature flags, so being able to "transpile" these for environments that do not support these specs yet seems useful, similar to how Babel transpiles things in JS-space. Multi-value hasn't been touched on the AS side yet (don't know if there are other producers emitting them already), but the expectation is that there'll be a flag for these as well (fwiw: implementation will most likely be based on returning object literals that must then be destructured by the callee).

@ColinEberhardt

This comment has been minimized.

Copy link
Collaborator

ColinEberhardt commented May 29, 2018

The first thing I learnt from implementing a partial multi-value transform is that the AST tools need to be improved, that's my current priority!

Following that, I'm interested to see how some of the other later-stage proposals might be transpiled, e.g. https://github.com/WebAssembly/reference-types/blob/master/proposals/reference-types/Overview.md

@xtuc

This comment has been minimized.

Copy link
Owner Author

xtuc commented May 29, 2018

Sign-extension operators

The proposal has made it to phase 4, it's going to be shipped. Should we still polyfill it?

@maurobringolf

This comment has been minimized.

Copy link
Collaborator

maurobringolf commented May 31, 2018

I have done some work on polyfilling sign extension operators #375. I think polyfills for completed proposals can still be useful (at least for us to see what's possible etc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment