Separate lib/memory#384
Conversation
Correctly link the abortsuponexception library to cause the necessary abort.
score/memory contained many libraries that are normally used for string manipulation and not for memory operations. Moves these libraries to memory/string_manipulation. This breaks public API. Users will have to adapt.
|
The created documentation from the pull request is available at: docu-html |
score/memory contained many libraries that are normally used for string manipulation and not for memory operations. Moves these libraries to memory/string_manipulation. This breaks public API. Users will have to adapt.
AtomicIndirector is a helper library to enable testing atomics. It should reside in score/concurrency where other helpers for concurrency-related functionality reside. Moves the AtomicIndirector to lib/concurrency. This is a breaking API change that users must adapt to.
AtomicIndirector is a helper library to enable testing atomics. It should reside in score/concurrency where other helpers for concurrency-related functionality reside. Moves the AtomicIndirector to lib/concurrency. This is a breaking API change that users must adapt to.
This test should not be visible outside the package. The default visibility is sufficient.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bf55f1d to
5dee292
Compare
|
|
||
| pointer allocate(size_type n) | ||
| { | ||
| return pointer{static_cast<T*>(resource_->allocate(n * sizeof(T), alignof(T)))}; |
There was a problem hiding this comment.
either this needs to be guarded against an overflow or the test https://github.com/eclipse-score/baselibs/blob/main/score/containers/dynamic_array_test.cpp#L333 needs to be adapted. I would recommend the first option.
There was a problem hiding this comment.
Pull request overview
This PR refactors the former score/memory utilities by relocating atomic-indirection/mocking utilities into score/concurrency and string utilities into score/string_manipulation, as a preparatory step for moving remaining score/memory/shared communication-specific code to the communication repository (per #371).
Changes:
- Moved atomic indirection + mock support from
score/memory/sharedintoscore/concurrencyand updated dependents (MeyerSingleton, logging wait-free stack, safe_atomics, shared-memory region map tests). - Moved
StringLiteral,StringComparisonAdaptor, andLazySplitStringViewintoscore/string_manipulationand updated JSON/logging users and Bazel targets. - Updated container tests to use generic “fancy pointer” allocator/memory-resource test doubles, and added shared-memory “compatibility tests” to keep coverage for production shared-memory allocators.
Reviewed changes
Copilot reviewed 52 out of 52 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| score/utils/meyer_singleton/meyer_singleton.h | Switch default atomic indirector to score/concurrency. |
| score/utils/meyer_singleton/meyer_singleton_test.cpp | Update tests to use concurrency atomic mock/indirector. |
| score/utils/meyer_singleton/BUILD | Bazel deps moved from memory/shared to concurrency. |
| score/string_manipulation/string_literal.h | Update include guard to string_manipulation. |
| score/string_manipulation/string_comparison_adaptor.h | Move namespace to string_manipulation + std::hash key update. |
| score/string_manipulation/string_comparison_adaptor.cpp | Update include + namespace to string_manipulation. |
| score/string_manipulation/string_comparison_adaptor_test.cpp | Update include + namespace to string_manipulation. |
| score/string_manipulation/split_string_view.h | Move namespace + include guard to string_manipulation. |
| score/string_manipulation/split_string_view.cpp | Update include + namespace to string_manipulation. |
| score/string_manipulation/split_string_view_test.cpp | Update include + namespace to string_manipulation. |
| score/string_manipulation/BUILD | Add Bazel targets for moved string utilities + tests. |
| score/mw/log/runtime.h | Update MeyerSingleton friend atomic indirector type. |
| score/mw/log/logger_container.h | Switch wait-free stack atomic indirector to concurrency. |
| score/mw/log/detail/wait_free_stack/wait_free_stack.h | Switch atomic indirector include/default to concurrency. |
| score/mw/log/detail/wait_free_stack/wait_free_stack_test.cpp | Update atomic mocks/indirector mocks to concurrency. |
| score/mw/log/detail/wait_free_stack/BUILD | Bazel deps moved from memory/shared to concurrency. |
| score/mw/log/configuration/target_config_reader.cpp | Switch splitter include/type to string_manipulation. |
| score/mw/log/configuration/BUILD | Depend on score/string_manipulation:split_string_view. |
| score/memory/shared/memory_region_map.h | Switch atomic indirector include/default to concurrency. |
| score/memory/shared/memory_region_map.cpp | Explicit template instantiations updated to concurrency indirectors. |
| score/memory/shared/memory_region_map_test.cpp | Update atomic mocks/indirector mocks to concurrency. |
| score/memory/shared/containers_compatibility_test.cpp | New: compatibility tests with production shared-memory allocators. |
| score/memory/shared/BUILD | Remove atomic indirector targets; add compatibility test; switch deps to concurrency. |
| score/memory/BUILD | Remove moved string utility targets/tests (now in string_manipulation). |
| score/language/safecpp/safe_math/BUILD | Adjust test visibility. |
| score/language/safecpp/safe_atomics/try_atomic_add.h | Switch atomic indirector include/default to concurrency. |
| score/language/safecpp/safe_atomics/try_atomic_add_test.cpp | Update atomic mock/indirector mock to concurrency. |
| score/language/safecpp/safe_atomics/BUILD | Bazel deps moved from memory/shared to concurrency. |
| score/language/safecpp/aborts_upon_exception/BUILD | Add missing local dep for the test. |
| score/json/internal/model/BUILD | Depend on string_manipulation comparison adaptor. |
| score/json/internal/model/any.h | Update map key type to score::string_manipulation::StringComparisonAdaptor. |
| score/json/detailed_design/class_diagram.puml | Update design diagram references to new namespace. |
| score/containers/test/fancy_pointer_allocator.h | New: generic fancy-pointer allocator for container tests. |
| score/containers/test/fancy_pointer_allocator.cpp | New: TU for fancy-pointer allocator. |
| score/containers/test/fancy_pointer_allocator_test.cpp | New: unit tests for fancy-pointer allocator. |
| score/containers/test/fake_memory_resource.h | New: generic pmr memory_resource test double. |
| score/containers/test/fake_memory_resource.cpp | New: implementation for fake memory resource. |
| score/containers/test/fake_memory_resource_test.cpp | New: unit tests for fake memory resource. |
| score/containers/test/BUILD | Add new test libs/tests + enable unit test suite. |
| score/containers/test/allocator_test_type_helpers.h | Switch allocator test helper from shared-memory allocators to generic fancy-pointer allocator. |
| score/containers/non_relocatable_vector_test.cpp | Update tests to use generic fake resource + fancy allocator. |
| score/containers/non_relocatable_vector_special_member_funcs_test.cpp | Update tests to use generic fake resource + fancy allocator; API rename for deallocation getter. |
| score/containers/non_relocatable_vector_emplace_back_test.cpp | Update tests to use generic fake resource + fancy allocator. |
| score/containers/dynamic_array_test.cpp | Update tests to use generic fake resource + fancy allocator. |
| score/containers/BUILD | Wire container unit tests to new test libs; include subpackage test suite. |
| score/concurrency/i_atomic.h | Move IAtomic interface to score::concurrency + update include guard. |
| score/concurrency/BUILD | Add atomic interface/indirector/mock targets + add atomic tests to suite. |
| score/concurrency/atomic_mock.h | Move atomic mock to concurrency namespace and includes. |
| score/concurrency/atomic_mock.cpp | Update include path to concurrency. |
| score/concurrency/atomic_indirector.h | Move atomic indirector to concurrency namespace and includes. |
| score/concurrency/atomic_indirector.cpp | Update include path to concurrency. |
| score/concurrency/atomic_indirector_test.cpp | Update tests to concurrency includes/namespace. |
Comments suppressed due to low confidence (5)
score/string_manipulation/string_comparison_adaptor.h:99
- The clang-tidy suppression comment is misspelled as
NOL INT NEX TLINE, so it won't be recognized and the intendedscore-hash-noexceptsuppression won’t apply.
score/string_manipulation/split_string_view.cpp:78 - Spelling in the assertion message:
seperatorshould beseparator(matches standard spelling and improves searchability).
score/string_manipulation/split_string_view.cpp:85 - Spelling in the assertion message:
seperatorshould beseparator(matches standard spelling and improves searchability).
score/string_manipulation/split_string_view.cpp:109 - Spelling in the assertion message:
seperatorshould beseparator(matches standard spelling and improves searchability).
score/string_manipulation/split_string_view_test.cpp:16 gmock/gmock.his included but not used in this test file; removing it reduces compile dependencies.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Fixed all review comments in individual commits. I'll rebase once people are happy with the fixes. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…terAllocator Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…hared Also add a default constructor and null-resource fallback (malloc/free) to FancyPointerAllocator, mirroring PolymorphicOffsetPtrAllocator's behavior for a default-constructed/unconnected allocator. This is required by the GetAllocator() SFINAE dispatch in allocator_test_type_helpers.h, which default-constructs the allocator whenever it is rebound to a different element type than the one it was originally instantiated with. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…/memory/shared Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…st from score/memory/shared Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…funcs_test from score/memory/shared Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…core/containers Adds containers_compatibility_test.cpp which exercises DynamicArray and NonRelocatableVector with the real ManagedMemoryResource-derived test resources (MyMemoryResource, MyBoundedMemoryResource) and PolymorphicOffsetPtrAllocator, guarding against regressions now that score/containers' own unit tests use generic test doubles instead of these production types. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
94b929f to
9615cb4
Compare
|
Rebased review commits after verbal approval from @bemerybmw |
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| ":error", | ||
| "//score/concurrency:atomic_indirector", |
There was a problem hiding this comment.
consistency: the whole repo uses @score_baselibs/…
There was a problem hiding this comment.
I wonder if we should change this repo to use // instead. Any benefits of having @score_baselibs everywhere?
score/memory contained code that conceptually should reside in score/concurrency and score/string_manipulation.
Moves this code in the correct places.
This is a preparatory step for moving score/memory/shared over to score_communication.
Breakages of the public API are clearly marked in the commit messages.
@4og if you prefer a migration path let's discuss the best way in person. I left it out for the moment, since the adjustments are trivial and therefore having no migration path but a section in the release notes is also an option.
Related to #371