feat: implement bun:jsc heapStats with Perry heap counters - #9760
feat: implement bun:jsc heapStats with Perry heap counters#9760proggeramlug wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (21)
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughAdds Changesbun:jsc heapStats
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This adds bun:jsc.heapStats() with documented Perry-specific heap and allocator counters. The supported import paths and result shape are covered, with no current merge-blocking risk identified. Sequence Diagram(s)sequenceDiagram
participant Program
participant nm_dispatch_bun
participant js_bun_jsc_heap_stats
participant heap_stats
Program->>nm_dispatch_bun: call bun:jsc.heapStats
nm_dispatch_bun->>js_bun_jsc_heap_stats: forward compatibility argument
js_bun_jsc_heap_stats->>heap_stats: collect heap and allocator counters
heap_stats-->>js_bun_jsc_heap_stats: return HeapStats
js_bun_jsc_heap_stats-->>Program: return heapStats report
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Out of Scope Changes checkExplanation The core changes match issue Full details: Docstring CoverageExplanation Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 18 files. (3 skipped: 3 unsupported.)
✨ Finishing Touches 💡 1🛠️ 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 |
|
Landed on |
bun:jscimports previously warned that the module could not be resolved and failed at runtime. Register the module and implementheapStats()/heapStats(true)through the same native callable export for static imports, dynamic imports, andrequire().The report contains the ten requested keys, with counters from a per-thread walk of Perry's arenas and tracked malloc GC cells. The walk allocates no JavaScript objects and retains only numeric results; the report and its nested objects are rooted while being built. Type counts use Perry's GC type names, protected counts approximate pinned cells, and the
mimalloccompatibility object contains Perry allocator counters. External bytes and protected globals are explicitly documented as untracked/zero; the optional argument is ignored and collection is not forced. The documentation explains these differences from Bun's HeapStats contract.Validation:
number,number,object,object,objectwithout an unresolved-import warning.PERRY_CONCAT_SITE_CACHE(fixed separately by fix(cache): register concat switch and explain codegen inputs #9748); 1083 compiler tests passed.Fixes #9743. No version bump.
Summary by CodeRabbit
New Features
bun:jsc.heapStats()across static, dynamic, namespace, and CommonJS imports.Documentation
bun:jscmodule andheapStats()API, including Perry-specific metric details.bun:jsc,connect, andlisten.Bug Fixes
#9743.