diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-23T04·07+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-23T05·18+0100 |
commit | 85a05a6f38b997082b4a88d7b80dfa1c1c35a88d (patch) | |
tree | 578e938b747d32e15efba1894a9a90457015360a /third_party | |
parent | da4ca4e02f59d8d69f9996bd8de2f20f72d1d5ff (diff) |
fix(3p/nix/libexpr): Remove the global empty attribute set r/821
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!
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/nix/src/libexpr/attr-set.cc | 4 | ||||
-rw-r--r-- | third_party/nix/src/libexpr/eval.cc | 4 | ||||
-rw-r--r-- | third_party/nix/src/libexpr/eval.hh | 2 |
3 files changed, 0 insertions, 10 deletions
diff --git a/third_party/nix/src/libexpr/attr-set.cc b/third_party/nix/src/libexpr/attr-set.cc index 0e4cf5d9dc5f..495f9816c7aa 100644 --- a/third_party/nix/src/libexpr/attr-set.cc +++ b/third_party/nix/src/libexpr/attr-set.cc @@ -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(); diff --git a/third_party/nix/src/libexpr/eval.cc b/third_party/nix/src/libexpr/eval.cc index b406854f4e20..fc1824db8e04 100644 --- a/third_party/nix/src/libexpr/eval.cc +++ b/third_party/nix/src/libexpr/eval.cc @@ -361,10 +361,6 @@ EvalState::EvalState(const Strings& _searchPath, const ref<Store>& store) } } - clearValue(vEmptySet); - vEmptySet.type = tAttrs; - vEmptySet.attrs = Bindings::NewGC(); - createBaseEnv(); } diff --git a/third_party/nix/src/libexpr/eval.hh b/third_party/nix/src/libexpr/eval.hh index 03dd275edc4e..531294c93ca2 100644 --- a/third_party/nix/src/libexpr/eval.hh +++ b/third_party/nix/src/libexpr/eval.hh @@ -75,8 +75,6 @@ class EvalState { mode. */ std::optional<PathSet> allowedPaths; - Value vEmptySet; - const ref<Store> store; private: |