Pull aligned allocation out of the PAL.

The PAL can now advertise that it supports aligned allocation.  If it
does not, then the memory provider will do the alignment for it.

This change still leaves the PAL responsible for systematic testing, but
it should now be much easier to lift that out.
This commit is contained in:
David Chisnall
2019-02-22 11:45:19 +00:00
committed by David Chisnall
parent d6e89b7c60
commit 6a5359b177
9 changed files with 105 additions and 56 deletions

View File

@@ -30,10 +30,10 @@ extern "C" void oe_abort()
using namespace snmalloc;
int main()
{
DefaultPal pal;
MemoryProviderStateMixin<DefaultPal> mp;
size_t size = 1ULL << 28;
oe_base = pal.reserve<true>(&size, 0);
oe_base = mp.reserve<true>(&size, 0);
oe_end = (uint8_t*)oe_base + size;
std::cout << "Allocated region " << oe_base << " - " << oe_end << std::endl;
@@ -49,4 +49,4 @@ int main()
if (oe_end < r1)
abort();
}
}
}

View File

@@ -35,10 +35,10 @@ extern "C" void enclave_free(void*);
using namespace snmalloc;
int main()
{
DefaultPal pal;
MemoryProviderStateMixin<DefaultPal> mp;
size_t size = 1ULL << 28;
oe_base = pal.reserve<true>(&size, 0);
oe_base = mp.reserve<true>(&size, 1);
oe_end = (uint8_t*)oe_base + size;
std::cout << "Allocated region " << oe_base << " - " << oe_end << std::endl;