From 0b278747c78d95f499afe56944373d873d0d5430 Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Wed, 18 Mar 2020 14:49:02 +0000 Subject: [PATCH 1/3] Pal_linux mprotect bug fix When simulating decommit on Linux enable pages before zeroing. --- src/pal/pal_posix.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pal/pal_posix.h b/src/pal/pal_posix.h index 4c3a842..e15a63f 100644 --- a/src/pal/pal_posix.h +++ b/src/pal/pal_posix.h @@ -76,15 +76,15 @@ namespace snmalloc SNMALLOC_ASSERT( is_aligned_block(p, size) || (zero_mem == NoZero)); - if constexpr (zero_mem == YesZero) - static_cast(this)->template zero(p, size); - #ifdef USE_POSIX_COMMIT_CHECKS mprotect(p, size, PROT_READ | PROT_WRITE); #else UNUSED(p); UNUSED(size); #endif + + if constexpr (zero_mem == YesZero) + static_cast(this)->template zero(p, size); } /** From 1352b28e828c33edce1c58ff77080a3d2aee663d Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Wed, 18 Mar 2020 14:49:20 +0000 Subject: [PATCH 2/3] Typo aarch64 --- src/aal/aal_arm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aal/aal_arm.h b/src/aal/aal_arm.h index 9dc722b..1bdc053 100644 --- a/src/aal/aal_arm.h +++ b/src/aal/aal_arm.h @@ -1,6 +1,6 @@ #pragma once -#if defined(__arch64__) +#if defined(__aarch64__) # define SNMALLOC_VA_BITS_64 #else # define SNMALLOC_VA_BITS_32 From 0e1a7051f8e9dad2ff5ea3c801d8d0cccff710d5 Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Wed, 18 Mar 2020 14:49:34 +0000 Subject: [PATCH 3/3] Improve constexpr failure case. --- src/aal/aal.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/aal/aal.h b/src/aal/aal.h index 4f5355f..1fb58b7 100644 --- a/src/aal/aal.h +++ b/src/aal/aal.h @@ -77,12 +77,15 @@ namespace snmalloc tick.time_since_epoch()) .count()); } + else + { #if __has_builtin(__builtin_readcyclecounter) && \ !defined(SNMALLOC_NO_AAL_BUILTINS) - return __builtin_readcyclecounter(); + return __builtin_readcyclecounter(); #else - return Arch::tick(); + return Arch::tick(); #endif + } } };