From d4fa3152e92ef72d9ee050000b1fd4952203e383 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Wed, 12 Oct 2022 22:47:23 -0400 Subject: feat(tvix/eval): Implement builtins.deepSeq This is done via a new `deepForce` function on Value. Since values can be cyclical (for example, see the test-case), we need to do some extra work to avoid RefCell borrow errors if we ever hit a graph cycle: While deep-forcing values, we keep a set of thunks that we have already seen and avoid doing any work on the same thunk twice. The set is encapsulated in a separate type to stop potentially invalid pointers from leaking out. Finally, since deep_force is conceptually similar to `VM::force_for_output` (but more suited to usage in eval since it doesn't clone the values) this removes the latter, replacing it with the former. Co-Authored-By: Vincent Ambo Change-Id: Iefddefcf09fae3b6a4d161a5873febcff54b9157 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7000 Tested-by: BuildkiteCI Reviewed-by: grfn Reviewed-by: tazjin --- tvix/eval/src/tests/nix_tests/eval-okay-deepseq.exp | 1 + 1 file changed, 1 insertion(+) create mode 100644 tvix/eval/src/tests/nix_tests/eval-okay-deepseq.exp (limited to 'tvix/eval/src/tests/nix_tests/eval-okay-deepseq.exp') diff --git a/tvix/eval/src/tests/nix_tests/eval-okay-deepseq.exp b/tvix/eval/src/tests/nix_tests/eval-okay-deepseq.exp new file mode 100644 index 000000000000..8d38505c1686 --- /dev/null +++ b/tvix/eval/src/tests/nix_tests/eval-okay-deepseq.exp @@ -0,0 +1 @@ +456 -- cgit 1.4.1