Rename [gs]et_meta_data to [gs]et_metaentry.

Co-authored-by: David Chisnall <David.Chisnall@microsoft.com>
This commit is contained in:
Nathaniel Wesley Filardo
2021-08-24 14:07:57 +01:00
committed by Nathaniel Wesley Filardo
parent 70c3e00df7
commit f913f8b820
7 changed files with 18 additions and 18 deletions

View File

@@ -84,7 +84,7 @@ namespace snmalloc
// external_pointer, for example) will not attempt to follow this
// "Metaslab" pointer.
MetaEntry t(reinterpret_cast<Metaslab*>(next.unsafe_ptr()), nullptr, 0);
Pagemap::set_meta_data(address_cast(base), 1, t);
Pagemap::set_metaentry(address_cast(base), 1, t);
return;
}
@@ -107,7 +107,7 @@ namespace snmalloc
if (align_bits >= MIN_CHUNK_BITS)
{
const MetaEntry& t =
Pagemap::template get_meta_data<false>(address_cast(base));
Pagemap::template get_metaentry<false>(address_cast(base));
return CapPtr<FreeChunk, CBChunk>(
reinterpret_cast<FreeChunk*>(t.get_metaslab()));
}

View File

@@ -71,7 +71,7 @@ namespace snmalloc
* to access a location that is not backed by a chunk.
*/
template<bool potentially_out_of_range = false>
SNMALLOC_FAST_PATH static const MetaEntry& get_meta_data(address_t p)
SNMALLOC_FAST_PATH static const MetaEntry& get_metaentry(address_t p)
{
return pagemap.template get<potentially_out_of_range>(p);
}
@@ -80,7 +80,7 @@ namespace snmalloc
* Set the metadata associated with a chunk.
*/
SNMALLOC_FAST_PATH
static void set_meta_data(address_t p, size_t size, MetaEntry t)
static void set_metaentry(address_t p, size_t size, MetaEntry t)
{
for (address_t a = p; a < p + size; a += MIN_CHUNK_SIZE)
{
@@ -281,7 +281,7 @@ namespace snmalloc
}
MetaEntry t(meta, remote, sizeclass);
Pagemap::set_meta_data(address_cast(p), size, t);
Pagemap::set_metaentry(address_cast(p), size, t);
return {p, meta};
}
};

View File

@@ -18,12 +18,12 @@ namespace snmalloc
concept ConceptBackendMeta =
requires(address_t addr, size_t sz, MetaEntry t)
{
{ Meta::set_meta_data(addr, sz, t) } -> ConceptSame<void>;
{ Meta::set_metaentry(addr, sz, t) } -> ConceptSame<void>;
{ Meta::template get_meta_data<true>(addr) }
{ Meta::template get_metaentry<true>(addr) }
-> ConceptSame<const MetaEntry&>;
{ Meta::template get_meta_data<false>(addr) }
{ Meta::template get_metaentry<false>(addr) }
-> ConceptSame<const MetaEntry&>;
};

View File

@@ -377,7 +377,7 @@ namespace snmalloc
{
auto p = message_queue().peek();
auto& entry =
SharedStateHandle::Pagemap::get_meta_data(snmalloc::address_cast(p));
SharedStateHandle::Pagemap::get_metaentry(snmalloc::address_cast(p));
auto r = message_queue().dequeue(key_global);
@@ -539,7 +539,7 @@ namespace snmalloc
SNMALLOC_FAST_PATH void dealloc_local_object(void* p)
{
auto entry =
SharedStateHandle::Pagemap::get_meta_data(snmalloc::address_cast(p));
SharedStateHandle::Pagemap::get_metaentry(snmalloc::address_cast(p));
if (likely(dealloc_local_object_fast(entry, p, entropy)))
return;
@@ -665,7 +665,7 @@ namespace snmalloc
{
bool need_post = true; // Always going to post, so ignore.
auto n = p->atomic_read_next(key_global);
auto& entry = SharedStateHandle::Pagemap::get_meta_data(
auto& entry = SharedStateHandle::Pagemap::get_metaentry(
snmalloc::address_cast(p));
handle_dealloc_remote(entry, p, need_post);
p = n;

View File

@@ -261,7 +261,7 @@ namespace snmalloc
<< std::endl;
#endif
MetaEntry entry =
SharedStateHandle::Pagemap::get_meta_data(address_cast(p));
SharedStateHandle::Pagemap::get_metaentry(address_cast(p));
local_cache.remote_dealloc_cache.template dealloc<sizeof(CoreAlloc)>(
entry.get_remote()->trunc_id(), CapPtr<void, CBAlloc>(p), key_global);
post_remote_cache();
@@ -473,7 +473,7 @@ namespace snmalloc
// in thread local state.
const MetaEntry& entry =
SharedStateHandle::Pagemap::get_meta_data(address_cast(p));
SharedStateHandle::Pagemap::get_metaentry(address_cast(p));
if (likely(local_cache.remote_allocator == entry.get_remote()))
{
if (likely(CoreAlloc::dealloc_local_object_fast(
@@ -584,7 +584,7 @@ namespace snmalloc
// entry for the first chunk of memory, that states it represents a large
// object, so we can pull the check for null off the fast path.
MetaEntry entry =
SharedStateHandle::Pagemap::get_meta_data(address_cast(p_raw));
SharedStateHandle::Pagemap::get_metaentry(address_cast(p_raw));
if (likely(entry.get_remote() != SharedStateHandle::fake_large_remote))
return sizeclass_to_size(entry.get_sizeclass());
@@ -610,7 +610,7 @@ namespace snmalloc
#ifndef SNMALLOC_PASS_THROUGH
// TODO bring back the CHERI bits. Wes to review if required.
MetaEntry entry =
SharedStateHandle::Pagemap::template get_meta_data<true>(
SharedStateHandle::Pagemap::template get_metaentry<true>(
address_cast(p_raw));
auto sizeclass = entry.get_sizeclass();
if (likely(entry.get_remote() != SharedStateHandle::fake_large_remote))

View File

@@ -95,7 +95,7 @@ namespace snmalloc
{
auto [first, last] = list[i].extract_segment(key);
MetaEntry entry =
SharedStateHandle::Pagemap::get_meta_data(address_cast(first));
SharedStateHandle::Pagemap::get_metaentry(address_cast(first));
entry.get_remote()->enqueue(first, last, key);
sent_something = true;
}
@@ -118,7 +118,7 @@ namespace snmalloc
// slot.
auto r = resend.take(key);
MetaEntry entry =
SharedStateHandle::Pagemap::get_meta_data(address_cast(r));
SharedStateHandle::Pagemap::get_metaentry(address_cast(r));
auto i = entry.get_remote()->trunc_id();
size_t slot = get_slot<allocator_size>(i, post_round);
list[slot].add(r, key);

View File

@@ -107,7 +107,7 @@ namespace snmalloc
<< std::endl;
#endif
MetaEntry entry{meta, remote, sizeclass};
SharedStateHandle::Pagemap::set_meta_data(
SharedStateHandle::Pagemap::set_metaentry(
address_cast(slab), slab_size, entry);
return {slab, meta};
}