Skip to content

Clean up portable memory definitions #973

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

Merged
merged 4 commits into from
Dec 4, 2019
Merged

Clean up portable memory definitions #973

merged 4 commits into from
Dec 4, 2019

Conversation

dcodeIO
Copy link
Member

@dcodeIO dcodeIO commented Nov 23, 2019

Related: #971

This PR cleans up the portable memory definitions by, well, removing them completely. These have been of very little use anyway because there isn't a good memory story in JS. The compiler now uses bindings to Binaryen's _malloc etc. directly, which is much clearer. There's more to consider once we want to compile the compiler to Wasm, but leaving that for later.

@dcodeIO
Copy link
Member Author

dcodeIO commented Dec 4, 2019

With WebAssembly/binaryen#2476 merged and Binaryen updated, the last commit introduces the concept of a portable d.ts.

What this does is if compiling with tsc, it will pick up the js file next to the d.ts normally, while asc ignores the js file and uses the d.ts as if it was a normal AssemblyScript file, in turn making a WebAssembly import of all the declares. As such, when compiling to WebAssembly, we can provide binaryen.js (no matter if compiled as JS or Wasm) as an import named binaryen with no need for special glue code, with the JS engine acting as a linker for Wasm exports to Wasm imports directly.

@dcodeIO dcodeIO merged commit b1478ee into master Dec 4, 2019
@dcodeIO dcodeIO deleted the portable-cleanup branch January 1, 2020 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant