aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys/common
diff options
context:
space:
mode:
Diffstat (limited to 'erts/emulator/sys/common')
-rw-r--r--erts/emulator/sys/common/erl_mseg.c27
-rw-r--r--erts/emulator/sys/common/erl_mseg.h3
2 files changed, 16 insertions, 14 deletions
diff --git a/erts/emulator/sys/common/erl_mseg.c b/erts/emulator/sys/common/erl_mseg.c
index 58ee6600d2..ae6a377abf 100644
--- a/erts/emulator/sys/common/erl_mseg.c
+++ b/erts/emulator/sys/common/erl_mseg.c
@@ -57,6 +57,19 @@
/* Implement some other way to get the real page size if needed! */
#endif
+#undef MIN
+#define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
+#undef MAX
+#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
+
+#define ALIGN_BITS MSEG_ALIGN_BITS
+#define ALIGNED_SIZE MSEG_ALIGNED_SIZE
+#define INV_ALIGNED_MASK ((UWord) ((ALIGNED_SIZE) - 1))
+#define ALIGNED_MASK (~INV_ALIGNED_MASK)
+#define ALIGNED_FLOOR(X) (((UWord)(X)) & ALIGNED_MASK)
+#define ALIGNED_CEILING(X) ALIGNED_FLOOR((X) + INV_ALIGNED_MASK)
+#define MAP_IS_ALIGNED(X) (((UWord)(X) & (ALIGNED_SIZE - 1)) == 0)
+
#define IS_2POW(X) (((X) & ((X) - 1)) == 0)
static ERTS_INLINE Uint ceil_2pow(Uint x) {
int i = 1 << (4 + (sizeof(Uint) != 4 ? 1 : 0));
@@ -71,25 +84,11 @@ static const int debruijn[32] = {
#define LOG2(X) (debruijn[((Uint32)(((X) & -(X)) * 0x077CB531U)) >> 27])
-#define ALIGN_BITS (17)
-#define ALIGNED_SIZE (1 << ALIGN_BITS) /* 128kB */
-
#define CACHE_AREAS (32 - ALIGN_BITS)
#define SIZE_TO_CACHE_AREA_IDX(S) (LOG2((S)) - ALIGN_BITS)
#define MAX_CACHE_SIZE (30)
-#undef MIN
-#define MIN(X, Y) ((X) < (Y) ? (X) : (Y))
-#undef MAX
-#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
-
-#define INV_ALIGNED_MASK ((UWord) ((ALIGNED_SIZE) - 1))
-#define ALIGNED_MASK (~INV_ALIGNED_MASK)
-#define ALIGNED_FLOOR(X) (((UWord)(X)) & ALIGNED_MASK)
-#define ALIGNED_CEILING(X) ALIGNED_FLOOR((X) + INV_ALIGNED_MASK)
-#define MAP_IS_ALIGNED(X) (((UWord)(X) & (ALIGNED_SIZE - 1)) == 0)
-
#define MSEG_FLG_IS_2POW(X) ((X) & ERTS_MSEG_FLG_2POW)
#ifdef DEBUG
diff --git a/erts/emulator/sys/common/erl_mseg.h b/erts/emulator/sys/common/erl_mseg.h
index 460e4a514a..91e335b225 100644
--- a/erts/emulator/sys/common/erl_mseg.h
+++ b/erts/emulator/sys/common/erl_mseg.h
@@ -33,13 +33,16 @@
#if HAVE_MMAP
# define HAVE_ERTS_MSEG 1
# define HAVE_SUPER_ALIGNED_MB_CARRIERS 1
+# define MSEG_ALIGN_BITS (17) /*SVERK Configure me! */
#else
# define HAVE_ERTS_MSEG 0
# define HAVE_SUPER_ALIGNED_MB_CARRIERS 0
+# define MSEG_ALIGN_BITS (12) /*SVERK Configure me! */
#endif
#if HAVE_ERTS_MSEG
+#define MSEG_ALIGNED_SIZE (1 << MSEG_ALIGN_BITS)
#define ERTS_MSEG_FLG_NONE ((Uint)(0))
#define ERTS_MSEG_FLG_2POW ((Uint)(1 << 0))