@@ -29,6 +29,10 @@ ifeq ($(USECLANG),1)
2929FLAGS += -Wno-return-type-c-linkage -Wno-atomic-alignment
3030endif
3131
32+ ifneq (${MMTK_PLAN},None)
33+ FLAGS += -I$(MMTK_API_INC )
34+ endif
35+
3236FLAGS += -DJL_BUILD_ARCH='"$(ARCH ) "'
3337ifeq ($(OS ) ,WINNT)
3438FLAGS += -DJL_BUILD_UNAME='"NT"'
@@ -40,23 +44,41 @@ ifeq ($(OS),FreeBSD)
4044FLAGS += -I$(LOCALBASE ) /include
4145endif
4246
47+ # GC source code. It depends on which GC implementation to use.
48+ GC_SRCS := gc-common gc-stacks gc-alloc-profiler gc-heap-snapshot
49+ ifneq (${MMTK_PLAN},None)
50+ GC_SRCS += gc-mmtk
51+ else
52+ GC_SRCS += gc-stock gc-debug gc-pages gc-page-profiler
53+ endif
54+
4355SRCS := \
4456 jltypes gf typemap smallintset ast builtins module interpreter symbol \
4557 dlload sys init task array genericmemory staticdata toplevel jl_uv datatype \
4658 simplevector runtime_intrinsics precompile jloptions mtarraylist \
47- threading scheduler stackwalk gc-common gc-stock gc-debug gc-pages gc-stacks gc-alloc-profiler gc-page-profiler method \
48- jlapi signal-handling safepoint timing subtype rtutils gc-heap-snapshot \
49- crc32c APInt-C processor ircode opaque_closure codegen-stubs coverage runtime_ccall engine
59+ threading scheduler stackwalk \
60+ method jlapi signal-handling safepoint timing subtype rtutils \
61+ crc32c APInt-C processor ircode opaque_closure codegen-stubs coverage runtime_ccall engine \
62+ $(GC_SRCS )
5063
5164RT_LLVMLINK :=
5265CG_LLVMLINK :=
5366
5467ifeq ($(JULIACODEGEN ) ,LLVM)
68+ # Currently these files are used by both GCs. But we should make the list specific to stock, and MMTk should have its own implementation.
69+ GC_CODEGEN_SRCS := llvm-final-gc-lowering llvm-late-gc-lowering llvm-gc-invariant-verifier
70+ ifneq (${MMTK_PLAN},None)
71+ FLAGS += -I$(MMTK_API_INC )
72+ GC_CODEGEN_SRCS += llvm-late-gc-lowering-mmtk
73+ else
74+ GC_CODEGEN_SRCS += llvm-late-gc-lowering-stock
75+ endif
5576CODEGEN_SRCS := codegen jitlayers aotcompile debuginfo disasm llvm-simdloop \
56- llvm-final-gc-lowering llvm- pass-helpers llvm-late-gc-lowering llvm-ptls \
57- llvm-lower-handlers llvm-gc-invariant-verifier llvm- propagate-addrspaces \
77+ llvm-pass-helpers llvm-ptls \
78+ llvm-lower-handlers llvm-propagate-addrspaces \
5879 llvm-multiversioning llvm-alloc-opt llvm-alloc-helpers cgmemmgr llvm-remove-addrspaces \
59- llvm-remove-ni llvm-julia-licm llvm-demote-float16 llvm-cpufeatures pipeline llvm_api
80+ llvm-remove-ni llvm-julia-licm llvm-demote-float16 llvm-cpufeatures pipeline llvm_api \
81+ $(GC_CODEGEN_SRCS )
6082FLAGS += -I$(shell $(LLVM_CONFIG_HOST ) --includedir)
6183CG_LLVM_LIBS := all
6284ifeq ($(USE_POLLY ) ,1)
@@ -99,7 +121,12 @@ ifeq ($(USE_SYSTEM_LIBUV),0)
99121UV_HEADERS += uv.h
100122UV_HEADERS += uv/*.h
101123endif
102- 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 julia.h julia_assert.h julia_threads.h julia_fasttls.h julia_locks.h julia_atomics.h jloptions.h)
124+ 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)
125+ ifneq (${MMTK_PLAN},None)
126+ PUBLIC_HEADERS += $(addprefix $(SRCDIR)/,gc-tls-mmtk.h)
127+ else
128+ PUBLIC_HEADERS += $(addprefix $(SRCDIR)/,gc-tls-stock.h)
129+ endif
103130ifeq ($(OS ) ,WINNT)
104131PUBLIC_HEADERS += $(addprefix $(SRCDIR ) /,win32_ucontext.h)
105132endif
@@ -164,8 +191,8 @@ LIBJULIA_PATH_REL := libjulia
164191endif
165192
166193COMMON_LIBPATHS := -L$(build_libdir ) -L$(build_shlibdir )
167- RT_LIBS := $(WHOLE_ARCHIVE ) $(LIBUV ) $(WHOLE_ARCHIVE ) $(LIBUTF8PROC ) $(NO_WHOLE_ARCHIVE ) $(LIBUNWIND ) $(RT_LLVMLINK ) $(OSLIBS ) $(LIBTRACYCLIENT ) $(LIBITTAPI )
168- CG_LIBS := $(LIBUNWIND ) $(CG_LLVMLINK ) $(OSLIBS ) $(LIBTRACYCLIENT ) $(LIBITTAPI )
194+ RT_LIBS := $(WHOLE_ARCHIVE ) $(LIBUV ) $(WHOLE_ARCHIVE ) $(LIBUTF8PROC ) $(NO_WHOLE_ARCHIVE ) $(LIBUNWIND ) $(RT_LLVMLINK ) $(OSLIBS ) $(LIBTRACYCLIENT ) $(LIBITTAPI ) $( MMTK_LIB )
195+ CG_LIBS := $(LIBUNWIND ) $(CG_LLVMLINK ) $(OSLIBS ) $(LIBTRACYCLIENT ) $(LIBITTAPI ) $( MMTK_LIB )
169196RT_DEBUG_LIBS := $(COMMON_LIBPATHS ) $(WHOLE_ARCHIVE ) $(BUILDDIR ) /flisp/libflisp-debug.a $(WHOLE_ARCHIVE ) $(BUILDDIR ) /support/libsupport-debug.a -ljulia-debug $(RT_LIBS )
170197CG_DEBUG_LIBS := $(COMMON_LIBPATHS ) $(CG_LIBS ) -ljulia-debug -ljulia-internal-debug
171198RT_RELEASE_LIBS := $(COMMON_LIBPATHS ) $(WHOLE_ARCHIVE ) $(BUILDDIR ) /flisp/libflisp.a $(WHOLE_ARCHIVE ) $(BUILDDIR ) /support/libsupport.a -ljulia $(RT_LIBS )
@@ -314,6 +341,7 @@ $(BUILDDIR)/debuginfo.o $(BUILDDIR)/debuginfo.dbg.obj: $(addprefix $(SRCDIR)/,de
314341$(BUILDDIR ) /disasm.o $(BUILDDIR ) /disasm.dbg.obj : $(SRCDIR ) /debuginfo.h $(SRCDIR ) /processor.h
315342$(BUILDDIR ) /gc-debug.o $(BUILDDIR ) /gc-debug.dbg.obj : $(SRCDIR ) /gc-common.h $(SRCDIR ) /gc-stock.h
316343$(BUILDDIR ) /gc-pages.o $(BUILDDIR ) /gc-pages.dbg.obj : $(SRCDIR ) /gc-common.h $(SRCDIR ) /gc-stock.h
344+ $(BUILDDIR ) /gc-mmtk.o $(BUILDDIR ) /gc-mmtk.dbg.obj : $(SRCDIR ) /gc-common.h $(SRCDIR ) /gc-heap-snapshot.h $(SRCDIR ) /gc-alloc-profiler.h
317345$(BUILDDIR ) /gc-stacks.o $(BUILDDIR ) /gc-stacks.dbg.obj : $(SRCDIR ) /gc-common.h $(SRCDIR ) /gc-stock.h
318346$(BUILDDIR ) /gc-stock.o $(BUILDDIR ) /gc.dbg.obj : $(SRCDIR ) /gc-common.h $(SRCDIR ) /gc-stock.h $(SRCDIR ) /gc-heap-snapshot.h $(SRCDIR ) /gc-alloc-profiler.h $(SRCDIR ) /gc-page-profiler.h
319347$(BUILDDIR ) /gc-heap-snapshot.o $(BUILDDIR ) /gc-heap-snapshot.dbg.obj : $(SRCDIR ) /gc-heap-snapshot.h
0 commit comments