From 256b79af78adc1d43c78a1ff0d58ab98ef6affdf Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Sun, 3 Nov 2024 15:09:28 +0900 Subject: [PATCH] Rename `marked_objects` to `reachables` Signed-off-by: yamacir-kit --- README.md | 6 +++--- VERSION | 2 +- include/meevax/memory/collector.hpp | 22 +++++++++++----------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 0422669f4..499f00bf3 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ Procedures for each standard are provided by the following R7RS-style libraries: cmake -B build -DCMAKE_BUILD_TYPE=Release cd build make package -sudo apt install build/meevax_0.5.258_amd64.deb +sudo apt install build/meevax_0.5.259_amd64.deb ``` or @@ -122,9 +122,9 @@ sudo rm -rf /usr/local/share/meevax | Target Name | Description |-------------|------------- -| `all` | Build shared-library `libmeevax.0.5.258.so` and executable `meevax` +| `all` | Build shared-library `libmeevax.0.5.259.so` and executable `meevax` | `test` | Test executable `meevax` -| `package` | Generate debian package `meevax_0.5.258_amd64.deb` +| `package` | Generate debian package `meevax_0.5.259_amd64.deb` | `install` | Copy files into `/usr/local` directly ## Usage diff --git a/VERSION b/VERSION index 2b772e508..742b1a139 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.258 +0.5.259 diff --git a/include/meevax/memory/collector.hpp b/include/meevax/memory/collector.hpp index 45358e23a..cb5166106 100644 --- a/include/meevax/memory/collector.hpp +++ b/include/meevax/memory/collector.hpp @@ -531,7 +531,7 @@ inline namespace memory static auto mark() noexcept -> pointer_set { - auto is_root_object = [begin = objects.begin()](mutator const* given) // TODO INEFFICIENT! + auto is_root = [begin = objects.begin()](mutator const* given) { /* If the given mutator is a non-root object, then an object containing @@ -564,22 +564,22 @@ inline namespace memory } }; - auto marked_objects = pointer_set(); + auto reachables = pointer_set(); for (auto const& mutator : mutators) { assert(mutator); assert(mutator->unsafe_get()); - if (auto object = mutator->unsafe_get(); not marked_objects.contains(object) and is_root_object(mutator)) + if (auto object = mutator->unsafe_get(); not reachables.contains(object) and is_root(mutator)) { auto queue = std::queue(); for (queue.push(object); not queue.empty(); queue.pop()) { - if (not marked_objects.contains(queue.front())) + if (not reachables.contains(queue.front())) { - marked_objects.insert(queue.front()); + reachables.insert(queue.front()); for (auto const& mutator : mutators_view(queue.front()->view())) { @@ -593,15 +593,15 @@ inline namespace memory } } - return marked_objects; + return reachables; } - static auto sweep(pointer_set && marked_objects) -> void + static auto sweep(pointer_set && reachables) -> void { - for (auto marked_object : marked_objects) + for (auto reachable : reachables) { - assert(objects.contains(marked_object)); - objects.erase(marked_object); + assert(objects.contains(reachable)); + objects.erase(reachable); } for (auto object : objects) @@ -609,7 +609,7 @@ inline namespace memory delete object; } - objects.swap(marked_objects); + objects.swap(reachables); } }; } // namespace memory