about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-10-22T14·55+0300
committertazjin <tazjin@tvl.su>2022-10-23T15·50+0000
commit546fcf51cd0b0837604b5c094199d3221173d02f (patch)
treeef2365e9733cb3aaaefd2405463dc48a883d6829 /tvix
parentc9bf7c4cf1d4220b181ef7dc8e9a2b67a7c7ba9d (diff)
refactor(tvix/eval): simplify self-reference check r/5180
Checking the computed depth and stack slot against the computed depth
and stack slot is equivalent to just checking the indices into the
locals vector against each other (i.e. "is the slot we're compiling
into the slot we're accessing?")

Change-Id: Ie85a68df073e3b2e3d9aba7fe8634c48eada81fc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7059
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Diffstat (limited to 'tvix')
-rw-r--r--tvix/eval/src/compiler/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs
index 619445f2ce85..cd2a669013bc 100644
--- a/tvix/eval/src/compiler/mod.rs
+++ b/tvix/eval/src/compiler/mod.rs
@@ -1014,7 +1014,7 @@ impl Compiler<'_> {
                         self.scope_mut().mark_needs_finaliser(slot);
                     } else {
                         // a self-reference
-                        if this_depth == target_depth && this_stack_slot == stack_idx {
+                        if slot == idx {
                             self.scope_mut().mark_must_thunk(slot);
                         }
                         self.push_op(OpCode::DataLocalIdx(stack_idx), &upvalue.span);