From 546fcf51cd0b0837604b5c094199d3221173d02f Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 22 Oct 2022 17:55:10 +0300 Subject: refactor(tvix/eval): simplify self-reference check 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 --- tvix/eval/src/compiler/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tvix/eval/src/compiler') 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); -- cgit 1.4.1