Skip to content

Commit

Permalink
Switch to using default-vec2
Browse files Browse the repository at this point in the history
  • Loading branch information
dewert99 committed Dec 17, 2024
1 parent dc73314 commit da3f0a2
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 138 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ version = "0.9.5"
rust-version = "1.63.0"

[dependencies]
default-vec2 = "0.1.3"
rustc-hash = {version = "1.1.0", default-features = false}
hashbrown = { version = "0.14.3", default-features = false, features = ["inline-more"] }
indexmap = { version = "1.8.1", optional = true }
Expand Down Expand Up @@ -52,6 +53,7 @@ serde-1 = [
"indexmap/serde-1",
"hashbrown/serde",
"symbol_table/serde",
"default-vec2/serde-1",
"vectorize",
]
wasm-bindgen = ["instant/wasm-bindgen"]
Expand Down
2 changes: 0 additions & 2 deletions src/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ mod semi_persistent;
/// One variant of semi_persistence
pub mod semi_persistent1;

/// A simple bitset
pub mod bitset;
pub(crate) mod language;
/// Another variant of semi_persistence
pub mod semi_persistent2;
Expand Down
130 changes: 0 additions & 130 deletions src/raw/bitset.rs

This file was deleted.

8 changes: 4 additions & 4 deletions src/raw/egraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ use std::{
iter, slice,
};

use crate::raw::bitset::BitSet;
use crate::raw::dhashmap::*;
use crate::raw::UndoLogT;
use default_vec2::BitSet;
#[cfg(feature = "serde-1")]
use serde::{Deserialize, Serialize};
use smallvec::SmallVec;
Expand Down Expand Up @@ -363,7 +363,7 @@ pub struct RawEGraph<L: Language, D, U = ()> {
/// not the canonical id of the eclass.
pub(super) pending: Vec<Id>,
/// `Id`s that are congruently equivalent to another `Id` that is not in this set
pub(super) congruence_duplicates: BitSet,
pub(super) congruence_duplicates: BitSet<Id>,
pub(super) classes: Vec<RawEClass<D>>,
pub(super) undo_log: U,
}
Expand Down Expand Up @@ -790,7 +790,7 @@ impl<L: Language, D, U: UndoLogT<L, D>> RawEGraph<L, D, U> {
loop {
let this = get_self(outer);
if let Some(class) = this.pending.pop() {
if this.congruence_duplicates.contains_mut(class.into()) {
if this.congruence_duplicates.contains_mut(class) {
// `class` is congruently equivalent to another node `croot`,
// so each node that has `class` as a parent also has `croot` as a parent,
// and they will always be added to pending together, so we only need to handle
Expand All @@ -817,7 +817,7 @@ impl<L: Language, D, U: UndoLogT<L, D>> RawEGraph<L, D, U> {
// class is congruently equivalent to memo_class which isn't in
// congruence_duplicates
if class != memo_class {
this.congruence_duplicates.insert(class.into());
this.congruence_duplicates.insert(class);
this.undo_log.add_congruence_duplicate(class);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/raw/semi_persistent1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl<L: Language, D, U: AsUnwrap<UndoLog>> RawEGraph<L, D, U> {
.congr_dup_log
.drain(congr_dup_count as usize..)
{
self.congruence_duplicates.remove(id.into());
self.congruence_duplicates.remove(id);
}
self.pop_memo1(memo_log_count as usize);
self.pop_unions1(
Expand Down
2 changes: 1 addition & 1 deletion src/raw/semi_persistent2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl<L: Language, D, U: AsUnwrap<UndoLog>> RawEGraph<L, D, U> {
.congr_dup_log
.drain(congr_dup_count as usize..)
{
self.congruence_duplicates.remove(id.into());
self.congruence_duplicates.remove(id);
}
self.pending.clear();
self.pop_memo2(memo_log_count as usize);
Expand Down

0 comments on commit da3f0a2

Please sign in to comment.