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

Web Assembly output #237

Open
JohnnyOpcode opened this issue Feb 11, 2024 · 2 comments
Open

Web Assembly output #237

JohnnyOpcode opened this issue Feb 11, 2024 · 2 comments

Comments

@JohnnyOpcode
Copy link

How much effort to make this output WASM.

Web Assembly has such an interesting future including in containers. QuickJS would be a potent tool in the developers toolbox.

@saghul
Copy link
Contributor

saghul commented Feb 11, 2024

I ported QuickJS to WASI a few years ago: https://github.com/saghul/wasi-lab/blob/master/qjs-wasi/README.md

It's not a lot of work, you can probably take some inspiration from there.

@chqrlie
Copy link
Collaborator

chqrlie commented Feb 11, 2024

There are 3 potential directions here:

  • compiling QuickJS to WASM, which is what @saghul did in his wasi-lab project if I am not mistaken, and other projects too such as https://github.com/bytecodealliance/javy ;
  • making QuickJS produce WASM from JS source code without a full fledged run-time, which is non trivial;
  • adding support in QuickJS for WASM modules, with or without generation of executable code (JIT).

The last direction is on my list, but not a high priority. It would allow instantiating modules compiled from other languages or for which source code is kept private.

Producing WASM directly from JS code is difficult because the language semantics are not well suited to generate typed stack machine byte code, unless the source code uses very specific operators as in asm.js, but no sane programmer produces such code directly, asm.js code is produced by compiler back-end, just like WASM.

WASM is very similar to Java byte code without the class information and with a more flexible interface to call into or be called from the host environment.

GerHobbelt pushed a commit to GerHobbelt/quickjs that referenced this issue May 6, 2024
Make basename imports resolve relative to the file under test.
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

No branches or pull requests

3 participants