Created pal_consts.h. New exported functions are now prefixed with "snmalloc_".

This commit is contained in:
rschust
2019-04-09 13:35:13 +01:00
committed by David Chisnall
parent f0d18760fe
commit 71900ef947
4 changed files with 47 additions and 36 deletions

View File

@@ -1,5 +1,12 @@
#pragma once
#include "pal_consts.h"
namespace snmalloc
{
void error(const char* const str);
}
// If simultating OE, then we need the underlying platform
#if !defined(OPEN_ENCLAVE) || defined(OPEN_ENCLAVE_SIMULATION)
# include "pal_apple.h"

34
src/pal/pal_consts.h Normal file
View File

@@ -0,0 +1,34 @@
namespace snmalloc
{
/**
* Flags in a bitfield of optional features that a PAL may support. These
* should be set in the PAL's `pal_features` static constexpr field.
*/
enum PalFeatures : uint64_t
{
/**
* This PAL supports low memory notifications. It must implement a
* `low_memory_epoch` method that returns a `uint64_t` of the number of
* times that a low-memory notification has been raised and an
* `expensive_low_memory_check()` method that returns a `bool` indicating
* whether low memory conditions are still in effect.
*/
LowMemoryNotification = (1 << 0),
/**
* This PAL natively supports allocation with a guaranteed alignment. If
* this is not supported, then we will over-allocate and round the
* allocation.
*
* A PAL that does supports this must expose a `request()` method that takes
* a size and alignment. A PAL that does *not* support it must expose a
* `request()` method that takes only a size.
*/
AlignedAllocation = (1 << 1)
};
enum ZeroMem
{
NoZero,
YesZero
};
}