From 281a88d404edc47a9879c99d095ac7bc68cf23c6 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Tue, 27 Aug 2019 12:52:52 +0000 Subject: [PATCH] Templatize the Tag ID value --- src/pal/pal.h | 2 +- src/pal/pal_apple.h | 8 +++----- src/pal/pal_consts.h | 5 +++++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/pal/pal.h b/src/pal/pal.h index 5a866a6..8b967b1 100644 --- a/src/pal/pal.h +++ b/src/pal/pal.h @@ -27,7 +27,7 @@ namespace snmalloc # if defined(_WIN32) PALWindows; # elif defined(__APPLE__) - PALApple; + PALApple<>; # elif defined(__linux__) PALLinux; # elif defined(FreeBSD_KERNEL) diff --git a/src/pal/pal_apple.h b/src/pal/pal_apple.h index a0b2bb8..72c3feb 100644 --- a/src/pal/pal_apple.h +++ b/src/pal/pal_apple.h @@ -9,11 +9,9 @@ namespace snmalloc { /** * PAL implementation for Apple systems (macOS, iOS, watchOS, tvOS...). - * - * XNU behaves exactly like a generic BSD platform but this class exists - * as a place to add XNU-specific behaviour later, if required. */ - class PALApple : public PALBSD + template + class PALApple : public PALBSD> { public: /** @@ -84,7 +82,7 @@ namespace snmalloc * (e.g. LLVM sanitizers has 99) so we can monitor their states * via vmmap for instance. */ - static constexpr int pal_anon_id = VM_MAKE_TAG(241); + static constexpr int pal_anon_id = VM_MAKE_TAG(PALAnonID); }; } // namespace snmalloc #endif diff --git a/src/pal/pal_consts.h b/src/pal/pal_consts.h index b80c543..0261155 100644 --- a/src/pal/pal_consts.h +++ b/src/pal/pal_consts.h @@ -48,4 +48,9 @@ namespace snmalloc */ YesZero }; + + /** + * Default Tag ID for the Apple class + */ + static const int PALAnonDefaultID = 241; } // namespace snmalloc