diff --git a/src/aal/aal.h b/src/aal/aal.h index 6870378..e963250 100644 --- a/src/aal/aal.h +++ b/src/aal/aal.h @@ -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; + + template + constexpr static bool aal_supports = (AAL::aal_features & F) == F; } // namespace snmalloc #if defined(_MSC_VER) && defined(SNMALLOC_VA_BITS_32) diff --git a/src/aal/aal_x86.h b/src/aal/aal_x86.h index 9259ee9..d30df33 100644 --- a/src/aal/aal_x86.h +++ b/src/aal/aal_x86.h @@ -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.