Exporting the global pagemap and the default memory provider's reserve function in order to support shared allocators

This commit is contained in:
rschust
2019-04-09 09:47:47 +01:00
committed by David Chisnall
parent a4dd814f6e
commit f0d18760fe
4 changed files with 45 additions and 34 deletions

View File

@@ -205,6 +205,17 @@ extern "C"
return ENOENT;
}
SNMALLOC_EXPORT void* SNMALLOC_NAME_MANGLE(get_global_pagemap)(void)
{
return &snmalloc::global_pagemap;
}
SNMALLOC_EXPORT void*
SNMALLOC_NAME_MANGLE(reserve_shared)(size_t* size, size_t align)
{
return snmalloc::default_memory_provider.reserve<true>(size, align);
}
#if !defined(__PIC__) && !defined(NO_BOOTSTRAP_ALLOCATOR)
// The following functions are required to work before TLS is set up, in
// statically-linked programs. These temporarily grab an allocator from the