Nothrow: Substitutes for standard C++ containers and memory resources, with pluggable pointer storage policies#272
Open
MichaelSteffens17 wants to merge 41 commits into
Open
Conversation
…r comparisons. 1. Emplace — true in-place construction - Added a Node(parent, std::in_place_t, Args&&...) constructor and AllocateNode. Emplace to construct the value_type directly in allocated node memory - Emplace now allocates the node first, constructs in-place, then searches the tree; destroys the node if a duplicate key is found - Eliminates the intermediate stack temporary + move that the old implementation used 2. clear() — no freed-pointer comparisons - Replaced the previous-tracking traversal (which compared freed addresses — UB per [basic.stc]/4) with a descend-to-leaf approach - Each iteration descends left/right until hitting a leaf, nulls the parent's link, then destroys the leaf and backs up to the parent - All pointer comparisons are against live objects only
…o container algorithm without UB. Add combined benchmark.
- Shared insert-position search (FindInsertPosition) - Consolidated key comparison (CompareKey) used in insert/find - Added specialized 2-arg Emplace(...) overloads to avoid pre-construct-and-destroy on duplicates - RebalanceFrom(..., stop_on_stable_height) early-exit for insert flows
… final equality check, and reused that for insert-position search (removing extra compare/branch work). I also added a std::greater<int> regression test in score/shm/map_test.cpp.
…plus OrAbort variants), with std-like neighbor checks and fallback. Sorted fast path via maintained leftmost_/rightmost_ and boundary-aware insertion checks, used in Create(range) and Clone() with rolling hint. Udated score/shm/BENCHMARK.md with the full latest suite results from the current codebase.
…hrow with pointer box renames. Move score/shm/ to score/nothrow/ to reflect that these containers and memory resources are nothrow std-container substitutes, not shared-memory-specific. Rename pointer storage types to reflect their role as encoding boxes: - OffsetPtr -> OffsetBox - NullableOffsetPtr -> NullableOffsetBox - DirectPtr -> RawBox (serves as both Ptr and NullablePtr) - ShmPointerPolicy -> OffsetBoxPolicy - ShmDirectPointerPolicy -> RawBoxPolicy - offset_ptr.h -> pointer_box.h Update all include paths, header guards, namespaces, BUILD targets, documentation, and example code. Add reverse iterators (rbegin/rend/crbegin/crend), ordered lookup methods (count, lower_bound, upper_bound, equal_range), iterator-based erase overloads (const_iterator and range), and equality operators. Fix GetOrInsertDefault to use Emplace instead of constructing an intermediate value_type, avoiding an unnecessary key copy. All new members follow the naming conventions from score/shm/README.md: non-allocating operations use standard snake_case spelling.
Updated the benchmark analysis section to clarify the overhead cause and corrected terminology from 'OffsetBox' to 'OffsetPtr'. Signed-off-by: MichaelSteffens17 <michael.steffens@vector.com>
…ffsetBox. Signed-off-by: MichaelSteffens17 <michael.steffens@vector.com>
Signed-off-by: MichaelSteffens17 <michael.steffens@vector.com>
Signed-off-by: MichaelSteffens17 <michael.steffens@vector.com>
Signed-off-by: MichaelSteffens17 <michael.steffens@vector.com>
…irly to NoBoundsCheck timings. Add boost::interprocess container and completed score::memory::shared::Map benchmarks.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…e remaining bare OS macro check in upstream google_benchmark.
|
The created documentation from the pull request is available at: docu-html |
limdor
reviewed
Jun 17, 2026
Contributor
Author
|
Yes, sorry, will remove that.
Mit freundlichen Grüßen
Michael
‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
Principal Software Development Engineer
PSP4.2
Vector Informatik GmbH
Besucheranschrift: Weissacher Str. 9 | 70499 Stuttgart | Germany
Tel: +49 711 80670-2139<tel:+49%20711%2080670-2139>
***@***.******@***.***>
www.vector.com
<http://www.vector.com/>
Sitz der Gesellschaft: Ingersheimer Str. 24 | 70499 Stuttgart
Handelsregister: Amtsgericht Stuttgart | HRB 17317
Geschäftsführer: Dr. Thomas Beck, Dr. Matthias Traub
‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑‑
From: Xavier Bonaventura ***@***.***>
Sent: Wednesday, June 17, 2026 8:52 AM
To: eclipse-score/baselibs ***@***.***>
Cc: Steffens, Michael ***@***.***>; Author ***@***.***>
Subject: Re: [eclipse-score/baselibs] Nothrow: Substitutes for standard C++ containers and memory resources, with pluggable pointer storage policies (PR #272)
@limdor commented on this pull request.
…________________________________
On map.tar.gz<#272 (comment)>:
What is this zip file? Accidentally checked in?
—
Reply to this email directly, view it on GitHub<#272?email_source=notifications&email_token=B2DY6SV3FJIZIEZ3D3Q27XL5AI52ZA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINJRGMYDSNJUGY22M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#pullrequestreview-4513095465>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/B2DY6SQY75ETT2EMTHYHTXD5AI52ZAVCNFSNUABFKJSXA33TNF2G64TZHM4TIMZTGM3TGNZSHNEXG43VMU5TINRWHAZTMOJSGMZKC5QC>.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS<https://github.com/notifications/mobile/ios/B2DY6SU57KMWLUPA7PJOPQ35AI52ZA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINJRGMYDSNJUGY22M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KUZTPN52GK4S7NFXXG> and Android<https://github.com/notifications/mobile/android/B2DY6SS7KRTW7OBDW4AFRMD5AI52ZA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINJRGMYDSNJUGY22M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>. Download it today!
You are receiving this because you authored the thread.Message ID: ***@***.******@***.***>>
|
Provision a Map's node storage directly from an external buffer, bypassing the templated allocator the same way Vector::CreateWithBuffer does. The map manages an internal free-list pool over the buffer: nodes are carved on insert and recycled on erase, bounding the map to a fixed node count. All pool state is position-independent -- the cell base is stored through the pointer policy (offset-encoded by default) and the free-list head/capacity are indices -- so a buffer-backed map with OffsetSlotPolicy is relocatable and can be both read and mutated across processes mapping the same segment, without the vtable, raw buffer pointer, and process-local upstream singleton that a polymorphic MemoryResource would drag along. - map.h: PoolCell union + CreateWithBuffer(), uses_buffer(), cell_size(), cell_alignment(), required_bytes(); pool-routed AllocateNode/DestroyNode; move ctor/assignment extended to carry pool state. - map_test.cpp: tests for empty/insert/find, capacity bound, freed-cell reuse, move, and OrAbort-on-exhaustion death test. - bounded_containers.h: convert the shared-memory example bundle to the allocator-free buffer API. - README.md: document the cross-process map mutation capability. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The child now inserts new keys into the parent's map, exercising node allocation from the shared free-list pool across processes (not just in-place value updates). The parent observes the grown map (size 3 -> 5) after remapping the segment, confirming pooled allocation is position-independent. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A buffer not aligned to cell_alignment() would misalign the pooled nodes. That is a caller precondition violation, so trap it with std::abort() like the map's other contract checks rather than returning an error. Add a death test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Reflect the child's new insertion step: the README now describes node allocation from the shared free-list pool across processes (map grows 3 -> 5), not just in-place value updates. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Part of #167