aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/erl_alloc_util.c2
-rw-r--r--erts/emulator/sys/common/erl_mseg.c27
-rw-r--r--erts/emulator/sys/common/erl_mseg.h3
3 files changed, 17 insertions, 15 deletions
diff --git a/erts/emulator/beam/erl_alloc_util.c b/erts/emulator/beam/erl_alloc_util.c
index 6b674debbd..32a42f9274 100644
--- a/erts/emulator/beam/erl_alloc_util.c
+++ b/erts/emulator/beam/erl_alloc_util.c
@@ -78,7 +78,7 @@ int erts_have_sbmbc_alloc;
#if HAVE_ERTS_MSEG
-#define MSEG_UNIT_SHIFT ((UWord)12)
+#define MSEG_UNIT_SHIFT MSEG_ALIGN_BITS
#define MSEG_UNIT_SZ (1 << MSEG_UNIT_SHIFT)
#define MSEG_UNIT_MASK ((~(UWord)0) << MSEG_UNIT_SHIFT)
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))