AAL: feature flags

This commit is contained in:
Nathaniel Filardo
2019-12-03 17:16:22 +00:00
parent ef40f1cf1d
commit 0d6f708166
2 changed files with 21 additions and 0 deletions

View File

@@ -11,6 +11,19 @@
namespace snmalloc
{
/**
* Flags in a bitfield of attributes of this architecture, much like
* PalFeatures.
*/
enum AalFeatures : uint64_t
{
/**
* This architecture does not discriminate between integers and pointers,
* and so may use bit operations on pointer values.
*/
IntegerPointers = (1 << 0),
};
/**
* Architecture Abstraction Layer. Includes default implementations of some
* functions using compiler builtins. Falls back to the definitions in the
@@ -64,6 +77,9 @@ namespace snmalloc
namespace snmalloc
{
using Aal = AAL_Generic<AAL_Arch>;
template<AalFeatures F, typename AAL = Aal>
constexpr static bool aal_supports = (AAL::aal_features & F) == F;
} // namespace snmalloc
#if defined(_MSC_VER) && defined(SNMALLOC_VA_BITS_32)

View File

@@ -55,6 +55,11 @@ namespace snmalloc
}
public:
/**
* Bitmap of AalFeature flags
*/
static constexpr uint64_t aal_features = IntegerPointers;
/**
* On pipelined processors, notify the core that we are in a spin loop and
* that speculative execution past this point may not be a performance gain.