Repository navigation
test(macro-js): strengthen cross-invocation isolation coverage - #607
Merged
Merged
Conversation
Add regression tests pinning the isolation contract for the QuickJS lifecycle investigation: memory-limit and stack-limit recovery across invocations, interrupt-deadline re-arming after an aborted call, per-invocation console sink rebinding, a 32-iteration consecutive invocation sweep, and builtin-intrinsic reset (Object.prototype, Array.prototype.push, vect, Date.now). Measurement on Bastion (src/main.opy, zh-CN, 8 warm release runs via the throwaway opy-compile-prof harness) shows only one JavaScript invocation per compile: the post-compile hook (~25-50 ms of actual script evaluation inside JS_Eval). The script macros in title/title-cn.opy are defined but never expanded. Per-invocation engine setup is ~0.4-1.6 ms total; of that, JS_NewContext (~54 us) is inherent to a fresh context per invocation, and only JS_NewRuntime + JS_FreeRuntime (~27 us) is shareable. A thread-local shared JSRuntime with fresh JSContext per invocation and a post-teardown JS_RunGC was implemented and verified byte-identical output (sha256 7f53ffa8cf71f600259d329d780f0fc00933bfcb7414b60cb14ea63606546c54); warm median moved from ~288 ms to ~292 ms, inside run-to-run spread. No lifecycle change clears the materiality bar, so production code is unchanged; the profiling attribution (~45 ms) conflated JS_Eval script execution with engine setup. Refs #595
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #595
Tests only; no production change. Investigating #595 showed that no JavaScript lifecycle change is worth making (see the conclusion on the Issue). While doing so the cross-invocation isolation contract from #6 and #295 was exercised more fully than the existing tests do, and those cases are kept: memory-limit recovery, stack-limit recovery, deadline re-arming, a per-invocation console sink, a 32-iteration consecutive sweep, and intrinsic and prototype reset. They pass on
origin/main.Reviewer question: keep only the cases that are not already covered by existing
macro_jstests; drop any that duplicate them.cargo fmt --check,cargo clippy --workspace --all-targets -D warningsandcargo test --workspacepass.