about summary refs log tree commit diff
path: root/tvix/eval/src/compiler
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-08-27T17·41+0300
committertazjin <tazjin@tvl.su>2022-09-06T07·29+0000
commit3089e46eb12b0648a8c564836a660b87c5200a65 (patch)
tree081b30189e1f868a5032cbbe8a670cde9bbbe48a /tvix/eval/src/compiler
parente646d5170c7c1b651449966a53d0a955779d3f98 (diff)
refactor(tvix/eval): encapsulate internal mutability within Closure r/4651
This is required to efficiently construct the upvalue array at
runtime, as there are situations where during Closure construction
multiple things already have a reference to the closure (e.g. a
self-reference).

Change-Id: I35263b845fdc695dc873de489f5168d39b370f6a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6312
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'tvix/eval/src/compiler')
-rw-r--r--tvix/eval/src/compiler/mod.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs
index 2fac7560a6..520eb3bd64 100644
--- a/tvix/eval/src/compiler/mod.rs
+++ b/tvix/eval/src/compiler/mod.rs
@@ -87,8 +87,7 @@ impl Compiler {
     }
 
     fn chunk(&mut self) -> &mut Chunk {
-        Rc::<Chunk>::get_mut(self.context_mut().lambda.chunk())
-            .expect("compiler flaw: long-lived chunk reference")
+        &mut self.context_mut().lambda.chunk
     }
 
     fn scope(&self) -> &Scope {