xo-reader2 stack: curate memory pool naming

This commit is contained in:
Roland Conybeare 2026-02-03 10:32:43 -05:00
commit 64a780ce19
5 changed files with 20 additions and 15 deletions

View file

@ -55,9 +55,11 @@ namespace xo {
public:
/** create hash map **/
DArenaHashMap(size_type hint_max_capacity,
DArenaHashMap(const std::string & name,
size_type hint_max_capacity,
bool debug_flag = false);
DArenaHashMap(Hash && hash = Hash(),
DArenaHashMap(const std::string & name,
Hash && hash = Hash(),
Equal && eq = Equal(),
size_type hint_max_capacity = 0,
bool debug_flag = false);
@ -196,9 +198,10 @@ namespace xo {
};
template <typename Key, typename Value, typename Hash, typename Equal>
DArenaHashMap<Key, Value, Hash, Equal>::DArenaHashMap(size_type hint_max_capacity,
DArenaHashMap<Key, Value, Hash, Equal>::DArenaHashMap(const std::string & name,
size_type hint_max_capacity,
bool debug_flag)
: DArenaHashMap(Hash(), Equal(), hint_max_capacity, debug_flag)
: DArenaHashMap(name, Hash(), Equal(), hint_max_capacity, debug_flag)
{
}
@ -207,13 +210,14 @@ namespace xo {
* last 16 bytes will be copy of first 16 bytes
*/
template <typename Key, typename Value, typename Hash, typename Equal>
DArenaHashMap<Key, Value, Hash, Equal>::DArenaHashMap(Hash && hash,
DArenaHashMap<Key, Value, Hash, Equal>::DArenaHashMap(const std::string & name,
Hash && hash,
Equal && eq,
size_type hint_max_capacity,
bool debug_flag)
: hash_{std::move(hash)},
equal_{std::move(eq)},
store_{"arenahashmap", lub_exp2(lub_group_mult(hint_max_capacity))},
store_{name, lub_exp2(lub_group_mult(hint_max_capacity))},
debug_flag_{debug_flag}
{
}

View file

@ -5,6 +5,7 @@
#pragma once
#include <functional>
#include <string_view>
#include <cstddef>

View file

@ -32,11 +32,11 @@ namespace xo {
n_slot_{group_exp2.second * c_group_size},
control_{control_vector_type::map
(xo::mm::ArenaConfig{
.name_ = name,
.name_ = name + "-ctl",
.size_ = control_size(n_slot_)})},
slots_{slot_vector_type::map
(xo::mm::ArenaConfig{
.name_ = name,
.name_ = name + "-slots",
.size_ = n_slot_ * sizeof(value_type)})}
{
/* here: arenas have allocated address range, but no committed memory yet */

View file

@ -75,7 +75,7 @@ namespace xo {
mapped_range_{reserved_range_.prefix(0)},
occupied_range_{mapped_range_.prefix(0)},
input_range_{occupied_range_.prefix(0)},
pinned_spans_{}
pinned_spans_{DArenaVector<span_type>::map(ArenaConfig().with_name(config.name_ + "-pins"))}
{
}

View file

@ -24,7 +24,7 @@ namespace xo {
{
using HashMap = DArenaHashMap<int, int>;
HashMap map;
HashMap map("utest");
REQUIRE(map.empty());
REQUIRE(map.size() == 0);
@ -36,7 +36,7 @@ namespace xo {
{
using HashMap = DArenaHashMap<int, int>;
HashMap map(257);
HashMap map("utest", 257);
REQUIRE(map.empty());
REQUIRE(map.size() == 0);
@ -49,7 +49,7 @@ namespace xo {
{
using HashMap = DArenaHashMap<int, int>;
HashMap map;
HashMap map("utest");
REQUIRE(map.empty());
REQUIRE(map.size() == 0);
@ -209,7 +209,7 @@ namespace xo {
*/
for (std::uint32_t n = 0; n <= 8; ) {
HashMap hash_map;
HashMap hash_map("utest");
auto test_fn = [&rgen, &hash_map](bool dbg_flag,
std::uint32_t n)
@ -245,7 +245,7 @@ namespace xo {
using HashMap = DArenaHashMap<int, int>;
HashMap map;
HashMap map("utest");
// copy keys here so we can print stuff
std::vector<int> key_v;
@ -336,7 +336,7 @@ namespace xo {
{
using HashMap = DArenaHashMap<std::string_view, int>;
HashMap map(1024);
HashMap map("utest", 1024);
REQUIRE(map.verify_ok());