fix(3p/nix/libexpr): Remove the global empty attribute set

In the change to the backing structure of attribute sets, the
requirement to manually balance the capacity of the structure went
away.

This is a) because Abseil's data structures manage this on their own,
and b) because the new Bindings class is allocated using `new (GC)`
rather than writing into a predefined memory area.

As part of this change functions related to the capacity were
deprecated and set to 0 values, which in turn caused the creation of
new attribute sets to return the same (mutable!) default value in
various cases, leading to "side effects" that caused evaluation
failures.

FWIW, I'm not sure if this optimisation had noticeable performance
impact, but while untangling libexpr it definitely doesn't help trying
to follow what it's doing - so bye, bye!
This commit is contained in:
Vincent Ambo 2020-05-23 05:07:20 +01:00
parent da4ca4e02f
commit 85a05a6f38
3 changed files with 0 additions and 10 deletions

View file

@ -71,10 +71,6 @@ void Bindings::merge(Bindings* other) {
Bindings* Bindings::NewGC() { return new (GC) Bindings; }
void EvalState::mkAttrs(Value& v, size_t capacity) {
if (capacity == 0) {
v = vEmptySet;
return;
}
clearValue(v);
v.type = tAttrs;
v.attrs = Bindings::NewGC();

View file

@ -361,10 +361,6 @@ EvalState::EvalState(const Strings& _searchPath, const ref<Store>& store)
}
}
clearValue(vEmptySet);
vEmptySet.type = tAttrs;
vEmptySet.attrs = Bindings::NewGC();
createBaseEnv();
}

View file

@ -75,8 +75,6 @@ class EvalState {
mode. */
std::optional<PathSet> allowedPaths;
Value vEmptySet;
const ref<Store> store;
private: