1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 10:41:16 +02:00

Revert use of boost::container::small_vector in the evaluator

It caused random crashes (https://hydra.nixos.org/build/241514506,
https://hydra.nixos.org/build/241443330) because the heap allocation
done by small_vector in the not-small case is not scanned for GC
roots.
This commit is contained in:
Eelco Dolstra 2023-11-20 12:35:35 +01:00
parent fb68699456
commit 1d6abec993
2 changed files with 9 additions and 9 deletions

View file

@ -2729,7 +2729,7 @@ static void prim_catAttrs(EvalState & state, const PosIdx pos, Value * * args, V
auto attrName = state.symbols.create(state.forceStringNoCtx(*args[0], pos, "while evaluating the first argument passed to builtins.catAttrs"));
state.forceList(*args[1], pos, "while evaluating the second argument passed to builtins.catAttrs");
boost::container::small_vector<Value *, nonRecursiveStackReservation> res(args[1]->listSize());
Value * res[args[1]->listSize()];
size_t found = 0;
for (auto v2 : args[1]->listItems()) {
@ -3064,7 +3064,8 @@ static void prim_filter(EvalState & state, const PosIdx pos, Value * * args, Val
state.forceFunction(*args[0], pos, "while evaluating the first argument passed to builtins.filter");
boost::container::small_vector<Value *, nonRecursiveStackReservation> vs(args[1]->listSize());
// FIXME: putting this on the stack is risky.
Value * vs[args[1]->listSize()];
size_t k = 0;
bool same = true;
@ -3453,7 +3454,7 @@ static void prim_concatMap(EvalState & state, const PosIdx pos, Value * * args,
state.forceList(*args[1], pos, "while evaluating the second argument passed to builtins.concatMap");
auto nrLists = args[1]->listSize();
boost::container::small_vector<Value, conservativeStackReservation> lists(nrLists);
Value lists[nrLists];
size_t len = 0;
for (unsigned int n = 0; n < nrLists; ++n) {