wingo pushed a commit to branch wip-whippet in repository guile. commit bb65e18d680e83b2f1c341a4e39bab0b65f8d446 Merge: 9de24bd42 86baf260c Author: Andy Wingo <wi...@pobox.com> AuthorDate: Tue Jul 1 13:19:38 2025 +0200
Merge remote-tracking branch 'whippet/main' into wip-whippet libguile/whippet/api/gc-allocate.h | 142 ++++++++++++++ libguile/whippet/api/gc-api.h | 250 ------------------------- libguile/whippet/api/gc-barrier.h | 98 ++++++++++ libguile/whippet/api/gc-safepoint.h | 46 +++++ libguile/whippet/benchmarks/ephemerons.c | 1 + libguile/whippet/benchmarks/finalizers.c | 1 + libguile/whippet/benchmarks/mt-gcbench.c | 1 + libguile/whippet/benchmarks/quads.c | 1 + libguile/whippet/benchmarks/simple-allocator.h | 1 + libguile/whippet/embed.am | 3 + libguile/whippet/src/gc-internal.h | 3 + 11 files changed, 297 insertions(+), 250 deletions(-) diff --cc libguile/whippet/api/gc-allocate.h index 000000000,f6c76ebc5..f6c76ebc5 mode 000000,100644..100644 --- a/libguile/whippet/api/gc-allocate.h +++ b/libguile/whippet/api/gc-allocate.h diff --cc libguile/whippet/api/gc-barrier.h index 000000000,9995793ed..9995793ed mode 000000,100644..100644 --- a/libguile/whippet/api/gc-barrier.h +++ b/libguile/whippet/api/gc-barrier.h diff --cc libguile/whippet/api/gc-safepoint.h index 000000000,c0e24b285..c0e24b285 mode 000000,100644..100644 --- a/libguile/whippet/api/gc-safepoint.h +++ b/libguile/whippet/api/gc-safepoint.h diff --cc libguile/whippet/embed.am index 12200c693,000000000..1e4a87c3a mode 100644,000000..100644 --- a/libguile/whippet/embed.am +++ b/libguile/whippet/embed.am @@@ -1,196 -1,0 +1,199 @@@ +# Automake snippet for embedding Whippet in an autotools project. +# +# The including Makefile.am needs to do this, assuming Whippet is in the +# whippet/ subdirectory: +# +# noinst_LTLIBRARIES = +# WHIPPET_EMBEDDER_H = $(srcdir)/src/my-embedder.h +# include whippet/embed.am +# +# my-embedder.h should provide the various hooks that Whippet needs to +# specialize itself to the embedder's object representation. +# +# The result is a libwhippet.la. To compile and link against it: +# +# AM_CPPFLAGS = $(WHIPPET_CPPFLAGS) +# LDADD = libwhippet.la +# +# The assumption is that the embedder will build a single copy of +# Whippet, specialized against a single collector, a single set of +# embedder hooks, and a single target platform. The collector and +# platform should be chosen at configure-time. Because Automake really +# wants the set of source files to be visible to it at automake-time, we +# need to implement these conditions via AM_CONDITIONAL in a +# configure.ac. For example for a parallel-mmc configuration on +# gnu-linux, we would need: +# +# AM_SUBST(WHIPPET_COLLECTOR, parallel-mmc) +# AM_CONDITIONAL(WHIPPET_COLLECTOR_SEMI, 0) +# AM_CONDITIONAL(WHIPPET_COLLECTOR_PCC, 0) +# AM_CONDITIONAL(WHIPPET_COLLECTOR_BDW, 0) +# AM_CONDITIONAL(WHIPPET_COLLECTOR_MMC, 1) +# AM_CONDITIONAL(WHIPPET_PLATFORM_GNU_LINUX, 1) +# +# Then there are other conditionals for compilation options: +# +# AM_CONDITIONAL(WHIPPET_ENABLE_DEBUG, 0) +# AM_CONDITIONAL(WHIPPET_USE_LTTNG, 1) +# +# Finally, LTO should be enabled, for best performance. This should be +# added to CFLAGS at configure-time. +# +# Getting all of this in there is gnarly. See the example configure.ac +# for one take on the topic. + +noinst_LTLIBRARIES += libwhippet.la + +libwhippet_la_SOURCES = \ + %D%/api/bdw-attrs.h \ ++ %D%/api/gc-allocate.h \ + %D%/api/gc-allocation-kind.h \ + %D%/api/gc-api.h \ + %D%/api/gc-assert.h \ + %D%/api/gc-attrs.h \ ++ %D%/api/gc-barrier.h \ + %D%/api/gc-basic-stats.h \ + %D%/api/gc-collection-kind.h \ + %D%/api/gc-config.h \ + %D%/api/gc-conservative-ref.h \ + %D%/api/gc-edge.h \ + %D%/api/gc-embedder-api.h \ + %D%/api/gc-ephemeron.h \ + %D%/api/gc-event-listener-chain.h \ + %D%/api/gc-event-listener.h \ + %D%/api/gc-finalizer.h \ + %D%/api/gc-forwarding.h \ + %D%/api/gc-histogram.h \ + %D%/api/gc-inline.h \ + %D%/api/gc-lttng.h \ + %D%/api/gc-null-event-listener.h \ + %D%/api/gc-options.h \ + %D%/api/gc-ref.h \ ++ %D%/api/gc-safepoint.h \ + %D%/api/gc-stack-addr.h \ + %D%/api/gc-tracepoint.h \ + %D%/api/gc-visibility.h \ + %D%/api/mmc-attrs.h \ + %D%/api/pcc-attrs.h \ + %D%/api/semi-attrs.h \ + %D%/src/adaptive-heap-sizer.h \ + %D%/src/address-hash.h \ + %D%/src/address-map.h \ + %D%/src/address-set.h \ + %D%/src/assert.h \ + %D%/src/background-thread.h \ + %D%/src/copy-space.h \ + %D%/src/debug.h \ + %D%/src/embedder-api-impl.h \ + %D%/src/extents.h \ + %D%/src/field-set.h \ + %D%/src/freelist.h \ + %D%/src/gc-align.h \ + %D%/src/gc-ephemeron-internal.h \ + %D%/src/gc-ephemeron.c \ + %D%/src/gc-finalizer-internal.h \ + %D%/src/gc-finalizer.c \ + %D%/src/gc-internal.h \ + %D%/src/gc-lock.h \ + %D%/src/gc-options-internal.h \ + %D%/src/gc-options.c \ + %D%/src/gc-platform.h \ + %D%/src/gc-stack.c \ + %D%/src/gc-stack.h \ + %D%/src/gc-trace.h \ + %D%/src/gc-tracepoint.c \ + %D%/src/growable-heap-sizer.h \ + %D%/src/heap-sizer.h \ + %D%/src/large-object-space.h \ + %D%/src/local-worklist.h \ + %D%/src/nofl-space.h \ + %D%/src/parallel-tracer.h \ + %D%/src/root-worklist.h \ + %D%/src/root.h \ + %D%/src/serial-tracer.h \ + %D%/src/shared-worklist.h \ + %D%/src/simple-worklist.h \ + %D%/src/spin.h \ + %D%/src/splay-tree.h \ + %D%/src/swar.h \ + %D%/src/tracer.h + +if WHIPPET_PLATFORM_GNU_LINUX +libwhippet_la_SOURCES += %D%/src/gc-platform-gnu-linux.c +endif + +WHIPPET_CPPFLAGS_bdw = -DGC_CONSERVATIVE_ROOTS=1 -DGC_CONSERVATIVE_TRACE=1 +WHIPPET_CPPFLAGS_semi = -DGC_PRECISE_ROOTS=1 +WHIPPET_CPPFLAGS_pcc = -DGC_PRECISE_ROOTS=1 -DGC_PARALLEL=1 +WHIPPET_CPPFLAGS_generational_pcc = $(WHIPPET_CPPFLAGS_pcc) -DGC_GENERATIONAL=1 +WHIPPET_CPPFLAGS_mmc = \ + -DGC_PRECISE_ROOTS=1 +WHIPPET_CPPFLAGS_generational_mmc = \ + -DGC_PRECISE_ROOTS=1 -DGC_GENERATIONAL=1 +WHIPPET_CPPFLAGS_parallel_mmc = \ + -DGC_PRECISE_ROOTS=1 -DGC_PARALLEL=1 +WHIPPET_CPPFLAGS_parallel_generational_mmc = \ + -DGC_PRECISE_ROOTS=1 -DGC_GENERATIONAL=1 -DGC_PARALLEL=1 +WHIPPET_CPPFLAGS_stack_conservative_mmc = \ + -DGC_CONSERVATIVE_ROOTS=1 +WHIPPET_CPPFLAGS_stack_conservative_generational_mmc = \ + -DGC_CONSERVATIVE_ROOTS=1 -DGC_GENERATIONAL=1 +WHIPPET_CPPFLAGS_stack_conservative_parallel_mmc = \ + -DGC_CONSERVATIVE_ROOTS=1 -DGC_PARALLEL=1 +WHIPPET_CPPFLAGS_stack_conservative_parallel_generational_mmc = \ + -DGC_CONSERVATIVE_ROOTS=1 -DGC_GENERATIONAL=1 -DGC_PARALLEL=1 +WHIPPET_CPPFLAGS_heap_conservative_mmc = \ + -DGC_CONSERVATIVE_ROOTS=1 -DGC_CONSERVATIVE_TRACE=1 +WHIPPET_CPPFLAGS_heap_conservative_generational_mmc = \ + -DGC_CONSERVATIVE_ROOTS=1 -DGC_CONSERVATIVE_TRACE=1 -DGC_GENERATIONAL=1 +WHIPPET_CPPFLAGS_heap_conservative_parallel_mmc = \ + -DGC_CONSERVATIVE_ROOTS=1 -DGC_CONSERVATIVE_TRACE=1 -DGC_PARALLEL=1 +WHIPPET_CPPFLAGS_heap_conservative_parallel_generational_mmc = \ + -DGC_CONSERVATIVE_ROOTS=1 -DGC_CONSERVATIVE_TRACE=1 -DGC_GENERATIONAL=1 -DGC_PARALLEL=1 + +WHIPPET_CPPFLAGS = $(WHIPPET_CPPFLAGS_$(subst -,_,$(WHIPPET_COLLECTOR))) +WHIPPET_CPPFLAGS += -I$(top_builddir) -I$(srcdir)/%D%/api +WHIPPET_IMPL_CFLAGS = -fno-strict-aliasing +WHIPPET_LIBS = -lm + +if WHIPPET_ENABLE_DEBUG +WHIPPET_CPPFLAGS += -DGC_DEBUG=1 +endif + +if WHIPPET_COLLECTOR_SEMI +libwhippet_la_SOURCES += %D%/src/semi.c +WHIPPET_CPPFLAGS += -DGC_ATTRS=\"$(srcdir)/%D%/api/semi-attrs.h\" +endif + +if WHIPPET_COLLECTOR_PCC +libwhippet_la_SOURCES += %D%/src/pcc.c +WHIPPET_CPPFLAGS += -DGC_ATTRS=\"$(srcdir)/%D%/api/pcc-attrs.h\" +endif + +if WHIPPET_COLLECTOR_BDW +libwhippet_la_SOURCES += %D%/src/bdw.c +WHIPPET_IMPL_CFLAGS += $(WHIPPET_BDW_CFLAGS) +WHIPPET_LIBS += $(WHIPPET_BDW_LIBS) +WHIPPET_CPPFLAGS += -DGC_ATTRS=\"$(srcdir)/%D%/api/bdw-attrs.h\" +endif + +if WHIPPET_COLLECTOR_MMC +libwhippet_la_SOURCES += %D%/src/mmc.c +WHIPPET_CPPFLAGS += -DGC_ATTRS=\"$(srcdir)/%D%/api/mmc-attrs.h\" +endif + +# add to cflags: -flto -fvisibility=hidden -fno-strict-aliasing + +libwhippet_la_CPPFLAGS = $(WHIPPET_CPPFLAGS) +libwhippet_la_CPPFLAGS += -DGC_EMBEDDER=\"../../$(WHIPPET_EMBEDDER_H)\" +libwhippet_la_CFLAGS = -Wall -Wno-unused $(CFLAGS) $(WHIPPET_IMPL_CFLAGS) +libwhippet_la_LDFLAGS = -lpthread $(LDFLAGS) $(WHIPPET_LIBS) + +if !WHIPPET_ENABLE_DEBUG +libwhippet_la_CPPFLAGS += -DNDEBUG +endif + +if WHIPPET_USE_LTTNG +libwhippet_la_CPPFLAGS += $(WHIPPET_LTTNG_CFLAGS) -DGC_TRACEPOINT_LTTNG=1 +WHIPPET_LIBS += $(WHIPPET_LTTNG_LIBS) +endif