CapPtr: shift free lists to Alloc bounds

This is incomplete, yet still more reflective of what's going on: we take the
exported pointers back from userspace and thread them directly into the free
lists.

So: move capptr_to_user_address_control to list construction time rather than
list consumption time.
This commit is contained in:
Nathaniel Wesley Filardo
2021-09-21 19:17:51 +01:00
committed by Nathaniel Wesley Filardo
parent 55cd5e87c0
commit 7e53a2e82a
7 changed files with 99 additions and 91 deletions

View File

@@ -19,8 +19,8 @@ namespace snmalloc
std::array<
FreeListBuilder<
false,
capptr::bounds::AllocFull,
capptr::bounds::AllocFull,
capptr::bounds::Alloc,
capptr::bounds::Alloc,
false>,
REMOTE_SLOTS>
list;
@@ -73,12 +73,12 @@ namespace snmalloc
template<size_t allocator_size>
SNMALLOC_FAST_PATH void dealloc(
RemoteAllocator::alloc_id_t target_id,
capptr::AllocFull<void> p,
capptr::Alloc<void> p,
const FreeListKey& key)
{
SNMALLOC_ASSERT(initialised);
auto r =
p.template as_reinterpret<FreeObject::T<capptr::bounds::AllocFull>>();
p.template as_reinterpret<FreeObject::T<capptr::bounds::Alloc>>();
list[get_slot<allocator_size>(target_id, 0)].add(r, key);
}
@@ -118,8 +118,7 @@ namespace snmalloc
// Entries could map back onto the "resend" list,
// so take copy of the head, mark the last element,
// and clear the original list.
FreeListIter<capptr::bounds::AllocFull, capptr::bounds::AllocFull>
resend;
FreeListIter<capptr::bounds::Alloc, capptr::bounds::Alloc> resend;
list[my_slot].close(resend, key);
post_round++;