Skip to content

Commit 3b4039a

Browse files
committed
kill me
1 parent 561dbd6 commit 3b4039a

File tree

4 files changed

+6
-11
lines changed

4 files changed

+6
-11
lines changed

cobalt-ast/src/types/agg.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,6 @@ impl Type for SizedArray {
773773
eprintln!("base kind: {}, our int kind: {}, real int kind: {}", base.kind(), self.elem().kind(), types::Int::KIND);
774774
dbg!(base == self.elem());
775775
eprintln!("base: {base:p}, elem: {:p}", self.elem());
776-
eprintln!("{:?}", types::int::INTERN);
777776
}
778777
dbg!(target.is_and::<types::Pointer>(|r| r.base() == self.elem()))
779778
}

cobalt-ast/src/types/int.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ impl Int {
1010
fn from_ref(val: &(u16, bool)) -> &Self;
1111
pub fn new(bits: u16, unsigned: bool) -> &'static Self {
1212
eprintln!("new int: {bits}, {unsigned}");
13+
eprintln!("INTERN: {INTERN:#?}");
1314
let ret = Self::from_ref(INTERN.intern((bits, unsigned)));
1415
eprintln!("finished making int");
1516
ret

cobalt-utils/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ description.workspace = true
99
documentation.workspace = true
1010

1111
[dependencies]
12-
aovec = "1.1.0"
12+
boxcar = "0.2.4"
1313
hashbrown = { version = "0.14.2", features = ["raw"] }
1414
once_cell = "1.18.0"

cobalt-utils/src/intern.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,21 @@ use hashbrown::HashTable;
22
use once_cell::sync::Lazy;
33
use std::hash::{Hash, Hasher};
44
use std::sync::RwLock;
5-
use std::fmt::{self, Debug, Formatter};
65
#[inline]
76
fn hash(val: &impl Hash) -> u64 {
87
let mut state = std::collections::hash_map::DefaultHasher::default();
98
val.hash(&mut state);
109
state.finish()
1110
}
11+
#[derive(Debug)]
1212
pub struct Interner<'a, T: PartialEq + Eq + Hash> {
13-
vec: Lazy<aovec::Aovec<T>>,
13+
vec: Lazy<boxcar::Vec<T>>,
1414
map: RwLock<HashTable<(&'a T, usize)>>,
1515
}
16-
impl<T: Debug + PartialEq + Eq + Hash> Debug for Interner<'_, T> {
17-
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
18-
f.debug_struct("Interner").field("map", &self.map.read().unwrap()).finish_non_exhaustive()
19-
}
20-
}
2116
impl<'a, K: PartialEq + Eq + Hash> Interner<'a, K> {
2217
pub const fn new() -> Self {
2318
Self {
24-
vec: Lazy::new(|| aovec::Aovec::new(16)),
19+
vec: Lazy::new(boxcar::Vec::new),
2520
map: RwLock::new(HashTable::new()),
2621
}
2722
}
@@ -32,7 +27,7 @@ impl<'a, K: PartialEq + Eq + Hash> Interner<'a, K> {
3227
eprintln!("reusing old element @ {k}");
3328
&self.vec[k]
3429
} else {
35-
eprintln!("creating new element @ {}", self.vec.len());
30+
eprintln!("creating new element @ {}", self.vec.count());
3631
std::mem::drop(lock);
3732
let mut lock = self.map.write().unwrap();
3833
let idx = self.vec.push(key);

0 commit comments

Comments
 (0)