mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 05:56:15 +02:00
nix: Disable GC during coroutine when bdwgc < 8.4
This re-enables support for older bwdgc versions without complicating the code too much. Coroutines generally only interfere with GC during source filtering, so it's not too bad of a regression on older bdwgc. This seems preferable over conditional compilation to enable the patch etc; we've already spent a lot of complexity budget on this GC-coroutine interaction...
This commit is contained in:
parent
b311f51f84
commit
cc6f315252
2 changed files with 11 additions and 7 deletions
|
@ -366,7 +366,7 @@ fi
|
||||||
AC_ARG_ENABLE(gc, AS_HELP_STRING([--enable-gc],[enable garbage collection in the Nix expression evaluator (requires Boehm GC) [default=yes]]),
|
AC_ARG_ENABLE(gc, AS_HELP_STRING([--enable-gc],[enable garbage collection in the Nix expression evaluator (requires Boehm GC) [default=yes]]),
|
||||||
gc=$enableval, gc=yes)
|
gc=$enableval, gc=yes)
|
||||||
if test "$gc" = yes; then
|
if test "$gc" = yes; then
|
||||||
PKG_CHECK_MODULES([BDW_GC], [bdw-gc >= 8.2.4])
|
PKG_CHECK_MODULES([BDW_GC], [bdw-gc])
|
||||||
CXXFLAGS="$BDW_GC_CFLAGS $CXXFLAGS"
|
CXXFLAGS="$BDW_GC_CFLAGS $CXXFLAGS"
|
||||||
AC_DEFINE(HAVE_BOEHMGC, 1, [Whether to use the Boehm garbage collector.])
|
AC_DEFINE(HAVE_BOEHMGC, 1, [Whether to use the Boehm garbage collector.])
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -348,14 +348,14 @@ void initGC()
|
||||||
|
|
||||||
GC_set_oom_fn(oomHandler);
|
GC_set_oom_fn(oomHandler);
|
||||||
|
|
||||||
// TODO: Comment suggests an implementation that works on darwin and windows
|
|
||||||
// https://github.com/ivmai/bdwgc/issues/362#issuecomment-1936672196
|
|
||||||
#ifndef __APPLE__
|
|
||||||
GC_set_sp_corrector(&fixupBoehmStackPointer);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
StackAllocator::defaultAllocator = &boehmGCStackAllocator;
|
StackAllocator::defaultAllocator = &boehmGCStackAllocator;
|
||||||
|
|
||||||
|
// TODO: Remove __APPLE__ condition.
|
||||||
|
// Comment suggests an implementation that works on darwin and windows
|
||||||
|
// https://github.com/ivmai/bdwgc/issues/362#issuecomment-1936672196
|
||||||
|
#if GC_VERSION_MAJOR >= 8 && GC_VERSION_MINOR >= 4 && !defined(__APPLE__)
|
||||||
|
GC_set_sp_corrector(&fixupBoehmStackPointer);
|
||||||
|
|
||||||
if (!GC_get_sp_corrector()) {
|
if (!GC_get_sp_corrector()) {
|
||||||
printTalkative("BoehmGC on this platform does not support sp_corrector; will disable GC inside coroutines");
|
printTalkative("BoehmGC on this platform does not support sp_corrector; will disable GC inside coroutines");
|
||||||
/* Used to disable GC when entering coroutines on macOS */
|
/* Used to disable GC when entering coroutines on macOS */
|
||||||
|
@ -363,6 +363,10 @@ void initGC()
|
||||||
return std::make_shared<BoehmDisableGC>();
|
return std::make_shared<BoehmDisableGC>();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#warning "BoehmGC version does not support GC while coroutine exists. GC will be disabled inside coroutines. Consider updating bwd-gc to 8.4 or later."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Set the initial heap size to something fairly big (25% of
|
/* Set the initial heap size to something fairly big (25% of
|
||||||
physical RAM, up to a maximum of 384 MiB) so that in most cases
|
physical RAM, up to a maximum of 384 MiB) so that in most cases
|
||||||
|
|
Loading…
Reference in a new issue