Improved OEPal integration with the new snmalloc architecture (#346)

* Improved OEPal integration with the new snmalloc architecture

* Applied PR feedback
This commit is contained in:
Istvan Haller
2021-07-15 15:06:47 +01:00
committed by GitHub
parent 39c2df0b56
commit d0ecba5280
5 changed files with 27 additions and 53 deletions

View File

@@ -11,7 +11,8 @@
using namespace snmalloc;
using FixedAlloc = LocalAllocator<FixedGlobals>;
using CustomGlobals = FixedGlobals<PALNoAlloc<DefaultPal>>;
using FixedAlloc = LocalAllocator<CustomGlobals>;
int main()
{
@@ -30,8 +31,8 @@ int main()
std::cout << "Allocated region " << oe_base.unsafe_ptr() << " - "
<< pointer_offset(oe_base, size).unsafe_ptr() << std::endl;
FixedGlobals fixed_handle;
FixedGlobals::init(oe_base, size);
CustomGlobals fixed_handle;
CustomGlobals::init(oe_base, size);
FixedAlloc a(fixed_handle);
size_t object_size = 128;

View File

@@ -10,7 +10,8 @@
#define SNMALLOC_PROVIDE_OWN_CONFIG
namespace snmalloc
{
using Alloc = LocalAllocator<FixedGlobals>;
using CustomGlobals = FixedGlobals<PALNoAlloc<DefaultPal>>;
using Alloc = LocalAllocator<CustomGlobals>;
}
#define SNMALLOC_NAME_MANGLE(a) enclave_##a
@@ -18,7 +19,7 @@ namespace snmalloc
extern "C" void oe_allocator_init(void* base, void* end)
{
snmalloc::FixedGlobals fixed_handle;
snmalloc::CustomGlobals fixed_handle;
fixed_handle.init(
CapPtr<void, CBChunk>(base), address_cast(end) - address_cast(base));
}