about summary refs log tree commit diff
path: root/third_party/nix/src/libexpr/eval.cc (follow)
AgeCommit message (Collapse)AuthorFilesLines
2020-08-01 r/1534 fix(3p/nix): revert "apply all clang-tidy fixes"Kane York1-28/+27
This reverts commit ef54f5da9fa30b5c302f2a49595ee5d041f9706a. Resolved conflicts: third_party/nix/src/libexpr/eval.cc third_party/nix/src/libstore/builtins/fetchurl.cc third_party/nix/src/libstore/references.cc third_party/nix/src/libutil/hash.cc third_party/nix/src/nix-daemon/nix-daemon.cc Change-Id: Ib9cf6e96a79a23bde3983579ced3f92e530cb011 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1547 Reviewed-by: glittershark <grfn@gws.fyi> Tested-by: BuildkiteCI
2020-08-01 r/1528 fix(3p/nix/libexpr): fix GC tracing in valueSizeKane York1-25/+28
Change-Id: I2f6bef7b090d44f50bd27fbd19b50f9cf100b238 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1506 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi> Reviewed-by: tazjin <mail@tazj.in>
2020-08-01 r/1527 feat(3p/nix): remove External values featureKane York1-36/+9
External values are only useful when using the plugin framework, which we are not interested in carrying forward. Reverts commit 320659b0cd161249c95e736c3fb309b1a73ea728 Change-Id: Ib4929c349bbb33f16224fc674e94c7b7d5953c6a Reviewed-on: https://cl.tvl.fyi/c/depot/+/1505 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi> Reviewed-by: tazjin <mail@tazj.in>
2020-08-01 r/1526 fix(3p/nix): Use a proper pointer in Env to carry with-attrsKane York1-5/+8
This eliminates the value-smuggling that would trip up the GC. Change-Id: I8057df78cf0bf6bea9faf1b44233aa9820ae44f5 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1504 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi> Reviewed-by: tazjin <mail@tazj.in>
2020-08-01 r/1525 chore(3p/nix/libexpr): Cleanups and notes in eval.ccKane York1-3/+16
Add two more garbage-collection flags. Annotate how terrible tExternal is. Prepare to fix the smuggle casting in ExprWith. Add a static_cast. Change-Id: I20f980abc8cb192e094f539185900a6df5457c29 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1503 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi> Reviewed-by: tazjin <mail@tazj.in>
2020-07-27 r/1495 fix(3p/nix): apply all clang-tidy fixesKane York1-29/+32
Change-Id: I265e763393422ee1881653527c91024458060825 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1432 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
2020-07-19 r/1403 fix(3p/nix): Fix all remaining compiler warningsVincent Ambo1-1/+0
This compiles under `-Wall -Werror`. The largest chunk of this change is `final` qualifiers for the various Nix CLI command structs, which inherit from a Command class that has more virtual functions than are implemented by each command. Change-Id: I0925e6e1a39013f026773db5816e4a77d50f3b4a Reviewed-on: https://cl.tvl.fyi/c/depot/+/1294 Tested-by: BuildkiteCI Reviewed-by: isomer <isomer@tvl.fyi> Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-07-19 r/1400 refactor(3p/nix): Rename & undeprecate Bindings::lexicographicOrderVincent Ambo1-1/+1
The function is renamed to `SortedByKeys`, which is more descriptive, and annotated with a comment about what it is used for. The deprecation warning has been removed because this function is currently functionally required. Change-Id: I0ee3a76deff05f366feca9ddac8f38ab34bffbd0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1288 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
2020-07-18 r/1377 refactor(3p/nix/libexpr): Back Nix lists with std::vectorVincent Ambo1-60/+29
This change does away with the previous special-casing of lists of certain element sizes, and the use of raw C-style arrays. Lists are now backed by a std::vector of nix::Value*, which uses the traceable GC allocator. This change is unfortunately quite noisy because the accessor methods were updated/removed accordingly, so all callsites of Nix-related lists have changed. For some operations in primops.cc where keeping the previous code structure would have been more difficult with a "proper" vector, the implementation has been replaced with std::vector methods. For example, list concatenation now uses appropriate range inserts. Anecdotally the performance of this is about equal, to even slightly better, than the previous implementation. All language tests pass and the depot paths I've used for testing still evaluate. Change-Id: Ib5eca6c0207429cb323a330c838c3a2200b2c693 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1266 Tested-by: BuildkiteCI Reviewed-by: isomer <isomer@tvl.fyi> Reviewed-by: Kane York <rikingcoding@gmail.com> Reviewed-by: glittershark <grfn@gws.fyi>
2020-07-18 r/1376 refactor(3p/nix/libexpr): Store nix::Env values in a std::vectorVincent Ambo1-7/+1
This has several advantages: * we can ensure that the vector is traced by the GC * we don't need to unsafely allocate memory to make an Env Note that there was previously a check about the size of the environment, but it's unclear why this was the case (git history yielded nothing interesting) and it seems to have no effect. Change-Id: I4998b879a728a6fb68e1bd187c521e2304e5047e Reviewed-on: https://cl.tvl.fyi/c/depot/+/1265 Tested-by: BuildkiteCI Reviewed-by: isomer <isomer@tvl.fyi> Reviewed-by: Kane York <rikingcoding@gmail.com> Reviewed-by: glittershark <grfn@gws.fyi>
2020-07-17 r/1354 feat(3p/nix): Add function to allocate a Value in traceable memoryEelco Dolstra1-0/+7
Backported from: https://github.com/NixOS/nix/commit/b3e5eea4a91400fb2a12aba4b07a94d03ba54605 https://github.com/NixOS/nix/commit/fcd048a526bd239fa615457e77d61d69d679bf03 Intentionally skipped because we have not backported the JSON changes: https://github.com/NixOS/nix/commit/9f46f54de4e55267df492456fc0393f74616366b Did not apply changes ni primops.cc, because those look suspect and are also based on something that we don't have in our tree. Change-Id: I837787ce9f2c90267bc39fce15177980d209d4e9 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1253 Tested-by: BuildkiteCI Reviewed-by: isomer <isomer@tvl.fyi>
2020-07-16 r/1320 refactor(3p/nix/libexpr): Use range insertion to merge nix::BindingsVincent Ambo1-5/+4
Instead of manually iterating over the two bindings to be combined, this adds a new static method on the Bindings class which merges two attribute sets by calling the range insertion operator over them. In some anecdotal tests, this can lead to a ~10% speed bump - depending on the specific operation. Change-Id: I5dea03b0589a83a789d3a8a0fc81d0d9e6598371 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1216 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
2020-07-16 r/1306 refactor(3p/nix): Compare attribute sets by pointer equalityVincent Ambo1-0/+6
Paired-With: Perry Lorier <isomer@tvl.fyi> Change-Id: I418e9127c5d9d31559c59e461f17726ddbc051c4 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1180 Tested-by: BuildkiteCI Reviewed-by: glittershark <grfn@gws.fyi>
2020-07-13 r/1285 feat(3p/nix): Statically pass bindings capacity where possibleGriffin Smith1-2/+2
To aid in making the decision of where to (currently just statically) use a vector or btree as the backing implementation, add an extra constructor argument to Bindings::NewGC for a capacity, and use a (currently hardcoded at 32, for no good reason other than it felt like a reasonable number) pivot to switch between our possible backing implementations. Then, update all the call sites where it feels reasonable that we know the capacity statically to *pass* that capacity to the constructor. Paired-With: Luke Granger-Brown <git@lukegb.com> Paired-With: Vincent Ambo <mail@tazj.in> Paired-With: Perry Lorier <isomer@tvl.fyi> Change-Id: I1858c161301a1cd0e83aeeb9a58839378869e71d Reviewed-on: https://cl.tvl.fyi/c/depot/+/1124 Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi> Reviewed-by: isomer <isomer@tvl.fyi>
2020-07-13 r/1281 docs(3p/nix): Minor semantic correction to a commentVincent Ambo1-1/+1
Change-Id: I1cfbb7e933da54198115b28ac509b0d04870fd8f Reviewed-on: https://cl.tvl.fyi/c/depot/+/1127 Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi> Reviewed-by: glittershark <grfn@gws.fyi>
2020-07-13 r/1280 refactor(3p/nix/libexpr): Remove the nix::Symbol default constructorVincent Ambo1-6/+13
Having a default constructor for this causes a variety of annoying situations across the codebase in which this is initialised to an unexpected value, leading to constant guarding against those conditions. It turns out there's actually no intrinsic reason that this default constructor needs to exist. The biggest one was addressed in CL/1138 and this commit cleans up the remaining bits. Change-Id: I4a847f50bc90e72f028598196592a7d8730a4e01 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1139 Reviewed-by: isomer <isomer@tvl.fyi> Tested-by: BuildkiteCI
2020-07-13 r/1278 refactor(3p/nix/libexpr): Make nix::AttrName a std::variantVincent Ambo1-13/+12
nix:AttrName was one of the few classes that relied on the default constructor of nix::Symbol (which I am trying to remove in a separate change). The class essentially represents the name of an attribute in a set, which is either just a string expression or a dynamically evaluated expression (e.g. string interpolation). Previously it would be constructed by only setting one of the fields and defaulting the other, now it is an explicit std::variant. Note that there are several code paths where not all eventualities are handled and this code is bug-for-bug compatible with those, except that unknown conditions (which should never work) are now throwing instead of silently doing ... something. The language tests pass with this change, and the depot derivations that I tested with evaluated successfully. Change-Id: Icf1ee60a5f8308f4ab18a82749e00cf37a938a8f Reviewed-on: https://cl.tvl.fyi/c/depot/+/1138 Reviewed-by: edef <edef@edef.eu> Reviewed-by: glittershark <grfn@gws.fyi> Tested-by: BuildkiteCI
2020-07-04 r/1206 chore(3p/nix/libexpr): Remove dead code from attribute setsVincent Ambo1-1/+1
These bits are no longer required with the hashmap-backed implementation of attribute sets. Change-Id: I8b936d8d438a00bad4ccf8e0b4dd719c559ce8c2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/912 Tested-by: BuildkiteCI Reviewed-by: edef <edef@edef.eu>
2020-05-27 r/865 refactor(3p/nix): Anchor local includes at src/Vincent Ambo1-10/+10
Previously all includes were anchored in one global mess of header files. This moves the includes into filesystem "namespaces" (if you will) for each sub-package of Nix. Note: This commit does not introduce the relevant build system changes.
2020-05-25 r/845 refactor(3p/nix/libutil): Replace hasPrefix/Suffix with AbseilVincent Ambo1-3/+4
Uses the equivalent absl::StartsWith and absl::EndsWith functions instead.
2020-05-24 r/840 style(3p/nix): Remove 'using std::*' from types.hhVincent Ambo1-19/+22
It is considered bad form to use things from includes in headers, as these directives propagate to everywhere else and can make it confusing. types.hh (which is includes almost literally everywhere) had some of these directives, which this commit removes.
2020-05-23 r/829 fix(3p/nix/libexpr): Ensure ExprOpUpdate merges into destinationVincent Ambo1-17/+5
... this fixes nixpkgs eval!
2020-05-23 r/825 docs(3p/nix/libexpr): Add some comments about function callsVincent Ambo1-4/+8
These were things that took me a moment to realise.
2020-05-23 r/821 fix(3p/nix/libexpr): Remove the global empty attribute setVincent Ambo1-4/+0
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!
2020-05-23 r/820 chore(3p/nix/libexpr): Minor readability improvements in eval/valueVincent Ambo1-2/+2
2020-05-23 r/819 chore(3p/nix/libexpr): Remove unused __overrides featureVincent Ambo1-47/+11
This feature does not appear in nixpkgs, so I don't care about it. My only goal is evaluating nixpkgs.
2020-05-22 r/806 refactor(3p/nix/libexpr): Use gc_cpp to allocate Value instancesVincent Ambo1-20/+4
2020-05-22 r/805 refactor(3p/nix/libexpr): state->allocBindings -> Bindings::NewGCVincent Ambo1-2/+2
EvalState::allocBindings had little to do with Bindings, other than returning them, and didn't belong in that class.
2020-05-22 r/803 chore(3p/nix/libexpr): Delete Bindings::sortVincent Ambo1-10/+1
This function does nothing anymore since the attributes are always in-order.
2020-05-22 r/802 fix(3p/nix): Update for usage of new attribute set APIVincent Ambo1-31/+33
The new attribute set API uses the iterators of the btree_map directly. This requires changes in various files because the internals of libexpr are very entangled. This code runs and compiles, but there is a bug causing empty attribute sets to be assigned incorrectly.
2020-05-22 r/800 refactor(3p/nix/libexpr): Use absl::btree_map::merge for '//'Vincent Ambo1-22/+3
Instead of doing some sort of inline merge-sort of the two attribute sets, use the attribute sets merge function. This commit alone does not build and is not supposed to.
2020-05-21 r/799 refactor(3p/nix/libexpr): Use absl::btree_map for AttrSetsVincent Ambo1-6/+10
This is the first step towards replacing the implementation of attribute sets with an absl::btree_map. Currently many access are done using array offsets and pointer arithmetic, so this change is currently causing Nix to fail in various ways.
2020-05-21 r/797 refactor(3p/nix/libexpr): Use std::string as qualified typeVincent Ambo1-29/+34
Replaces most uses of `string` with `std::string`. This came up because I removed the "types.hh" import from "symbol-table.hh", which percolated through a bunch of files where `string` was suddenly no longer defined ... *sigh*
2020-05-21 r/795 fix(3p/nix): Compatibility with updated SymbolTableVincent Ambo1-38/+39
The functions in SymbolTable have been renamed to match the Google Style guide, and some debug-only functions have been removed.
2020-05-20 r/789 refactor(3p/nix): Apply clang-tidy's performance-* fixesVincent Ambo1-1/+1
This applies the performance fixes listed here: https://clang.llvm.org/extra/clang-tidy/checks/list.html
2020-05-20 r/788 refactor(3p/nix): Apply clang-tidy's readability-* fixesVincent Ambo1-43/+45
This applies the readability fixes listed here: https://clang.llvm.org/extra/clang-tidy/checks/list.html
2020-05-20 r/787 refactor(3p/nix): Apply clang-tidy's modernize-* fixesVincent Ambo1-12/+13
This applies the modernization fixes listed here: https://clang.llvm.org/extra/clang-tidy/checks/list.html The 'modernize-use-trailing-return-type' fix was excluded due to my personal preference (more specifically, I think the 'auto' keyword is misleading in that position).
2020-05-19 r/777 style(3p/nix): Final act in the brace-wrapping sagaVincent Ambo1-55/+100
This last change set was generated by a full clang-tidy run (including compilation): clang-tidy -p ~/projects/nix-build/ \ -checks=-*,readability-braces-around-statements -fix src/*/*.cc Actually running clang-tidy requires some massaging to make it play nice with Nix + meson, I'll be adding a wrapper or something for that soon.
2020-05-19 r/772 style(3p/nix): Add braces around single-line for-loopsVincent Ambo1-9/+27
These were not caught by the previous clang-tidy invocation, but were instead sorted out using amber[0] as such: ambr --regex 'for (\(.+\))\s([a-z].*;)' 'for $1 { $2 }' [0]: https://github.com/dalance/amber
2020-05-19 r/771 style(3p/nix): Add braces around single-line conditionalsVincent Ambo1-33/+99
These were not caught by the previous clang-tidy invocation, but were instead sorted out using amber[0] as such: ambr --regex 'if (\(.+\))\s([a-z].*;)' 'if $1 { $2 }' [0]: https://github.com/dalance/amber
2020-05-19 r/768 fix(3p/nix): Fix incorrectly braced conditionals and loopsVincent Ambo1-12/+6
Fixes mistakes introduced by clang-tidy in the previous commit.
2020-05-19 r/767 style(3p/nix): Enforce braces around loops and conditionalsVincent Ambo1-49/+105
This change was generated with: fd -e cc -e hh | xargs -I{} clang-tidy {} -p ~/projects/nix-build/ \ --checks='-*,readability-braces-around-statements' --fix \ -fix-errors Some manual fixes were applied because some convoluted unbraced statements couldn't be untangled by clang-tidy. This commit still includes invalid files, but I decided to clean them up in a subsequent commit so that it becomes more obvious where clang-tidy failed. Maybe this will allow for a bug-report to clang-tidy.
2020-05-19 r/766 style(3p/nix): Reformat all includes to match new styleVincent Ambo1-4/+7
2020-05-19 r/760 style(3p/nix/libexpr): Reformat with clang-formatVincent Ambo1-1/+1
2020-05-19 r/758 refactor(3p/nix/libexpr): Replace logging.h with glogVincent Ambo1-5/+5
2020-05-17 r/740 style(3p/nix): Reformat project in Google C++ styleVincent Ambo1-1604/+1461
Reformatted with: fd . -e hh -e cc | xargs clang-format -i
2020-05-17 r/724 Add 'third_party/nix/' from commit 'be66c7a6b24e3c3c6157fd37b86c7203d14acf10'Vincent Ambo1-0/+1991
git-subtree-dir: third_party/nix git-subtree-mainline: cf8cd640c1adf74a3706efbcb0ea4625da106fb2 git-subtree-split: be66c7a6b24e3c3c6157fd37b86c7203d14acf10