Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove dead code from multiple modules (easy) #828

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/eval/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,6 @@ impl Status {
}
}

pub fn is_incomplete(&self) -> bool {
match self {
Self::Incomplete => true,
Self::Terminal | Self::Error => false,
}
}

pub fn to_cont<F: LurkField>(&self, s: &Store<F>) -> Option<ContPtr<F>> {
match self {
Self::Terminal => Some(s.intern_cont_terminal()),
Expand Down
21 changes: 0 additions & 21 deletions src/hash_witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,12 +396,6 @@ where
}
}

impl<Name: HashName, T, const L: usize, F: LurkField> HashWitness<Name, T, L, F> {
pub fn length() -> usize {
L
}
}

pub type ConsWitness<F> = HashWitness<ConsName, Cons<F>, MAX_CONSES_PER_REDUCTION, F>;
pub type ContWitness<F> = HashWitness<ContName, Cont<F>, MAX_CONTS_PER_REDUCTION, F>;

Expand Down Expand Up @@ -492,24 +486,9 @@ impl<
self.slots.iter().map(|x| x.1).collect()
}

pub fn all_names(&self) -> Vec<Name> {
self.slots.iter().map(|x| x.0).collect()
}

pub fn stubs_used(&self) -> Vec<Stub<T>> {
self.all_stubs()
.into_iter()
.filter(|c| !c.is_dummy())
.collect()
}

pub fn stubs_used_count(&self) -> usize {
self.all_stubs().iter().filter(|c| !c.is_dummy()).count()
}

pub fn total_stub(&self) -> usize {
self.all_stubs().len()
}
}

impl<F: LurkField> ConsWitness<F> {
Expand Down
27 changes: 0 additions & 27 deletions src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1285,20 +1285,6 @@ impl<F: LurkField> Store<F> {
self.get_z_cont(ptr, &mut None).ok().map(|x| x.0)
}

pub fn hash_string(&self, s: &str) -> ZExprPtr<F> {
let ptr = self.intern_string(s);
self.get_z_expr(&ptr, &mut None)
.expect("known string can't be opaque")
.0
}

pub fn hash_symbol(&self, s: &Symbol) -> ZExprPtr<F> {
let ptr = self.intern_symbol(s);
self.get_z_expr(&ptr, &mut None)
.expect("known symbol can't be opaque")
.0
}

pub fn car_cdr(&self, ptr: &Ptr<F>) -> Result<(Ptr<F>, Ptr<F>), Error> {
match ptr.tag {
ExprTag::Nil => Ok((lurk_sym_ptr!(self, nil), lurk_sym_ptr!(self, nil))),
Expand Down Expand Up @@ -1345,19 +1331,6 @@ impl<F: LurkField> Store<F> {
}
}

pub fn cons_eq(&self, a: &Ptr<F>, b: &Ptr<F>) -> bool {
assert_eq!(ExprTag::Cons, a.tag);
assert_eq!(ExprTag::Cons, b.tag);

let a_opaque = a.is_opaque();
let b_opaque = b.is_opaque();

if !a_opaque && !b_opaque {
return a == b;
}
self.hash_expr(a) == self.hash_expr(b)
}

/// Fill the cache for Scalars. Only Ptrs which have been interned since last hydration will be hashed, so it is
/// safe to call this incrementally. However, for best proving performance, we should call exactly once so all
/// hashing can be batched, e.g. on the GPU.
Expand Down
14 changes: 0 additions & 14 deletions src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,20 +200,6 @@ impl Symbol {
res
}

// TODO: needs some kind of whitespace escaping
pub fn fmt_to_string_raw(&self) -> String {
let mut res = String::from("~(");
let mut iter = self.path.iter().peekable();
while let Some(next) = iter.next() {
res.push_str(next);
match iter.peek() {
Some(_) => res.push(' '),
None => res.push(')'),
}
}
res
}

pub fn prints_as_absolute(&self) -> bool {
if self.path.is_empty() {
false
Expand Down
28 changes: 0 additions & 28 deletions src/z_data/z_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,25 +48,6 @@ impl<F: LurkField> ZStore<F> {
}
}

/// Converts an entire store to a `ZStore`
/// WARNING: This will leak secrets used for opaque data in
/// `Store::comm_store`. Not for use with hiding commitments
pub fn to_z_store(store: &Store<F>) -> Self {
store.hydrate_scalar_cache();
let mut zstore = ZStore::new();
for zptr in store.z_expr_ptr_map.keys_cloned() {
let ptr = store.z_expr_ptr_map.get(&zptr).unwrap();
let zexpr = store.to_z_expr(ptr);
zstore.expr_map.insert(zptr, zexpr);
}
for zptr in store.z_cont_ptr_map.keys_cloned() {
let ptr = store.z_cont_ptr_map.get(&zptr).unwrap();
let zcont = store.to_z_cont(ptr);
zstore.cont_map.insert(zptr, zcont);
}
zstore
}

/// Creates a new `ZStore` and adds all `ZExprPtrs` reachable from the hashed `expr`
/// Inserts child pointers into `ZStore` with `to_z_store_with_ptr`,
/// then inserts top level pointer
Expand All @@ -78,15 +59,6 @@ impl<F: LurkField> ZStore<F> {
}
}

/// Converts a Lurk expression to a `ZExpr` and stores it in the `ZStore`, returning
/// the resulting `ZExprPtr`
pub fn insert_expr(&mut self, store: &Store<F>, expr: &Ptr<F>) -> Option<ZExprPtr<F>> {
let z_ptr = store.hash_expr(expr)?;
let z_expr = ZExpr::from_ptr(store, expr);
self.expr_map.insert(z_ptr, z_expr);
Some(z_ptr)
}

/// Returns the `ZExpr` immediately corresponding to the `ZExprPtr`, where "immediate" means
/// that the `ZExprPtr`'s field element contains the literal value associated with the tag,
/// so we can return the value without needing to retrieve it from the ZStore.
Expand Down
Loading