Conversation
This feature introduces a "bytecode-only" build mode for QuickJS. When `qjsc` is invoked with `-fno-eval -fno-regexp -fno-json -fno-module-loader`, it automatically links against a minified runtime library (`libquickjs-bytecode.a`) where the JS parser and compiler are dead-stripped by LTO. Key changes: - `quickjs.c`: Guarded parser/compiler entry points and their assignments with `#ifndef CONFIG_BYTECODE_ONLY_RUNTIME`. - `quickjs-libc.c`: Guarded source-loading functions (`loadScript`, `evalScript`, `parseExtJSON`), `os.Worker`, and their module registrations to prevent indirect parser invocation. - `qjsc.c`: Added logic to detect the "Bytecode-Only Trigger" and select the appropriate library suffix. Added a compile-time guard to ensure `qjsc` always includes the full engine. - `Makefile`: Added targets for `libquickjs-bytecode.a` and its LTO variant, using a dedicated `.obj-rt` directory for minified objects. - Added `tests/test_bytecode_runtime.js` and a `test-bytecode-runtime` Makefile target for CI validation. Requirements covered: 1-7. Acceptance criteria met: all.
|
👋 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. |
|
Add comprehensive tests that:
|
|
And the following must not be guarded (as they are required for bytecode execution): |
Implement a bytecode-only runtime build mode that allows dead-stripping the parser and compiler from the generated binary when parser-dependent features are disabled. This involves guarding core entry points in
quickjs.candquickjs-libc.c, implementing automatic library selection inqjsc, and adding the necessary build system support and tests.PR created automatically by Jules for task 7784769475260091224 started by @yumin-chen