refactor(tvix): completely remove boehm gc

We have decided that leaking memory is a better fate than random,
non-debuggable memory corruption. Future CLs will begin changing
various fields to std::unique_ptr and std::shared_ptr.

It turns out that disabling the GC does not have disasterous impact.
The Nix evaluator only runs on the client CLI, never in any long-
running process. Even the REPL does not leak too badly under this
change, because it uses one EvalState for the duration of the REPL.

Building an explicitly tracing garbage collector is likely in the
future of this project, but that giant amount of work cannot be
done under a nix evaluator that is constantly crashing. We need to
restore development velocity here, and this is the best way we've
figured out to do it.

Change-Id: I2fcda8fcee853c15a9a5e22eca7c5a784bc2bf76
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1720
Reviewed-by: glittershark <grfn@gws.fyi>
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
This commit is contained in:
Kane York 2020-08-13 15:18:40 -07:00 committed by kanepyork
parent d4f5fcef66
commit 72e61aa584
15 changed files with 51 additions and 170 deletions

View file

@ -290,11 +290,7 @@ struct CompareValues {
}
};
#if HAVE_BOEHMGC
typedef std::list<Value*, gc_allocator<Value*>> ValueList;
#else
typedef std::list<Value*> ValueList;
#endif
static void prim_genericClosure(EvalState& state, const Pos& pos, Value** args,
Value& v) {
@ -1603,7 +1599,7 @@ static void prim_sort(EvalState& state, const Pos& pos, Value** args,
state.forceList(*args[1], pos);
// Copy of the input list which can be sorted in place.
auto outlist = new (GC) NixList(*args[1]->list);
auto outlist = new NixList(*args[1]->list);
std::for_each(outlist->begin(), outlist->end(),
[&](Value* val) { state.forceValue(*val); });
@ -1633,8 +1629,8 @@ static void prim_partition(EvalState& state, const Pos& pos, Value** args,
state.forceFunction(*args[0], pos);
state.forceList(*args[1], pos);
NixList* right = new (GC) NixList();
NixList* wrong = new (GC) NixList();
NixList* right = new NixList();
NixList* wrong = new NixList();
for (Value* elem : *args[1]->list) {
state.forceValue(*elem, pos);
@ -1664,7 +1660,7 @@ static void prim_concatMap(EvalState& state, const Pos& pos, Value** args,
state.forceFunction(*args[0], pos);
state.forceList(*args[1], pos);
NixList* outlist = new (GC) NixList;
NixList* outlist = new NixList;
for (Value* elem : *args[1]->list) {
auto out = state.allocValue();