diff --git a/src/Makefile b/src/Makefile index 9832fb63845727..0b87c7b8a6fae9 100644 --- a/src/Makefile +++ b/src/Makefile @@ -44,23 +44,34 @@ ifeq ($(OS),FreeBSD) FLAGS += -I$(LOCALBASE)/include endif +# GC source code. It depends on which GC implementation to use. +GC_SRCS := gc-common gc-stacks gc-alloc-profiler gc-heap-snapshot +ifeq ($(WITH_MMTK), 1) +GC_SRCS += gc-mmtk +else +GC_SRCS += gc-stock gc-debug gc-pages gc-page-profiler +endif + SRCS := \ jltypes gf typemap smallintset ast builtins module interpreter symbol \ dlload sys init task array genericmemory staticdata toplevel jl_uv datatype \ simplevector runtime_intrinsics precompile jloptions mtarraylist \ - threading scheduler stackwalk gc-common gc-stock gc-mmtk gc-debug gc-pages gc-stacks gc-alloc-profiler gc-page-profiler \ - method jlapi signal-handling safepoint timing subtype rtutils gc-heap-snapshot \ - crc32c APInt-C processor ircode opaque_closure codegen-stubs coverage runtime_ccall engine + threading scheduler stackwalk \ + method jlapi signal-handling safepoint timing subtype rtutils \ + crc32c APInt-C processor ircode opaque_closure codegen-stubs coverage runtime_ccall engine \ + $(GC_SRCS) RT_LLVMLINK := CG_LLVMLINK := ifeq ($(JULIACODEGEN),LLVM) +GC_CODEGEN_SRCS := llvm-final-gc-lowering llvm-late-gc-lowering llvm-gc-invariant-verifier CODEGEN_SRCS := codegen jitlayers aotcompile debuginfo disasm llvm-simdloop \ - llvm-final-gc-lowering llvm-pass-helpers llvm-late-gc-lowering llvm-ptls \ - llvm-lower-handlers llvm-gc-invariant-verifier llvm-propagate-addrspaces \ + llvm-pass-helpers llvm-ptls \ + llvm-lower-handlers llvm-propagate-addrspaces \ llvm-multiversioning llvm-alloc-opt llvm-alloc-helpers cgmemmgr llvm-remove-addrspaces \ - llvm-remove-ni llvm-julia-licm llvm-demote-float16 llvm-cpufeatures pipeline llvm_api + llvm-remove-ni llvm-julia-licm llvm-demote-float16 llvm-cpufeatures pipeline llvm_api \ + $(GC_CODEGEN_SRCS) FLAGS += -I$(shell $(LLVM_CONFIG_HOST) --includedir) CG_LLVM_LIBS := all ifeq ($(USE_POLLY),1) @@ -107,7 +118,12 @@ ifeq ($(USE_SYSTEM_LIBUV),0) UV_HEADERS += uv.h UV_HEADERS += uv/*.h endif -PUBLIC_HEADERS := $(BUILDDIR)/julia_version.h $(wildcard $(SRCDIR)/support/*.h) $(addprefix $(SRCDIR)/,work-stealing-queue.h gc-interface.h gc-tls.h gc-tls-common.h gc-tls-mmtk.h julia.h julia_assert.h julia_threads.h julia_fasttls.h julia_locks.h julia_atomics.h jloptions.h) +PUBLIC_HEADERS := $(BUILDDIR)/julia_version.h $(wildcard $(SRCDIR)/support/*.h) $(addprefix $(SRCDIR)/,work-stealing-queue.h gc-interface.h gc-tls-common.h julia.h julia_assert.h julia_threads.h julia_fasttls.h julia_locks.h julia_atomics.h jloptions.h) +ifeq ($(WITH_MMTK), 1) + PUBLIC_HEADERS += $(addprefix $(SRCDIR)/,gc-tls-mmtk.h) +else + PUBLIC_HEADERS += $(addprefix $(SRCDIR)/,gc-tls-stock.h) +endif ifeq ($(OS),WINNT) PUBLIC_HEADERS += $(addprefix $(SRCDIR)/,win32_ucontext.h) endif diff --git a/src/gc-debug.c b/src/gc-debug.c index 2c8e1c60554143..7c479484cde45c 100644 --- a/src/gc-debug.c +++ b/src/gc-debug.c @@ -1,6 +1,5 @@ // This file is a part of Julia. License is MIT: https://julialang.org/license -#ifndef MMTK_GC #include "gc-common.h" #include "gc-stock.h" #include "julia.h" @@ -1130,5 +1129,3 @@ void _report_gc_finished(uint64_t pause, uint64_t freed, int full, int recollect #ifdef __cplusplus } #endif - -#endif // !MMTK_GC diff --git a/src/gc-mmtk.c b/src/gc-mmtk.c index 65651f9c720db5..379e06ae08db84 100644 --- a/src/gc-mmtk.c +++ b/src/gc-mmtk.c @@ -1,5 +1,3 @@ -#ifdef MMTK_GC - #include "gc-common.h" #include "mmtkMutator.h" #include "gc-mmtk.h" @@ -1199,5 +1197,3 @@ JL_DLLEXPORT jl_value_t *jl_gc_internal_obj_base_ptr(void *p) #ifdef __cplusplus } #endif - -#endif // MMTK_GC diff --git a/src/gc-mmtk.h b/src/gc-mmtk.h index da84d38f8e9c52..826b21cd4945a9 100644 --- a/src/gc-mmtk.h +++ b/src/gc-mmtk.h @@ -1,5 +1,3 @@ -#ifdef MMTK_GC - #include #include @@ -29,5 +27,3 @@ JL_EXTENSION typedef struct _bigval_t { #ifdef __cplusplus } #endif - -#endif // MMTK_GC diff --git a/src/gc-page-profiler.c b/src/gc-page-profiler.c index e5c6b919787318..2625fa812781a7 100644 --- a/src/gc-page-profiler.c +++ b/src/gc-page-profiler.c @@ -1,6 +1,5 @@ // This file is a part of Julia. License is MIT: https://julialang.org/license -#ifndef MMTK_GC #include "gc-page-profiler.h" #include "julia.h" @@ -179,5 +178,3 @@ JL_DLLEXPORT void jl_gc_take_page_profile(ios_t *stream) #ifdef __cplusplus } #endif - -#endif // !MMTK_GC diff --git a/src/gc-pages.c b/src/gc-pages.c index 976fc461d5b95c..71d59de29166f5 100644 --- a/src/gc-pages.c +++ b/src/gc-pages.c @@ -1,6 +1,5 @@ // This file is a part of Julia. License is MIT: https://julialang.org/license -#ifndef MMTK_GC #include "gc-common.h" #include "gc-stock.h" #ifndef _OS_WINDOWS_ @@ -206,5 +205,3 @@ void jl_gc_free_page(jl_gc_pagemeta_t *pg) JL_NOTSAFEPOINT #ifdef __cplusplus } #endif - -#endif // !MMTK_GC diff --git a/src/gc-stacks.c b/src/gc-stacks.c index a0ca2561c5cf95..d0a5d2a9683268 100644 --- a/src/gc-stacks.c +++ b/src/gc-stacks.c @@ -1,7 +1,6 @@ // This file is a part of Julia. License is MIT: https://julialang.org/license #include "gc-common.h" -#include "gc-stock.h" #include "threading.h" #ifndef _OS_WINDOWS_ # include diff --git a/src/gc-stock.c b/src/gc-stock.c index c0bfc26cabc6bd..2cd7be078ae828 100644 --- a/src/gc-stock.c +++ b/src/gc-stock.c @@ -1,6 +1,5 @@ // This file is a part of Julia. License is MIT: https://julialang.org/license -#ifndef MMTK_GC #include "gc-common.h" #include "gc-stock.h" #include "gc-alloc-profiler.h" @@ -4000,5 +3999,3 @@ JL_DLLEXPORT const char* jl_active_gc_impl(void) { #ifdef __cplusplus } #endif - -#endif // !MMTK_GC diff --git a/src/gc-stock.h b/src/gc-stock.h index 08b0999ed5c3a3..710c3adf46af3d 100644 --- a/src/gc-stock.h +++ b/src/gc-stock.h @@ -5,8 +5,6 @@ . non-moving, precise mark and sweep collector . pool-allocates small objects, keeps big objects on a simple list */ -#ifndef MMTK_GC - #ifndef JL_GC_H #define JL_GC_H @@ -727,6 +725,3 @@ void _report_gc_finished(uint64_t pause, uint64_t freed, int full, int recollect #endif #endif - - -#endif // !MMTK_GC diff --git a/src/gc-tls-mmtk.h b/src/gc-tls-mmtk.h index 7b1b249cd8ae3e..01791345b69843 100644 --- a/src/gc-tls-mmtk.h +++ b/src/gc-tls-mmtk.h @@ -1,7 +1,5 @@ // This file is a part of Julia. License is MIT: https://julialang.org/license -#ifdef MMTK_GC - #include #include "mmtkMutator.h" @@ -17,5 +15,3 @@ typedef struct { #ifdef __cplusplus } #endif - -#endif // MMTK_GC diff --git a/src/gc-tls.h b/src/gc-tls-stock.h similarity index 98% rename from src/gc-tls.h rename to src/gc-tls-stock.h index dad914b8c11800..d82506383c5016 100644 --- a/src/gc-tls.h +++ b/src/gc-tls-stock.h @@ -1,7 +1,5 @@ // This file is a part of Julia. License is MIT: https://julialang.org/license -#ifndef MMTK_GC - // Meant to be included in "julia_threads.h" #ifndef JL_GC_TLS_H #define JL_GC_TLS_H @@ -68,5 +66,3 @@ typedef struct { #endif #endif // JL_GC_TLS_H - -#endif // MMTK_GC diff --git a/src/julia_threads.h b/src/julia_threads.h index f7b66aeb52f79b..b6ef65dc7fe52a 100644 --- a/src/julia_threads.h +++ b/src/julia_threads.h @@ -5,7 +5,7 @@ #define JL_THREADS_H #ifndef MMTK_GC -#include "gc-tls.h" +#include "gc-tls-stock.h" #else #include "gc-tls-mmtk.h" #endif