From b25aab26258c1a3ef3231b10c013a44299e5e0a2 Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Sun, 5 Jun 2022 16:46:50 +0900 Subject: [PATCH] Lipsticks Signed-off-by: yamacir-kit --- README.md | 6 +++--- VERSION | 2 +- include/meevax/memory/collector.hpp | 16 +++------------- src/memory/collector.cpp | 13 +++---------- 4 files changed, 10 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 946a12fc3..dae72dcc3 100644 --- a/README.md +++ b/README.md @@ -103,9 +103,9 @@ sudo rm -rf /usr/local/share/meevax | Target Name | Description |:-------------------|:-- -| `all` (default) | Build shared-library `libmeevax.0.4.39.so` and executable `meevax`. +| `all` (default) | Build shared-library `libmeevax.0.4.40.so` and executable `meevax`. | `test` | Test executable `meevax`. -| `package` | Generate debian package `meevax_0.4.39_amd64.deb`. +| `package` | Generate debian package `meevax_0.4.40_amd64.deb`. | `install` | Copy files into `/usr/local` __(1)__. | `install.deb` | `all` + `package` + `sudo apt install .deb` | `safe-install.deb` | `all` + `test` + `package` + `sudo apt install .deb` @@ -120,7 +120,7 @@ __(1)__ Meevax installed by `make install` cannot be uninstalled by the system's ## Usage ``` -Meevax Lisp System, version 0.4.39 +Meevax Lisp System, version 0.4.40 Usage: meevax [OPTION...] [FILE...] diff --git a/VERSION b/VERSION index 05c945a8f..12fd0b492 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.39 +0.4.40 diff --git a/include/meevax/memory/collector.hpp b/include/meevax/memory/collector.hpp index f20982e6a..bfc62e900 100644 --- a/include/meevax/memory/collector.hpp +++ b/include/meevax/memory/collector.hpp @@ -53,14 +53,8 @@ inline namespace memory template explicit collectable(Pointer const p) - : context { collector::reset(p, deallocator::deallocate) } - { - if (context) - { - auto const lock = std::unique_lock(resource); - objects.try_emplace(this, context); - } - } + : collectable { collector::reset(p, deallocator::deallocate) } + {} explicit collectable(region * region) : context { region } @@ -81,11 +75,7 @@ inline namespace memory template auto reset(Pointer const p) -> void { - if (context = collector::reset(p, deallocator::deallocate)) - { - auto const lock = std::unique_lock(resource); - objects.insert_or_assign(this, context); - } + reset(collector::reset(p, deallocator::deallocate)); } auto reset(region * region) -> void diff --git a/src/memory/collector.cpp b/src/memory/collector.cpp index 5fc18a7a5..a60ae088b 100644 --- a/src/memory/collector.cpp +++ b/src/memory/collector.cpp @@ -41,16 +41,9 @@ inline namespace memory { if (not --reference_count) { - /* ---- NOTE ------------------------------------------------------------- - * - * We're using collect instead of clear to check that all objects can be - * collected. If speed is a priority, clear should be used here. - * - * -------------------------------------------------------------------- */ - - collect(); - collect(); // XXX: vector elements + clear(); + assert(std::size(regions) == 0); assert(std::size(objects) == 0); } } @@ -82,7 +75,7 @@ inline namespace memory { assert(*iter); - if (auto region = *iter; region->assigned()) + if (auto * const region = *iter; region->assigned()) { region_allocator.delete_(region); iter = regions.erase(iter);