MetaEntry: split get_metaslab by intent
This commit is contained in:
committed by
Nathaniel Wesley Filardo
parent
599ae0e632
commit
3cdb7be478
@@ -125,7 +125,7 @@ namespace snmalloc
|
||||
const MetaEntry& t = Pagemap::template get_metaentry<false>(
|
||||
local_state, address_cast(base));
|
||||
return capptr::Chunk<FreeChunk>(
|
||||
reinterpret_cast<FreeChunk*>(t.get_metaslab()));
|
||||
reinterpret_cast<FreeChunk*>(t.get_metaslab_no_remote()));
|
||||
}
|
||||
|
||||
return base->next;
|
||||
|
||||
@@ -534,8 +534,8 @@ namespace snmalloc
|
||||
UNUSED(size);
|
||||
# endif
|
||||
|
||||
ChunkRecord* slab_record =
|
||||
reinterpret_cast<ChunkRecord*>(entry.get_metaslab());
|
||||
auto slab_record =
|
||||
static_cast<ChunkRecord*>(entry.get_metaslab_no_remote());
|
||||
|
||||
SNMALLOC_ASSERT(
|
||||
address_cast(slab_record->meta_common.chunk) == address_cast(p_tame));
|
||||
|
||||
@@ -243,8 +243,24 @@ namespace snmalloc
|
||||
pointer_offset(reinterpret_cast<uintptr_t>(remote), sizeclass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Metaslab field as a void*, guarded by an assert that there is
|
||||
* no remote that owns this chunk.
|
||||
*/
|
||||
[[nodiscard]] SNMALLOC_FAST_PATH void* get_metaslab_no_remote() const
|
||||
{
|
||||
SNMALLOC_ASSERT(get_remote() == nullptr);
|
||||
return static_cast<void*>(meta);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Metaslab metadata associated with this chunk, guarded by an
|
||||
* assert that this chunk is being used as a slab (i.e., has an associated
|
||||
* owning allocator).
|
||||
*/
|
||||
[[nodiscard]] SNMALLOC_FAST_PATH Metaslab* get_metaslab() const
|
||||
{
|
||||
SNMALLOC_ASSERT(get_remote() != nullptr);
|
||||
return meta;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user