Skip to content

Commit

Permalink
Revert "nondeterministic feature"
Browse files Browse the repository at this point in the history
This reverts commit 894407c.
  • Loading branch information
oflatt committed Oct 15, 2024
1 parent 894407c commit 3f0507f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ default = ["bin"]

bin = ["dep:clap", "dep:env_logger", "egraph-serialize/serde", "dep:serde_json"]
wasm-bindgen = ["instant/wasm-bindgen", "dep:getrandom"]
nondeterministic = []

[dependencies]
hashbrown = { version = "0.14", features = ["raw"] }
Expand Down
15 changes: 4 additions & 11 deletions src/gj.rs
Original file line number Diff line number Diff line change
Expand Up @@ -792,14 +792,7 @@ impl Debug for LazyTrie {
}
}

#[cfg(feature = "nondeterministic")]
type SparseMap = HashMap<Value, LazyTrie>;
#[cfg(feature = "nondeterministic")]
type SEntry<'a, A, B, D> = hashbrown::hash_map::Entry<'a, A, B, D>;
#[cfg(not(feature = "nondeterministic"))]
type SparseMap = IndexMap<Value, LazyTrie>;
#[cfg(not(feature = "nondeterministic"))]
type SEntry<'a, A, B> = Entry<'a, A, B>;
type RowIdx = u32;

#[derive(Debug)]
Expand Down Expand Up @@ -895,8 +888,8 @@ impl LazyTrie {
LazyTrieInner::Borrowed { index, map } => {
let ixs = index.get(&value)?;
match map.entry(value) {
SEntry::Occupied(o) => Some(o.into_mut()),
SEntry::Vacant(v) => {
Entry::Occupied(o) => Some(o.into_mut()),
Entry::Vacant(v) => {
Some(v.insert(LazyTrie::from_indexes(access.filter_live(ixs))?))
}
}
Expand Down Expand Up @@ -948,14 +941,14 @@ impl<'a> TrieAccess<'a> {
&& self.constraints.iter().all(|c| c.check(tup, out))
{
match map.entry(val) {
SEntry::Occupied(mut e) => {
indexmap::map::Entry::Occupied(mut e) => {
if let LazyTrieInner::Delayed(ref mut v) = e.get_mut().0.get_mut() {
v.push(i as RowIdx)
} else {
unreachable!()
}
}
SEntry::Vacant(e) => {
indexmap::map::Entry::Vacant(e) => {
e.insert(LazyTrie(UnsafeCell::new(LazyTrieInner::Delayed(
smallvec::smallvec![i as RowIdx,],
))));
Expand Down

0 comments on commit 3f0507f

Please sign in to comment.