From 268843ac680f688582044621434221bedf78719b Mon Sep 17 00:00:00 2001 From: David Goldblatt Date: Mon, 24 Apr 2017 18:05:15 -0700 Subject: [PATCH] Header refactoring: pages.h - unify and remove from catchall. --- include/jemalloc/internal/arena_externs.h | 1 + include/jemalloc/internal/extent_inlines.h | 1 + .../internal/jemalloc_internal_includes.h | 2 -- .../internal/{pages_types.h => pages.h} | 31 +++++++++++++++++-- include/jemalloc/internal/pages_externs.h | 29 ----------------- src/pages.c | 3 ++ 6 files changed, 33 insertions(+), 34 deletions(-) rename include/jemalloc/internal/{pages_types.h => pages.h} (68%) delete mode 100644 include/jemalloc/internal/pages_externs.h diff --git a/include/jemalloc/internal/arena_externs.h b/include/jemalloc/internal/arena_externs.h index 1e13efd3..7d56e44b 100644 --- a/include/jemalloc/internal/arena_externs.h +++ b/include/jemalloc/internal/arena_externs.h @@ -1,6 +1,7 @@ #ifndef JEMALLOC_INTERNAL_ARENA_EXTERNS_H #define JEMALLOC_INTERNAL_ARENA_EXTERNS_H +#include "jemalloc/internal/pages.h" #include "jemalloc/internal/size_classes.h" #include "jemalloc/internal/stats.h" diff --git a/include/jemalloc/internal/extent_inlines.h b/include/jemalloc/internal/extent_inlines.h index a73b6530..e1f8bd9e 100644 --- a/include/jemalloc/internal/extent_inlines.h +++ b/include/jemalloc/internal/extent_inlines.h @@ -1,6 +1,7 @@ #ifndef JEMALLOC_INTERNAL_EXTENT_INLINES_H #define JEMALLOC_INTERNAL_EXTENT_INLINES_H +#include "jemalloc/internal/pages.h" #include "jemalloc/internal/prng.h" #include "jemalloc/internal/ql.h" diff --git a/include/jemalloc/internal/jemalloc_internal_includes.h b/include/jemalloc/internal/jemalloc_internal_includes.h index fb4105f0..340cb1ce 100644 --- a/include/jemalloc/internal/jemalloc_internal_includes.h +++ b/include/jemalloc/internal/jemalloc_internal_includes.h @@ -48,7 +48,6 @@ #include "jemalloc/internal/base_types.h" #include "jemalloc/internal/arena_types.h" #include "jemalloc/internal/rtree_types.h" -#include "jemalloc/internal/pages_types.h" #include "jemalloc/internal/tcache_types.h" #include "jemalloc/internal/prof_types.h" @@ -81,7 +80,6 @@ #include "jemalloc/internal/base_externs.h" #include "jemalloc/internal/arena_externs.h" #include "jemalloc/internal/rtree_externs.h" -#include "jemalloc/internal/pages_externs.h" #include "jemalloc/internal/large_externs.h" #include "jemalloc/internal/tcache_externs.h" #include "jemalloc/internal/prof_externs.h" diff --git a/include/jemalloc/internal/pages_types.h b/include/jemalloc/internal/pages.h similarity index 68% rename from include/jemalloc/internal/pages_types.h rename to include/jemalloc/internal/pages.h index e44ee2a4..28383b7f 100644 --- a/include/jemalloc/internal/pages_types.h +++ b/include/jemalloc/internal/pages.h @@ -1,5 +1,5 @@ -#ifndef JEMALLOC_INTERNAL_PAGES_TYPES_H -#define JEMALLOC_INTERNAL_PAGES_TYPES_H +#ifndef JEMALLOC_INTERNAL_PAGES_EXTERNS_H +#define JEMALLOC_INTERNAL_PAGES_EXTERNS_H /* Page size. LG_PAGE is determined by the configure script. */ #ifdef PAGE_MASK @@ -43,4 +43,29 @@ # define PAGES_CAN_PURGE_FORCED #endif -#endif /* JEMALLOC_INTERNAL_PAGES_TYPES_H */ +static const bool pages_can_purge_lazy = +#ifdef PAGES_CAN_PURGE_LAZY + true +#else + false +#endif + ; +static const bool pages_can_purge_forced = +#ifdef PAGES_CAN_PURGE_FORCED + true +#else + false +#endif + ; + +void *pages_map(void *addr, size_t size, size_t alignment, bool *commit); +void pages_unmap(void *addr, size_t size); +bool pages_commit(void *addr, size_t size); +bool pages_decommit(void *addr, size_t size); +bool pages_purge_lazy(void *addr, size_t size); +bool pages_purge_forced(void *addr, size_t size); +bool pages_huge(void *addr, size_t size); +bool pages_nohuge(void *addr, size_t size); +bool pages_boot(void); + +#endif /* JEMALLOC_INTERNAL_PAGES_EXTERNS_H */ diff --git a/include/jemalloc/internal/pages_externs.h b/include/jemalloc/internal/pages_externs.h deleted file mode 100644 index af9a01b8..00000000 --- a/include/jemalloc/internal/pages_externs.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef JEMALLOC_INTERNAL_PAGES_EXTERNS_H -#define JEMALLOC_INTERNAL_PAGES_EXTERNS_H - -static const bool pages_can_purge_lazy = -#ifdef PAGES_CAN_PURGE_LAZY - true -#else - false -#endif - ; -static const bool pages_can_purge_forced = -#ifdef PAGES_CAN_PURGE_FORCED - true -#else - false -#endif - ; - -void *pages_map(void *addr, size_t size, size_t alignment, bool *commit); -void pages_unmap(void *addr, size_t size); -bool pages_commit(void *addr, size_t size); -bool pages_decommit(void *addr, size_t size); -bool pages_purge_lazy(void *addr, size_t size); -bool pages_purge_forced(void *addr, size_t size); -bool pages_huge(void *addr, size_t size); -bool pages_nohuge(void *addr, size_t size); -bool pages_boot(void); - -#endif /* JEMALLOC_INTERNAL_PAGES_EXTERNS_H */ diff --git a/src/pages.c b/src/pages.c index 86907aa5..3a048e3b 100644 --- a/src/pages.c +++ b/src/pages.c @@ -1,5 +1,8 @@ #define JEMALLOC_PAGES_C_ #include "jemalloc/internal/jemalloc_preamble.h" + +#include "jemalloc/internal/pages.h" + #include "jemalloc/internal/jemalloc_internal_includes.h" #include "jemalloc/internal/assert.h"