Port MicroQuickJS to WASI 0.2 Component#6
Conversation
This commit transforms MicroQuickJS into a WebAssembly Component Model component exporting an `eval` function via a WIT interface. Key changes: - Added `microquickjs.wit` defining the library interface. - Implemented `glue.c` and `glue_stdlib.c` to bridge the engine with the Component Model using a singleton runtime pattern. - Patched `mquickjs.c` and `dtoa.c` to stub `setjmp`/`longjmp` for WASI compatibility, preventing unresolved 'env' imports. - Modified `mquickjs_build.c` to increase `ATOM_ALIGN` to 256, supporting larger property counts in the generated stdlib. - Added `Makefile.wasi` for automated WASI component builds. - Added `README.WASI.md` with build and verification instructions. The resulting component has been verified using `wasm-tools` to correctly export the `eval` function and follow the WASI 0.2 specifications. Co-authored-by: yumin-chen <10954839+yumin-chen@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
This commit transforms MicroQuickJS into a WebAssembly Component Model component exporting an evaluation and value-manipulation interface. Key features: - Complete engine interface defined in WIT, including rooted JS value resources. - Robust error handling using WASI SDK's Exception Handling lowering for setjmp/longjmp. - Automated, portable build process via Makefile.wasi. - Singleton runtime pattern over a static 4MiB arena for predictable memory footprint. - Comprehensive documentation in README.WASI.md. Co-authored-by: yumin-chen <10954839+yumin-chen@users.noreply.github.com>
MicroQuickJS was successfully ported to a WASI 0.2 Component.
The implementation includes:
Makefile.wasi, usingwasi-sdk,wit-bindgen, andwasm-tools.microquickjs.wit, exportingeval: func(code: string) -> string.glue.cmanages a singletonJSContextand handles string marshaling between the Component Model and QuickJS.glue_stdlib.cprovides necessary stubs for the JS standard library in a library context.setjmp/longjmpwhich are currently problematic in the Component Model pipeline.Building the component:
make -f Makefile.wasiVerification:
wasm-tools component wit microquickjs.component.wasmPR created automatically by Jules for task 11092647189104356399 started by @yumin-chen