From 250219596408b47164b383409c8e5569f769b574 Mon Sep 17 00:00:00 2001 From: Slobodan Predolac Date: Wed, 27 May 2026 19:28:21 -0400 Subject: [PATCH] Delete jemalloc_internal_includes.h (umbrella header) After the per-TU explicit-include conversion in batches 1-7, no .c file in src/ needs the umbrella anymore. test/jemalloc_test.h.in is the last consumer; it's the template for the header used by unit and stress tests that want all of jemalloc's internals visible, so its #include of the umbrella is replaced with the same set of explicit includes the umbrella used to expand to. No behavioral change for tests. With that, the umbrella is gone. Every translation unit now declares the headers it actually uses, and the hidden-transitive- include patterns that motivated this cleanup are no longer possible to introduce silently -- a missing include now fails at the failing file rather than silently working because something upstream pulled in the world. Step 6 (Option B) of the cyclical-dep cleanup, complete. --- .../internal/jemalloc_internal_includes.h | 70 ------------------- test/include/test/jemalloc_test.h.in | 30 +++++++- 2 files changed, 28 insertions(+), 72 deletions(-) delete mode 100644 include/jemalloc/internal/jemalloc_internal_includes.h diff --git a/include/jemalloc/internal/jemalloc_internal_includes.h b/include/jemalloc/internal/jemalloc_internal_includes.h deleted file mode 100644 index 299695f1..00000000 --- a/include/jemalloc/internal/jemalloc_internal_includes.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef JEMALLOC_INTERNAL_INCLUDES_H -#define JEMALLOC_INTERNAL_INCLUDES_H - -/* - * jemalloc can conceptually be broken into components (arena, tcache, etc.), - * but there are circular dependencies that cannot be broken without - * substantial performance degradation. - * - * Historically, we dealt with this by each header into four sections (types, - * structs, externs, and inlines), and included each header file multiple times - * in this file, picking out the portion we want on each pass using the - * following #defines: - * JEMALLOC_H_TYPES : Preprocessor-defined constants and pseudo-opaque data - * types. - * JEMALLOC_H_STRUCTS : Data structures. - * JEMALLOC_H_EXTERNS : Extern data declarations and function prototypes. - * JEMALLOC_H_INLINES : Inline functions. - * - * We're moving toward a world in which the dependencies are explicit; each file - * will #include the headers it depends on (rather than relying on them being - * implicitly available via this file including every header file in the - * project). - * - * We're now in an intermediate state: we've broken up the header files to avoid - * having to include each one multiple times, but have not yet moved the - * dependency information into the header files (i.e. we still rely on the - * ordering in this file to ensure all a header's dependencies are available in - * its translation unit). Each component is now broken up into multiple header - * files, corresponding to the sections above (e.g. instead of "foo.h", we now - * have "foo_types.h", "foo_structs.h", "foo_externs.h", "foo_inlines.h"). - * - * Those files which have been converted to explicitly include their - * inter-component dependencies are now in the initial HERMETIC HEADERS - * section. All headers may still rely on jemalloc_preamble.h (which, by fiat, - * must be included first in every translation unit) for system headers and - * global jemalloc definitions, however. - */ - -#include "jemalloc/internal/arena.h" - -/******************************************************************************/ -/* EXTERNS */ -/******************************************************************************/ - -#include "jemalloc/internal/jemalloc_internal_externs.h" -#include "jemalloc/internal/large.h" -#include "jemalloc/internal/tcache.h" -#include "jemalloc/internal/malloc_dispatch_externs.h" -#include "jemalloc/internal/prof.h" -#include "jemalloc/internal/background_thread.h" - -/******************************************************************************/ -/* INLINES */ -/******************************************************************************/ - -#include "jemalloc/internal/jemalloc_internal_inlines_a.h" -/* - * Include portions of arena code interleaved with tcache code in order to - * resolve circular dependencies. - */ -#include "jemalloc/internal/arena_inlines_a.h" -#include "jemalloc/internal/jemalloc_internal_inlines_b.h" -#include "jemalloc/internal/tcache_inlines.h" -#include "jemalloc/internal/arena_inlines_b.h" -#include "jemalloc/internal/malloc_dispatch_inlines.h" -#include "jemalloc/internal/jemalloc_internal_inlines_c.h" -#include "jemalloc/internal/prof_inlines.h" -#include "jemalloc/internal/background_thread_inlines.h" - -#endif /* JEMALLOC_INTERNAL_INCLUDES_H */ diff --git a/test/include/test/jemalloc_test.h.in b/test/include/test/jemalloc_test.h.in index 8b139db1..12cedc57 100644 --- a/test/include/test/jemalloc_test.h.in +++ b/test/include/test/jemalloc_test.h.in @@ -47,7 +47,20 @@ extern "C" { # define JEMALLOC_JET # define JEMALLOC_MANGLE # include "jemalloc/internal/jemalloc_preamble.h" -# include "jemalloc/internal/jemalloc_internal_includes.h" +# include "jemalloc/internal/arena.h" +# include "jemalloc/internal/jemalloc_internal_externs.h" +# include "jemalloc/internal/large.h" +# include "jemalloc/internal/tcache.h" +# include "jemalloc/internal/prof.h" +# include "jemalloc/internal/background_thread.h" +# include "jemalloc/internal/jemalloc_internal_inlines_a.h" +# include "jemalloc/internal/arena_inlines_a.h" +# include "jemalloc/internal/jemalloc_internal_inlines_b.h" +# include "jemalloc/internal/tcache_inlines.h" +# include "jemalloc/internal/arena_inlines_b.h" +# include "jemalloc/internal/jemalloc_internal_inlines_c.h" +# include "jemalloc/internal/prof_inlines.h" +# include "jemalloc/internal/background_thread_inlines.h" /******************************************************************************/ /* @@ -92,7 +105,20 @@ extern "C" { # define JEMALLOC_JET # include "jemalloc/internal/jemalloc_preamble.h" -# include "jemalloc/internal/jemalloc_internal_includes.h" +# include "jemalloc/internal/arena.h" +# include "jemalloc/internal/jemalloc_internal_externs.h" +# include "jemalloc/internal/large.h" +# include "jemalloc/internal/tcache.h" +# include "jemalloc/internal/prof.h" +# include "jemalloc/internal/background_thread.h" +# include "jemalloc/internal/jemalloc_internal_inlines_a.h" +# include "jemalloc/internal/arena_inlines_a.h" +# include "jemalloc/internal/jemalloc_internal_inlines_b.h" +# include "jemalloc/internal/tcache_inlines.h" +# include "jemalloc/internal/arena_inlines_b.h" +# include "jemalloc/internal/jemalloc_internal_inlines_c.h" +# include "jemalloc/internal/prof_inlines.h" +# include "jemalloc/internal/background_thread_inlines.h" # include "jemalloc/internal/public_unnamespace.h" # undef JEMALLOC_JET