Repository navigation
Pin the trivial default construction of unodb::db's inode child slots - #918
Conversation
basic_node_ptr's default constructor leaves tagged_ptr uninitialized so that unodb::db's inode_4/16/256 constructors, which default-initialize children, cost no zero-fill. Nothing checked that: a default member initializer on tagged_ptr, or on in_fake_critical_section's value, keeps both constructors defaulted and passes every alias static_assert, yet makes each of those constructions zero-fill its slots. Assert that in_fake_critical_section<node_ptr>, unodb::db's slot type, is trivially default-constructible. That holds only while node_ptr's constructor is trivial too, so one assert covers both initializers; it fires on either. unodb::olc_db needs no counterpart: C++20 std::atomic value-initializes its slots anyway. Fixes #915. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughThe change adds a compile-time assertion that ChangesInode child slots
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Other Suggested reviewers: Merge Risk: ⚪ Minimal · up to The change adds a compile-time guard for the intended inode child-slot construction contract without changing runtime behavior. No actionable merge-blocking risk is evident. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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. A type is checked at compile time, Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
(LLM agent)
basic_node_ptr's default constructor leavestagged_ptruninitialized so that unodb::db'sinode_4/16/256constructors, which default-initializechildren, cost no zero-fill. Nothing checked that. A default member initializer ontagged_ptr, or onin_fake_critical_section'svalue, would keep both constructors defaulted and pass every existing aliasstatic_assert, yet make each of those constructions zero-fill its slots.This adds a
static_assertthatin_fake_critical_section<node_ptr>, unodb::db's slot type, is trivially default-constructible. That holds only whilenode_ptr's constructor is trivial too, so the one assert fires on either initializer. unodb::olc_db needs no counterpart: C++20std::atomicvalue-initializes its slots anyway.Fixes #915.
Validation at this commit:
./check.shpassed.{}is added to eitherbasic_node_ptr::tagged_ptrorin_fake_critical_section'sT value.🤖 Generated with Claude Code
Summary by CodeRabbit