Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions packaging/dependencies.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,13 @@ scope: {
requiredSystemFeatures = [ ];
};

boehmgc = pkgs.boehmgc.override {
enableLargeConfig = true;
};
boehmgc =
(pkgs.boehmgc.override {
enableLargeConfig = true;
}).overrideAttrs
(attrs: {
patches = attrs.patches or [ ] ++ [ ./patches/bdwgc-bigger-mark-stack.patch ];
});

# TODO Hack until https://github.com/NixOS/nixpkgs/issues/45462 is fixed.
boost =
Expand Down
16 changes: 16 additions & 0 deletions packaging/patches/bdwgc-bigger-mark-stack.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Increase the initial mark stack size to avoid stack overflows, since
these inhibit parallel marking (see GC_mark_some()).

diff --git a/mark.c b/mark.c
index 50e6cfd7..907f7763 100644
--- a/mark.c
+++ b/mark.c
@@ -66,7 +66,7 @@ GC_INNER struct obj_kind GC_obj_kinds[MAXOBJKINDS] = {
};

# ifndef INITIAL_MARK_STACK_SIZE
-# define INITIAL_MARK_STACK_SIZE (1*HBLKSIZE)
+# define INITIAL_MARK_STACK_SIZE (256*HBLKSIZE)
Comment thread
edolstra marked this conversation as resolved.
Outdated
/* INITIAL_MARK_STACK_SIZE * sizeof(mse) should be a */
/* multiple of HBLKSIZE. */
/* The incremental collector actually likes a larger */
5 changes: 3 additions & 2 deletions src/libexpr/eval-gc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# include <pthread_np.h>
# endif

# include <gc/gc.h>
# include <gc/gc_cpp.h>
# include <gc/gc_allocator.h>

# include <boost/coroutine2/coroutine.hpp>
Expand Down Expand Up @@ -53,6 +51,9 @@ static inline void initGCReal()

GC_INIT();

/* Enable parallel marking. */
GC_allow_register_threads();

/* Register valid displacements in case we are using alignment niches
for storing the type information. This way tagged pointers are considered
to be valid, even when they are not aligned. */
Expand Down
3 changes: 2 additions & 1 deletion src/libexpr/include/nix/expr/eval-gc.hh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

#include <cstddef>

// For `NIX_USE_BOEHMGC`, and if that's set, `GC_THREADS`
// For `NIX_USE_BOEHMGC`
#include "nix/expr/config.hh"

#if NIX_USE_BOEHMGC

# define GC_INCLUDE_NEW
# define GC_THREADS 1

# include <gc/gc.h>
# include <gc/gc_cpp.h>
Expand Down
3 changes: 0 additions & 3 deletions src/libexpr/include/nix/expr/eval-inline.hh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
#include "nix/expr/eval-error.hh"
#include "nix/expr/eval-settings.hh"

// For `NIX_USE_BOEHMGC`, and if that's set, `GC_THREADS`
#include "nix/expr/config.hh"

namespace nix {

/**
Expand Down
2 changes: 0 additions & 2 deletions src/libexpr/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ if bdw_gc.found()
define_value = cxx.has_function(funcspec).to_int()
configdata_priv.set(define_name, define_value)
endforeach
# Affects ABI, because it changes what bdw_gc itself does!
configdata_pub.set('GC_THREADS', 1)
endif
# Used in public header. Affects ABI!
configdata_pub.set('NIX_USE_BOEHMGC', bdw_gc.found().to_int())
Expand Down
Loading