about summary refs log tree commit diff
path: root/tvix/eval/src/vm.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2022-12-29T14·34+0300
committertazjin <tazjin@tvl.su>2022-12-29T17·44+0000
commit86361f0f4a754370b42ae3568ece4bc43850f36b (patch)
treecfbef4d124f2e21b760a9dacaaa03b454d322e27 /tvix/eval/src/vm.rs
parent91465dc78ec7b4a8c9b651657bb8ad5f25c556a7 (diff)
refactor(tvix/eval): remove extra Rc<..> around Value::Attrs r/5542
The `im::OrdMap` is already small and cheap to copy while sharing
memory, so this is not required anymore.

Only the `KV` variant may have slightly larger content, but in
practice this doesn't seem to make a difference when comparing the two
variants and this one is less complicated.

Change-Id: I64a563b209a2444125653777551373cb2989ca7d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7677
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/vm.rs')
-rw-r--r--tvix/eval/src/vm.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/tvix/eval/src/vm.rs b/tvix/eval/src/vm.rs
index 5bc0f7736a..107aadb6e0 100644
--- a/tvix/eval/src/vm.rs
+++ b/tvix/eval/src/vm.rs
@@ -12,7 +12,6 @@ use crate::{
     observer::RuntimeObserver,
     opcode::{CodeIdx, Count, JumpOffset, OpCode, StackIdx, UpvalueIdx},
     spans::LightSpan,
-    unwrap_or_clone_rc,
     upvalues::Upvalues,
     value::{Builtin, Closure, CoercionKind, Lambda, NixAttrs, NixList, Thunk, Value},
     warnings::{EvalWarning, WarningKind},
@@ -584,7 +583,7 @@ impl<'o> VM<'o> {
                 (Value::List(_), _) => break false,
 
                 (Value::Attrs(a1), Value::Attrs(a2)) => {
-                    if allow_pointer_equality_on_functions_and_thunks && Rc::ptr_eq(&a1, &a2) {
+                    if allow_pointer_equality_on_functions_and_thunks && a1.ptr_eq(&a2) {
                         continue;
                     }
                     allow_pointer_equality_on_functions_and_thunks = true;
@@ -620,8 +619,8 @@ impl<'o> VM<'o> {
                         }
                         _ => {}
                     }
-                    let iter1 = unwrap_or_clone_rc(a1).into_iter_sorted();
-                    let iter2 = unwrap_or_clone_rc(a2).into_iter_sorted();
+                    let iter1 = a1.into_iter_sorted();
+                    let iter2 = a2.into_iter_sorted();
                     if iter1.len() != iter2.len() {
                         break false;
                     }
@@ -745,10 +744,10 @@ impl<'o> VM<'o> {
             OpCode::OpAttrs(Count(count)) => self.run_attrset(count)?,
 
             OpCode::OpAttrsUpdate => {
-                let rhs = unwrap_or_clone_rc(fallible!(self, self.pop().to_attrs()));
-                let lhs = unwrap_or_clone_rc(fallible!(self, self.pop().to_attrs()));
+                let rhs = fallible!(self, self.pop().to_attrs());
+                let lhs = fallible!(self, self.pop().to_attrs());
 
-                self.push(Value::attrs(lhs.update(rhs)))
+                self.push(Value::attrs(lhs.update(*rhs)))
             }
 
             OpCode::OpAttrsSelect => {