feat(tvix/eval): wrap Closure in Rc<> to match cppnix semantics

Change-Id: I595087eff943d38a9fc78a83d37e207bb2ab79bc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7443
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
This commit is contained in:
Adam Joseph 2022-11-27 00:54:39 -08:00 committed by tazjin
parent b3c34c3c61
commit e04b1697e4
6 changed files with 34 additions and 61 deletions

View file

@ -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) => {