AddressSpace: use Backend to access Pagemap

And do so by type, rather than by value.  While here, introduce a C++20 concept
for this Backend-offered proxy and adjust the template parameters appropriately.

This will be useful for the process sandbox code, which needs to mediate stores
to the pagemap, but can provide a read-only view.
This commit is contained in:
Nathaniel Wesley Filardo
2021-08-20 21:19:18 +01:00
committed by Nathaniel Wesley Filardo
parent 7eb8769950
commit 70c3e00df7
8 changed files with 168 additions and 93 deletions

View File

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