Templatize the Tag ID value

This commit is contained in:
David Carlier
2019-08-27 12:52:52 +00:00
parent eed50baf8e
commit 281a88d404
3 changed files with 9 additions and 6 deletions

View File

@@ -27,7 +27,7 @@ namespace snmalloc
# if defined(_WIN32)
PALWindows;
# elif defined(__APPLE__)
PALApple;
PALApple<>;
# elif defined(__linux__)
PALLinux;
# elif defined(FreeBSD_KERNEL)

View File

@@ -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<PALApple>
template<int PALAnonID = PALAnonDefaultID>
class PALApple : public PALBSD<PALApple<>>
{
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

View File

@@ -48,4 +48,9 @@ namespace snmalloc
*/
YesZero
};
/**
* Default Tag ID for the Apple class
*/
static const int PALAnonDefaultID = 241;
} // namespace snmalloc