1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-28 05:00:58 +01:00

Merge pull request #13708 from NixOS/parallel-mark-2

Enable parallel marking in boehm-gc
This commit is contained in:
Sergei Zimmerman 2025-08-07 13:56:06 +03:00 committed by GitHub
commit 6b6a1e14ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 18 additions and 11 deletions

View file

@ -50,9 +50,19 @@ scope: {
requiredSystemFeatures = [ ];
};
boehmgc = pkgs.boehmgc.override {
enableLargeConfig = true;
};
boehmgc =
(pkgs.boehmgc.override {
enableLargeConfig = true;
}).overrideAttrs
(attrs: {
# Increase the initial mark stack size to avoid stack
# overflows, since these inhibit parallel marking (see
# GC_mark_some()). To check whether the mark stack is too
# small, run Nix with GC_PRINT_STATS=1 and look for messages
# such as `Mark stack overflow`, `No room to copy back mark
# stack`, and `Grew mark stack to ... frames`.
NIX_CFLAGS_COMPILE = "-DINITIAL_MARK_STACK_SIZE=1048576";
});
# TODO Hack until https://github.com/NixOS/nixpkgs/issues/45462 is fixed.
boost =

View file

@ -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>
@ -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. */

View file

@ -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>

View file

@ -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 {
/**

View file

@ -61,8 +61,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())