about summary refs log tree commit diff
path: root/tvix/eval/src/vm.rs
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2022-11-27T08·54-0800
committertazjin <tazjin@tvl.su>2022-12-21T14·50+0000
commite04b1697e4f4e8236418571c1f5938f0a9717bb7 (patch)
tree99da7ffabdcd33bf3ed64b9981bc62bbac13e246 /tvix/eval/src/vm.rs
parentb3c34c3c6104824733baae2d892eeabd423681a2 (diff)
feat(tvix/eval): wrap Closure in Rc<> to match cppnix semantics r/5452
Change-Id: I595087eff943d38a9fc78a83d37e207bb2ab79bc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7443
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/vm.rs')
-rw-r--r--tvix/eval/src/vm.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/tvix/eval/src/vm.rs b/tvix/eval/src/vm.rs
index bfca5d5984..4ea155f5a3 100644
--- a/tvix/eval/src/vm.rs
+++ b/tvix/eval/src/vm.rs
@@ -533,7 +533,7 @@ impl<'o> VM<'o> {
                 (v1, v2) => {
                     if allow_pointer_equality_on_functions_and_thunks {
                         if let (Value::Closure(c1), Value::Closure(c2)) = (&v1, &v2) {
-                            if c1.ptr_eq(c2) {
+                            if Rc::ptr_eq(c1, c2) {
                                 continue;
                             }
                         }
@@ -864,10 +864,10 @@ impl<'o> VM<'o> {
                 );
                 let mut upvalues = Upvalues::with_capacity(blueprint.upvalue_count);
                 self.populate_upvalues(upvalue_count, &mut upvalues)?;
-                self.push(Value::Closure(Closure::new_with_upvalues(
+                self.push(Value::Closure(Rc::new(Closure::new_with_upvalues(
                     Rc::new(upvalues),
                     blueprint,
-                )));
+                ))));
             }
 
             OpCode::OpThunkSuspended(idx) | OpCode::OpThunkClosure(idx) => {