feat(tvix/eval): remove Clone instance from Chunk and Lambda

Lambda has a quite large and variable-sized runtime representation,
unlike Rc<Lambda>.  It would be easy to accidentally call clone() on
this and create input-dependent performance regressions.

Nothing in the codebase is currently using Lambda.clone().  Let's
remove the derived instance.  If it's really needed it is very easy
to add it back in, but whoever does that will have to look at the
struct they're adding Clone to, which will hopefully prompt them to
think about whether or not that's really what they want to do.

Change-Id: I7806a741862ab4402229839ce3f4ea75aafd6d12
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7029
Autosubmit: Adam Joseph <adam@westernsemico.com>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
This commit is contained in:
Adam Joseph 2022-10-15 17:09:41 -07:00 committed by clbot
parent db70c672cf
commit d9c497520c
2 changed files with 2 additions and 2 deletions

View file

@ -28,7 +28,7 @@ struct SourceSpan {
/// A chunk is a representation of a sequence of bytecode
/// instructions, associated constants and additional metadata as
/// emitted by the compiler.
#[derive(Clone, Debug, Default, PartialEq)]
#[derive(Debug, Default, PartialEq)]
pub struct Chunk {
pub code: Vec<OpCode>,
pub constants: Vec<Value>,

View file

@ -9,7 +9,7 @@ use crate::{
upvalues::{UpvalueCarrier, Upvalues},
};
#[derive(Clone, Debug, PartialEq)]
#[derive(Debug, PartialEq)]
pub struct Lambda {
// name: Option<NixString>,
pub(crate) chunk: Chunk,