Problem / 问题
Reference releases and Runtime operation boundaries repeatedly enter deferred cleanup even when no work is pending. Heap releases also drain an empty zero-reference queue and return empty cleanup payloads. Deferred work includes frame/backtrace restoration, so scheduling and priority are correctness constraints.
引用释放与 Runtime 操作边界频繁进入空的延迟清理流程;Heap 减引用后也常清空一个空队列、传递空清理结果。延迟队列还负责帧/回溯恢复,必须保留现有顺序与安全检查点。
Plan / 方案
- Encapsulate deferred operations and pending/draining state, preserve front/back priority, add a cheap empty fast path and an unwind-safe single-drainer guard, acquire Runtime state before dequeue, and stop immediately after deferring a blocked release. Share operation application between normal draining and Runtime teardown.
- Add one internal heap release entry returning optional cleanup; retain existing public cleanup-returning APIs as wrappers. Check the whole zero queue before skipping cleanup. Runtime skips applying absent cleanup.
先封装延迟队列、统一释放/恢复操作、消除空队列与借用失败后的无效重试;再增加 Heap 可选清理结果,复用原有递减/销毁逻辑,不改变公开接口。
Keep existing operation entry/exit checkpoints, cycle GC, weak-reference/finalization behavior, validation and reference-count checks. No outermost-only batching or postponed-to-script-end destruction.
保留已有检查点、循环 GC、弱引用/finalization 行为及引用有效性检查,不把销毁批量推迟到脚本结束。
References / 参考:
Stack and validation / 分支与验证
Base personal-fork PR #3: Eric-Song-Nop#3 (perf/primitive-coercion-fast-path, 06c9229). Implementation PR targets that branch in Eric-Song-Nop/quickjs-oxide. Issues remain here because the personal fork has Issues disabled.
Two separately measurable implementation commits; remote Herdr/PocketLab builds, workspace tests, full Test262 outcome comparison, boundary checks, fresh diagnostic counts/CPU samples, and alternating uninstrumented release measurements. Include idle release, cascading destruction, deferred borrow conflicts, enqueue-during-drain, unwind/reset, priority, teardown, weak-reference and cycle-GC regressions. Preserve all evidence and report uncertain/regressing workloads explicitly.
Problem / 问题
Reference releases and Runtime operation boundaries repeatedly enter deferred cleanup even when no work is pending. Heap releases also drain an empty zero-reference queue and return empty cleanup payloads. Deferred work includes frame/backtrace restoration, so scheduling and priority are correctness constraints.
引用释放与 Runtime 操作边界频繁进入空的延迟清理流程;Heap 减引用后也常清空一个空队列、传递空清理结果。延迟队列还负责帧/回溯恢复,必须保留现有顺序与安全检查点。
Plan / 方案
先封装延迟队列、统一释放/恢复操作、消除空队列与借用失败后的无效重试;再增加 Heap 可选清理结果,复用原有递减/销毁逻辑,不改变公开接口。
Keep existing operation entry/exit checkpoints, cycle GC, weak-reference/finalization behavior, validation and reference-count checks. No outermost-only batching or postponed-to-script-end destruction.
保留已有检查点、循环 GC、弱引用/finalization 行为及引用有效性检查,不把销毁批量推迟到脚本结束。
References / 参考:
Stack and validation / 分支与验证
Base personal-fork PR #3: Eric-Song-Nop#3 (
perf/primitive-coercion-fast-path, 06c9229). Implementation PR targets that branch in Eric-Song-Nop/quickjs-oxide. Issues remain here because the personal fork has Issues disabled.Two separately measurable implementation commits; remote Herdr/PocketLab builds, workspace tests, full Test262 outcome comparison, boundary checks, fresh diagnostic counts/CPU samples, and alternating uninstrumented release measurements. Include idle release, cascading destruction, deferred borrow conflicts, enqueue-during-drain, unwind/reset, priority, teardown, weak-reference and cycle-GC regressions. Preserve all evidence and report uncertain/regressing workloads explicitly.