fix(codegen): initialize missing cells in reused boxed declarations - #10049
proggeramlug wants to merge 4 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (8)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe code generator now initializes missing boxed cells when a continuation reuses a boxed local slot. New code-generation tests and async generator fixtures cover delegation, closures, control flow, TDZ behavior, recursion, and shared bindings. ChangesGenerator continuation box initialization
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The reused boxed-cell initialization path and its async-generator regression coverage do not leave an identified merge-blocking risk. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 26.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 7 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Native validation found the initial The small fixture's retained LLVM identifies the actual path: The follow-up restores the original preallocation implementation and guards |
Closes #10048.
Problem and fix
An async-generator delegated loop emits the local callback's declaration in
more than one continuation. The first emitted declaration allocates its box;
the ordinary existing-local / hoisted-var reuse guard routes later copies
straight through LocalSet. On a resumed path the stack slot exists but still
holds the entry undefined sentinel, so initialization and capture use no cell.
Before a reused, non-preallocated boxed declaration evaluates its initializer,
check whether the pointer slot still contains that sentinel. Materialize the
missing cell when needed and preserve an existing live cell unchanged. This
keeps hoisted-var/parameter binding identity and handles self-capturing
initializers. Module globals, preallocated cells, and ordinary unboxed slots
stay on their existing paths; specialized async control cell types are kept.
No environment switch or runtime ABI change is introduced.
Independent branch from main
603b074ac. Neither #10042 nor #10046 nor anyapplication bundle, extraction, credentials, or network is needed for testing.
Validation
eb52a581ewas rejected afternative O0 failed under both default and compact GC. That implementation has
been removed; the original PreallocateBoxes behavior is restored.
with and without an initializer, requiring conditional allocation into the
same entry-initialized slot.
implementation: normal debug profile, one thread, 16.01s execution.
and compact GC, Wasm host enabled, byte-for-byte against pinned Node.
The compiler and all nine coherent provider archives are frozen at
81b47b47cace5b150edde32059ff272a3a19eca5. Compiler build: 10m30s;runtime graph: 9m56s; each had a 15-minute bound.
f56ef0f9638e333be994db6de8bdac00f90b587echanges only Rustcomments and test setup relative to that native toolchain. Its exact fixtures
were rerun with the frozen pair (12 passes). This does not claim a newly built
compiler at the test-only head. The compiler implementation is unchanged.
failure, now independently reported with a reproducer in codegen: captured let loses its TDZ on the second loop iteration #10051. A six-case
A/B reproduces identical failure at O0/Oz on old main
53df2c671, pre-fixf3e8d5d1a, and fixed81b47b47c. This PR's TDZ/no-initializer/recursioncontrol uses separate invocations; retained per-iteration callbacks and
shared hoisted-var bindings remain covered. No failing behavior is claimed fixed.
failure, two CI-only skips. Compile-tier lint is explicitly skipped locally.
The two-line file-cap overflow has been corrected with a comment-only move
(
let_stmt.rs: 1,998 lines); formatting and file-cap checks pass.insert an allocating synchronous loop between getter creation, wrapper
capture, and later invocation. Each run verifies 224 loop polls, 231 copying
minors, and 13,778 moved objects, with from-space protection and evacuation
verification enabled. This uses the same frozen
81b47b47ctoolchain; it issupplementary local evidence, not a claim that CI runs this extra witness.
Completed current-head Linux CI
Run 34576434651
at exact head
f56ef0f9638e333be994db6de8bdac00f90b587eis complete. Both newgenerator fixtures executed and passed (shards 2 and 5). Check, warnings,
scoped E2E, gap shards 1/6, and GC stress passed. The GC matrix reports
429 PASS / 159 UNVERIFIED / 0 FAIL; unverified cells are not passes.
CI is not all green. A single attribution pass against the exact base-main
603b074ace01464bc66fc07cc8d532f26ccf5a0fpush run 34565492075
finds the same failures:
native_stack::tests::stack_top_respects_custom_thread_stack_sizes,the same
bound must belong to this workerassertion at native_stack.rs:53and unwrap at :60; 3,504 passed / 1 failed / 4 ignored.
base main, including the webcrypto threadpool timeout. Seven are snapshot
regressions and three are already baseline-accepted parity failures. Comparison
covers reported exit codes and first/last printed output lines, not full stdout.
pr-gateis the fan-in of those failed jobs, not an additional test failure.No baseline or tests were suppressed and no CI rerun was requested. This remains
ready for maintainer review; the separate full application rebuild is pending.
Native fixtures cover delegated loops, retained iteration callbacks, empty
delegates, ordinary yield/await, recursion, TDZ, and shared hoisted-var bindings.
This is not a claim that the full application works or meets its size target.
The merge train can perform the patch-version bump.