Skip to content

Commit

Permalink
Implement Griffin's review
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanuppal committed Nov 12, 2024
1 parent 563ea49 commit b5a0750
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 24 deletions.
2 changes: 0 additions & 2 deletions interp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ baa = { version = "0.14.0", features = ["bigint", "serde1", "fraction1"] }
fst-writer = "0.2.1"
bon = "2.3"

# derivative = "2.2.0"

[dev-dependencies]
proptest = "1.0.0"

Expand Down
2 changes: 1 addition & 1 deletion interp/src/flatten/primitives/prim_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ pub trait RaceDetectionPrimitive: Primitive {
/// optional default implementation due to size rules
fn as_primitive(&self) -> &dyn Primitive;

fn clone_boxed(&self) -> Box<dyn RaceDetectionPrimitive>;
fn clone_boxed_rd(&self) -> Box<dyn RaceDetectionPrimitive>;
}

/// An empty primitive implementation used for testing. It does not do anything
Expand Down
6 changes: 3 additions & 3 deletions interp/src/flatten/primitives/stateful/memories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl Primitive for StdReg {
}

impl RaceDetectionPrimitive for StdReg {
fn clone_boxed(&self) -> Box<dyn RaceDetectionPrimitive> {
fn clone_boxed_rd(&self) -> Box<dyn RaceDetectionPrimitive> {
Box::new(self.clone())
}

Expand Down Expand Up @@ -624,7 +624,7 @@ impl Primitive for CombMem {
}

impl RaceDetectionPrimitive for CombMem {
fn clone_boxed(&self) -> Box<dyn RaceDetectionPrimitive> {
fn clone_boxed_rd(&self) -> Box<dyn RaceDetectionPrimitive> {
Box::new(self.clone())
}

Expand Down Expand Up @@ -939,7 +939,7 @@ impl Primitive for SeqMem {
}

impl RaceDetectionPrimitive for SeqMem {
fn clone_boxed(&self) -> Box<dyn RaceDetectionPrimitive> {
fn clone_boxed_rd(&self) -> Box<dyn RaceDetectionPrimitive> {
Box::new(self.clone())
}

Expand Down
6 changes: 2 additions & 4 deletions interp/src/flatten/structures/environment/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ use itertools::Itertools;
use owo_colors::OwoColorize;

use slog::{info, warn, Logger};
use std::fmt::Debug;
use std::fmt::Write;
use std::{fmt::Debug, ops::Deref};

pub type PortMap = IndexedMap<GlobalPortIdx, PortValue>;

Expand Down Expand Up @@ -201,9 +201,7 @@ impl Clone for CellLedger {
},
Self::RaceDetectionPrimitive { cell_dyn } => {
Self::RaceDetectionPrimitive {
cell_dyn: RaceDetectionPrimitive::clone_boxed(
cell_dyn.deref(),
),
cell_dyn: cell_dyn.clone_boxed_rd(),
}
}
Self::Component(component_ledger) => {
Expand Down
15 changes: 1 addition & 14 deletions interp/src/flatten/structures/indexed_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::{
ops::{self, Index},
};

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct IndexedMap<K, D>
where
K: IndexRef,
Expand Down Expand Up @@ -144,19 +144,6 @@ where
}
}

impl<T, K> Clone for IndexedMap<K, T>
where
K: IndexRef,
T: Clone,
{
fn clone(&self) -> Self {
Self {
data: self.data.clone(),
phantom: PhantomData,
}
}
}

#[allow(dead_code)]
pub struct IndexedMapRangeIterator<'range, 'data, K, D>
where
Expand Down

0 comments on commit b5a0750

Please sign in to comment.