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:
commit
6b6a1e14ce
5 changed files with 18 additions and 11 deletions
|
|
@ -50,9 +50,19 @@ scope: {
|
||||||
requiredSystemFeatures = [ ];
|
requiredSystemFeatures = [ ];
|
||||||
};
|
};
|
||||||
|
|
||||||
boehmgc = pkgs.boehmgc.override {
|
boehmgc =
|
||||||
enableLargeConfig = true;
|
(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.
|
# TODO Hack until https://github.com/NixOS/nixpkgs/issues/45462 is fixed.
|
||||||
boost =
|
boost =
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,6 @@
|
||||||
# include <pthread_np.h>
|
# include <pthread_np.h>
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# include <gc/gc.h>
|
|
||||||
# include <gc/gc_cpp.h>
|
|
||||||
# include <gc/gc_allocator.h>
|
# include <gc/gc_allocator.h>
|
||||||
|
|
||||||
# include <boost/coroutine2/coroutine.hpp>
|
# include <boost/coroutine2/coroutine.hpp>
|
||||||
|
|
@ -53,6 +51,9 @@ static inline void initGCReal()
|
||||||
|
|
||||||
GC_INIT();
|
GC_INIT();
|
||||||
|
|
||||||
|
/* Enable parallel marking. */
|
||||||
|
GC_allow_register_threads();
|
||||||
|
|
||||||
/* Register valid displacements in case we are using alignment niches
|
/* Register valid displacements in case we are using alignment niches
|
||||||
for storing the type information. This way tagged pointers are considered
|
for storing the type information. This way tagged pointers are considered
|
||||||
to be valid, even when they are not aligned. */
|
to be valid, even when they are not aligned. */
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,13 @@
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
// For `NIX_USE_BOEHMGC`, and if that's set, `GC_THREADS`
|
// For `NIX_USE_BOEHMGC`
|
||||||
#include "nix/expr/config.hh"
|
#include "nix/expr/config.hh"
|
||||||
|
|
||||||
#if NIX_USE_BOEHMGC
|
#if NIX_USE_BOEHMGC
|
||||||
|
|
||||||
# define GC_INCLUDE_NEW
|
# define GC_INCLUDE_NEW
|
||||||
|
# define GC_THREADS 1
|
||||||
|
|
||||||
# include <gc/gc.h>
|
# include <gc/gc.h>
|
||||||
# include <gc/gc_cpp.h>
|
# include <gc/gc_cpp.h>
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,6 @@
|
||||||
#include "nix/expr/eval-error.hh"
|
#include "nix/expr/eval-error.hh"
|
||||||
#include "nix/expr/eval-settings.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 {
|
namespace nix {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,6 @@ if bdw_gc.found()
|
||||||
define_value = cxx.has_function(funcspec).to_int()
|
define_value = cxx.has_function(funcspec).to_int()
|
||||||
configdata_priv.set(define_name, define_value)
|
configdata_priv.set(define_name, define_value)
|
||||||
endforeach
|
endforeach
|
||||||
# Affects ABI, because it changes what bdw_gc itself does!
|
|
||||||
configdata_pub.set('GC_THREADS', 1)
|
|
||||||
endif
|
endif
|
||||||
# Used in public header. Affects ABI!
|
# Used in public header. Affects ABI!
|
||||||
configdata_pub.set('NIX_USE_BOEHMGC', bdw_gc.found().to_int())
|
configdata_pub.set('NIX_USE_BOEHMGC', bdw_gc.found().to_int())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue