about summary refs log tree commit diff
path: root/tvix/eval
AgeCommit message (Collapse)AuthorFilesLines
2022-12-21 r/5457 refactor(tvix/eval): add a LightSpan type for lighter span trackingVincent Ambo5-12/+61
This type carries the information required for calculating a span (i.e. the chunk and offset), instead of the span itself. The span is then only calculated in cases where it is required (when throwing errors). This reduces the eval time for `builtins.length (builtins.attrNames (import <nixpkgs> {}))` by *one third*! The data structure in chunks that carries span information reduces in-memory size by trading off the speed of retrieving span information. This is because the span information is only actually required when throwing errors (or emitting warnings). However, somewhere along the way we grew a dependency on carrying span information in thunks (for correctly reporting error chains). Hitting the code paths for span retrieval was expensive, and carrying the spans in a different way would still be less cache-efficient. This change is the best tradeoff I could come up with. Refs: b/229. Change-Id: I27d4c4b5c5f9be90ac47f2db61941e123a78a77b Reviewed-on: https://cl.tvl.fyi/c/depot/+/7558 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-12-21 r/5455 feat(tvix/eval): add thunks with suspended native Rust codeAdam Joseph1-1/+45
Having thunks which, when forced, execute native Rust code rather than interpreted opcodes lets us avoid having to bundle `src/libexpr/primops/derivation.nix` like cppnix does by implementing it in Rust instead. Change-Id: If91d77a6736234321eee87ba4b4777eed5a3fe1c Reviewed-on: https://cl.tvl.fyi/c/depot/+/7450 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-12-21 r/5454 refactor(tvix/eval): add name-based index over compiler's localsVincent Ambo2-34/+108
Instead of finding locals by doing 2x O(n) walks over the compiler's locals list, use a secondary name-based index for resolving locals by name. Previously, almost 60% (!!) of eval time on some expressions over nixpkgs was spent in `Local::has_name`. This function doesn't even exist anymore now, and eval speed about doubles as a result. Note that this doesn't exactly make the locals code easier to read, but I'm also not sure what we can simplify in there in general. This fixes b/227. Change-Id: I29ce5eb9452b02d3b358c673e1f5cf8082e2fef9 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7560 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-12-21 r/5453 feat(tvix/eval): remove `derive(Copy)` from UpvaluesAdam Joseph3-12/+26
Change-Id: I0fa069fbeff6718a765ece948c2c1bce285496f7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7449 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-12-21 r/5452 feat(tvix/eval): wrap Closure in Rc<> to match cppnix semanticsAdam Joseph6-61/+34
Change-Id: I595087eff943d38a9fc78a83d37e207bb2ab79bc Reviewed-on: https://cl.tvl.fyi/c/depot/+/7443 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-12-21 r/5445 refactor(tvix/eval): consume `self` in Evaluation::evaluateVincent Ambo1-7/+6
This simplifies lifetime management for observers in callers of tvix_eval. Change-Id: I2f47c8d89f22b1c766526e5d1483c0d026b500ae Reviewed-on: https://cl.tvl.fyi/c/depot/+/7546 Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-12-21 r/5444 feat(tvix/eval): add observer configuration to public APIVincent Ambo1-11/+21
With this change, it should be possible to have both existing use-cases (CLI & Tvixbolt) use the same API. Change-Id: I2195264f08cc892177b559a28660dc5f98e48e41 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7545 Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>
2022-12-21 r/5443 feat(tvix/eval): add configuration of Nix search path to public APIVincent Ambo2-2/+33
This is required for passing through NIX_PATH from the CLI. Change-Id: If129df79ef9c3ffab31408adb85679909276c4f0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7544 Reviewed-by: grfn <grfn@gws.fyi> Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-12-21 r/5442 fix(tvix/eval): use test-generator fork that supports workspacesVincent Ambo1-1/+6
This should make no difference in Nix builds, but allows running tests locally again with `cargo test` for //tvix/eval. Change-Id: I97d61840143d5c14db61d5862781bf635f9a28e7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7590 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
2022-12-21 r/5441 chore(tvix): upgrade to clap 4.0Vincent Ambo2-2/+5
In //tvix/eval: * criterion bumped to 4.0, which at least depends on clap 3.x instead of 2.x, which is less incompatible In //tvix/cli: * no changes required In //tvix/nix_cli: * some minor changes for compatibility with clap 4.0, no functionality changes Change-Id: If793f64b59fcaa2402d3d483ddbab4092f32df03 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7588 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-12-21 r/5440 refactor(tvix): split binary (REPL etc.) out from evaluator libraryVincent Ambo4-263/+1
The tvix-eval project is independent from any *uses* of the evaluator, such as the tvix-repl. This functionality has been split out into a separate "tvix-cli" crate. Note that this doesn't have to mean that this CLI crate is the "final" CLI crate for tvix, the point of this is not "getting the CLI structure right" but rather "getting the evaluator structure right". This reshuffling is part of restructuring the way that functionality like store communication is injected into language evaluation. Note that at this commit the new CLI crate is not at feature-parity. Change-Id: Id0af03dc8e07ef09a9f882a89612ad555eca8f93 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7541 Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
2022-12-21 r/5439 refactor(tvix/eval): use new public API in test codeVincent Ambo2-41/+48
This removes internal uses of the previous crate::eval module, which is being removed. Change-Id: I5fb3c53460a9c5381853d0258f9ed074ab23c630 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7543 Tested-by: BuildkiteCI Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: grfn <grfn@gws.fyi>
2022-12-21 r/5438 feat(tvix/eval): begin introducing new public APIVincent Ambo1-2/+154
A step towards something more like how I imagine the future public API for tvix-eval. Please note that this is definitely not the final version yet, but it's better than the previous API that either exposed a side-effecting blackbox, or a very low-level "interface". The basic idea is that an evaluation of some Nix code is requested by a caller with various parameters, but not all callers are interested in all of these parameters. There are also some bits of information that are returned from an evaluation that are not necessarily relevant to all callers. To support this somewhat ergonomically, the API is built around an `Evaluation` struct that is configured by the caller with the various parameters and then "executed". Change-Id: I71826f3897126898adc2873d31c44d3eaf5c2be0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7542 Reviewed-by: grfn <grfn@gws.fyi> Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-12-15 r/5420 refactor(tvix): build Rust projects using crate2nixVincent Ambo6-32/+7
Introduces granular dependency builds using crate2nix, bootstrapped off the generated configuration from the newly introduced workspace (see cl/7533). This commit checks in the generated Cargo.nix file which can be regenerated with a parameterless invocation of `crate2nix generate` in `//tvix`. I tried generating this in IFD, but it turned out to be harder than what seemed worthwhile for now. In this setup, the various build targets for Rust projects end up being attributes of the imported `Cargo.nix` file at the `tvix.crates` attribute. These still lack configuration, however, which has been fixed in the various `default.nix` files of individual projects. Note that we (temporarily) lose the ability to build tvix-eval's benchmarks in CI. I haven't figured out what magic incantation summons them from the void again ... The `eval-okay-readDir` tests from both test suites have been disabled because they fail for unknown reasons when run in this new derivation. Somebody will have to debug it! Change-Id: I2014614ccb9c8951aedbd71df7966ca191a13695 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7538 Autosubmit: tazjin <tazjin@tvl.su> Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
2022-12-15 r/5419 refactor(tvix): share a Cargo.lock file between Rust projectsVincent Ambo4-2484/+1
This relates to the (abandoned) cl/7256. Introduces a Cargo workspace at //tvix that is primarily intended to be used as a workaround for the annoying Nix+Rust tooling while having a consistent set of dependencies. This is driven in part by a desire to adopt crate2nix and get more granular Nix builds for Tvix's Rust projects, and in part by a need to split //tvix/eval into something providing the CLI (REPL etc.), and a library providing eval, without significantly altering the structure of build targets. To accomplish this the workspace has been designed to allow projects to remain independent build targets. I want to avoid lumping all the projects together - something like //tvix/eval should always be independent of other parts of tvix. A helper function in //tvix/default.nix lets downstream naersk projects construct a sparse root for the project which combines the workspace's `Cargo.lock` with the project's own `Cargo.toml`. Note that cargo commands in the workspace itself require the build dependencies of _all_ projects to be present, which is currently a bit annoying to accomplish. This introduces some breakage: 1. It breaks usage of rust-analyser without being in a shell with the dependencies of *all* Tvix projects, as it is not capable of respecting only the subset of dependencies for a part of the workspace. 2. It is no longer possible to run tests using `cargo test`, as the test generation crate we use does not work with workspaces: https://github.com/frehberg/test-generator/issues/6 This still works in the Nix build as we construct a Cargo project that looks like it's not in a workspace there. Until somebody fixes that crate / writes a new macro / does something else with the test suite, the way to run the tests is through the Nix build. Long-term we'll probably want to get rid of cargo completely, it's just a big wart and most tooling works without it if correctly configured, but we don't have time for that now. Change-Id: I846bff7a8429a25c077fd1e9ef4e3c34a299a4a1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7533 Reviewed-by: flokli <flokli@flokli.de> Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-12-06 r/5396 fix(tvix/eval): use rnix-parser from crates.ioVincent Ambo2-8/+4
A few weeks ago, oberblastmeister did a release to crates.io so we can stop importing it via GitHub. Change-Id: I9d5fa5cd281685779c71b12fed45ed201a1db17e Reviewed-on: https://cl.tvl.fyi/c/depot/+/7532 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2022-12-03 r/5379 feat(tvix/eval): Continue removing leakage of BTreeMap.Lyle Mantooth4-52/+40
Fixes b/212. Based on feedback in https://cl.tvl.fyi/c/depot/+/7492, all uses of `NixAttrs::from_map` have been removed. Only `from_iter` and `from_kv` remain. Change-Id: I52e25f73018c2aa1843197427516b7a852503e2c Reviewed-on: https://cl.tvl.fyi/c/depot/+/7500 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Autosubmit: IslandUsurper <lyle@menteeth.us>
2022-12-02 r/5375 feat(tvix/eval): impl FromIterator for NixAttrsLyle Mantooth2-52/+64
Allows for the removal of some BTreeMap usage when constructing NixAttrs by allowing any iterator over 2-tuples to build a NixAttrs. Some instances of BTreeMap didn't have anything to do with making NixAttrs, and some were just the best tool for the job, so they are left using the old `from_map` interface. Change-Id: I668ea600b0d93eae700a6b1861ac84502c968d78 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7492 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-12-02 r/5374 test(tvix/eval): check inner forcing despite declaring pointersterni2-0/+12
Maybe counter-intuitively the inner elements of a list or the attribute values of an attribute set will be forced despite pointer equality (but only one layer deep). Change-Id: I485d96452fb56f5fb342d39039c9137725b33d3f Reviewed-on: https://cl.tvl.fyi/c/depot/+/7371 Reviewed-by: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI
2022-12-02 r/5373 test(tvix/eval): add a test for repeated keys in listToAttrsVincent Ambo2-0/+14
This came up in the Nix Language channel today and I thought it warranted a test case. We did actually implement this correctly. Change-Id: I4b37c92d06eb6e3a7f59ea3d10af38f2b0a93d53 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7493 Reviewed-by: sterni <sternenseemann@systemli.org> Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-12-02 r/5369 test(tvix/eval): verify pointer equality checkssterni2-0/+47
Change-Id: I9baf2810fbd5b6ee8bfe10fce5b64801a35c1d67 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7369 Reviewed-by: tazjin <tazjin@tvl.su> Reviewed-by: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI
2022-12-02 r/5368 test(tvix/eval): verify pointer equality in list comparisonssterni2-0/+7
Change-Id: I617d402c8ecc7aaf607c4bdcd58a06ebddb71fac Reviewed-on: https://cl.tvl.fyi/c/depot/+/7370 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: Adam Joseph <adam@westernsemico.com>
2022-12-02 r/5367 feat(tvix/eval): inline(always) tail_call_valueAdam Joseph1-0/+1
Rust doesn't do tail-call elimination (still!) so the best we can hope for here is to inline non-recursive invocations. Change-Id: I78949967e48b006fcbf31786d8f6281cd122f36f Reviewed-on: https://cl.tvl.fyi/c/depot/+/7360 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Autosubmit: Adam Joseph <adam@westernsemico.com>
2022-12-02 r/5366 feat(tvix/eval): crude caching builtins.importAdam Joseph2-7/+20
Before this, tvix was spending most of its time furiously re-parsing and re-compiling nixpkgs, each time hoping to get a different result... Change-Id: I1c0cfbf9af622c276275b1f2fb8d4e976f1b5533 Signed-off-by: Adam Joseph <adam@westernsemico.com> Reviewed-on: https://cl.tvl.fyi/c/depot/+/7361 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-12-01 r/5356 feat(tvix/eval): placeholder for builtins.placeholderAdam Joseph1-0/+7
Change-Id: I8d11f2db4489a7d82910256069d10f8bed3bdf9a Reviewed-on: https://cl.tvl.fyi/c/depot/+/7451 Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI
2022-12-01 r/5355 feat(tvix/eval): impl Default for AttrsRepAdam Joseph1-1/+7
Change-Id: I3a55413e5004777b90c06cd8655f26abb2faf39b Reviewed-on: https://cl.tvl.fyi/c/depot/+/7448 Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-11-30 r/5354 feat(tvix/eval): From<Rc<Vec<Value>>> for NixListAdam Joseph1-0/+6
Change-Id: I2ab53453ed7370b520bb929ef7285e4f23eec65b Reviewed-on: https://cl.tvl.fyi/c/depot/+/7453 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Autosubmit: Adam Joseph <adam@westernsemico.com>
2022-11-28 r/5350 feat(tvix/eval): implement equality on derivationsAdam Joseph1-0/+32
Change-Id: I344b66c39cbc4b426accc482aa8f6f2eb18db68a Reviewed-on: https://cl.tvl.fyi/c/depot/+/7417 Autosubmit: Adam Joseph <adam@westernsemico.com> Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-11-28 r/5349 feat(tvix/eval): add CoercionKind::ThunksOnlyAdam Joseph2-4/+12
Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: I92acb7e6099a4796d953b2d4d02cca4076ed0fb1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7426 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-11-27 r/5346 fix(tvix/eval): implement function/thunk ptr-equality for list ordAdam Joseph1-1/+1
With this change, the test introduced by cl/7370 passes. Change-Id: Ie7d2f02a59d61151f14ebd328e6cfa5892cacfb0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7375 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org> Autosubmit: Adam Joseph <adam@westernsemico.com>
2022-11-27 r/5345 feat(tvix/eval): non-recursive implementation of nix_eq()Adam Joseph4-34/+133
This passes all the function/thunk-pointer-equality tests in cl/7369. Change-Id: Ib47535ba2fc77a4f1c2cc2fd23d3a879e21d8b4c Signed-off-by: Adam Joseph <adam@westernsemico.com> Reviewed-on: https://cl.tvl.fyi/c/depot/+/7358 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-11-26 r/5341 feat(tvix/eval): add --raw flag to eval, like cppnixAdam Joseph2-2/+16
Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: If07250a45fdf65a3f22ed8c37d7f37b45edccde9 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7416 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-11-26 r/5340 feat(tvix/eval): use backtrace-on-stack-overflow crateAdam Joseph3-116/+238
The backtrace-on-stack-overflow create provides best-effort stack traces when a stack overflow happens. Since it's running on the (usually tiny) signal alternate stack this isn't easy. This is guarded by a new `backtrace_overflow` feature flag and never enabled (even if that feature is selected) for release builds. This is strictly for debugging; there's crazy unsafe voodoo in there. https://lib.rs/crates/backtrace-on-stack-overflow Example output: ``` Stack Overflow: 0: backtrace_on_stack_overflow::handle_sigsegv at /home/amjoseph/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-on-stack-overflow-0.2.0/src/lib.rs:93:40 1: <unknown> 2: __rust_probestack 3: tvix_eval::vm::VM::run_op at src/vm.rs:399 4: tvix_eval::vm::VM::run at src/vm.rs:388:23 5: tvix_eval::vm::VM::enter_frame at src/vm.rs:360:22 6: tvix_eval::value::thunk::Thunk::force at src/value/thunk.rs:116:25 7: tvix_eval::vm::VM::run_op at src/vm.rs:801:37 8: tvix_eval::vm::VM::run at src/vm.rs:388:23 9: tvix_eval::vm::VM::enter_frame at src/vm.rs:360:22 10: tvix_eval::value::thunk::Thunk::force at src/value/thunk.rs:116:25 ... ``` Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: I1d8a2017f836be7bf91a2223e7adacb86fa1dbb2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7354 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-11-26 r/5339 fix(tvix/eval): OpAdd must weakly stringify if either arg is stringAdam Joseph3-1/+20
Tests included. Change-Id: I7a4905d6103813373e383e2e8629c5fd243d6bca Reviewed-on: https://cl.tvl.fyi/c/depot/+/7377 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: Adam Joseph <adam@westernsemico.com>
2022-11-26 r/5327 feat(tvix/eval): mock builtins.unsafeGetAttrPosAdam Joseph1-0/+24
Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: I9d986dd8c0aad4e67df01bda13cee443e0fc0d20 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7415 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-11-26 r/5326 feat(tvix/eval): declare function-pointer-equality dealt withAdam Joseph1-1/+0
Change-Id: If81ff414dba10a0448b905eec373730a68795376 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7376 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Autosubmit: Adam Joseph <adam@westernsemico.com>
2022-11-26 r/5325 feat(tvix/eval): add Closure::ptr_eq()Adam Joseph1-0/+6
See cl/7368 Change-Id: I97630994c3d65f4d16414a0da236ce000a5b6d33 Signed-off-by: Adam Joseph <adam@westernsemico.com> Reviewed-on: https://cl.tvl.fyi/c/depot/+/7374 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-11-26 r/5324 feat(tvix/eval): wrap Closure::upvalues in RcAdam Joseph3-6/+11
See cl/7372; Nix equality semantics require the ability to track pointer equality of upvalue-sets. Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: I82ba517499cf370189a80355e4e46a5caaab7153 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7373 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-11-25 r/5310 test(tvix/eval): add eval-okay-closure-pointer-compareAdam Joseph2-0/+15
This test case checks two things: * A sanity check that "pointer equality for functions" means not just the lambda, but also the upvalues. * To be pointer-equal, it is not enough for the upvalues to be normal-form equal (i.e. `nix_eq()`-equal); the upvalues must be *pointer*-equal. The second part of the test case checks for this. Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: I4e59327a6f199b8212e97197b212e3c3934bb3f0 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7372 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-11-24 r/5309 chore(tvix/eval): postpone use of "dep:" for a bitAdam Joseph1-1/+1
The "dep:" syntax in Cargo.toml is very new; crate2nix master has support for it, but they have not yet made a release with this update, and therefore the crate2nix in nixpkgs does not yet support it. Could we avoid using "dep:" for a few weeks to give crate2nix a chance to release so I can bump the version in nixpkgs? I've opened an issue asking crate2nix to make a release: https://github.com/kolloch/crate2nix/issues/264 I propose that if they haven't acted within a month we stop waiting and revert this at that time. Change-Id: I999a72429db667bedf4b2cdba27cb63b3f3d9657 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7350 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-11-24 r/5308 test(tvix/eval): test limits of builtins.seq's forcingsterni2-2/+2
Change-Id: I6dfc9108220762ef3372cd2739e91d79c01a55e1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7366 Tested-by: BuildkiteCI Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: tazjin <tazjin@tvl.su>
2022-11-23 r/5305 feat(tvix/eval): ExactSizeIterator for Iter<KeyValue<'a>> and KeysAdam Joseph1-0/+20
Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: Ia373eb30d8516a056f1349f9011dee9816593d6f Reviewed-on: https://cl.tvl.fyi/c/depot/+/7357 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-11-23 r/5303 feat(tvix/eval): improve panic!() messages in Thunk::value()Adam Joseph1-4/+4
Change-Id: I3b1284e28c350bfed84d643ae7f922f3487e1f2a Reviewed-on: https://cl.tvl.fyi/c/depot/+/7355 Autosubmit: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
2022-11-23 r/5302 feat(tvix/eval): add NixAttrs::into_iter()Adam Joseph1-0/+52
Signed-off-by: Adam Joseph <adam@westernsemico.com> Change-Id: Ib813d794177c623bf2f12fc2e6a6f304089607d1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7356 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-11-23 r/5301 feat(tvix/eval): make NixList::clone() cheapAdam Joseph3-38/+36
When we start unrecursivifying (sp?) things, Rust's borrow checker is going to be a headache; its magic only works when you use the CPU stack as your call stack. Fixing the borrow checker issues usually involves adding lots of `clone()`s. Right now `NixList` is the only variant of `Value` that isn't cheap to clone() -- all the others are either a wrapper around Rc or else are of bounded size. Note that this requires dropping the `DerefMut for NixList` instance and using `Vec<Value>` instead in those situations. Change-Id: I5a47df66855342aa2064f8f3cb7934ff422d26bd Signed-off-by: Adam Joseph <adam@westernsemico.com> Reviewed-on: https://cl.tvl.fyi/c/depot/+/7359 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
2022-11-21 r/5299 fix(tvix/eval): aggressively fix a borrow error in nix_eqVincent Ambo1-3/+9
When comparing Nix values for equality, an issue can occur where recursive values contain thunks to themselves which causes borrow errors when forcing them for comparison later down the line. To work around this we clone the values for now. There might be some optimisations possible like checking for thunk equality directly and short-circuiting on that (we have to check what Nix does). Change-Id: I7e75c992ea68f100058f52b4b46168da7d671994 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7314 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-11-21 r/5298 fix(tvix/eval): builtins.listToAttrs must force keysVincent Ambo1-7/+2
Change-Id: Ief9ebc2285a0c50654c2edd3351432dc1588f9fc Reviewed-on: https://cl.tvl.fyi/c/depot/+/7313 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2022-11-21 r/5297 fix(tvix/eval): ensure callable is forced when using call_withVincent Ambo2-1/+9
When passing multiple arguments, every intermediate callable needs to be forced as this is expected by the VM's call_value function. Also adds a debug assertion for this which makes it easier to spot exactly what went wrong. Change-Id: I3aa519cb6cdaab713bd18282bef901c4cd77c535 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7312 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
2022-11-21 r/5296 test(tvix/eval): enable eval-okay-closure test from nix_testsVincent Ambo2-1/+2
This function covers builtins.genericClosure, seemingly including weird behaviour around the order in which the work set is processed. For some reason, in C++ Nix the test expectation is written in XML which we do not yet support, so I have created a new expectation file using `nix-instantiate --eval --strict` on the file (yes, using C++ Nix). Change-Id: Id90e7117d120dc66d963a51083c4d8e8f2d9f181 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7311 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
2022-11-21 r/5295 feat(tvix/eval): Implement builtins.genericClosureVincent Ambo1-0/+47
This implementation closely follows the original implementation in Nix, including the use of an equality-based "set" structure to track keys that have already been processed. Note that this test does not yet enable the `notyetpassing` test for builtins.genericClosure because (for as of yet unknown reasons) this test compares against XML output (however, evaluating the test case actually does work). This takes us one step closer to nixpkgs eval. This commit was written somewhere in the North Sea. Co-Authored-By: Griffin Smith <root@gws.fyi> Change-Id: I450a866e6f2888b27c2fe7c7f77ce0f79bfe3e6c Reviewed-on: https://cl.tvl.fyi/c/depot/+/7310 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>