Revert "try bigger smallvec for vregs"

This reverts commit 75fdc9d3a4.
This commit is contained in:
T0b1
2023-04-16 14:24:23 +02:00
parent 75fdc9d3a4
commit 74873feb96

View File

@@ -144,8 +144,8 @@ struct FastAllocState<'a, F: Function> {
pub vregs: Vec<VRegData>,
pub pregs: Vec<PRegData>,
pub blocks: Vec<BlockData>,
pub liveins: Vec<VRegBitmap>,
pub liveouts: Vec<VRegBitmap>,
pub liveins: Vec<BlockBitmap>,
pub liveouts: Vec<BlockBitmap>,
pub cur_stack_slot_idx: u32,
pub reftype_vregs_in_pregs_count: u32,
@@ -1147,60 +1147,6 @@ impl BlockBitmap {
}
}
#[derive(Clone, Debug)]
struct VRegBitmap {
storage: SmallVec<[u64; 8]>,
}
impl VRegBitmap {
fn init(vreg_count: usize) -> Self {
let u64_count = (vreg_count + 63) / 64;
let mut storage = SmallVec::<[u64; 8]>::with_capacity(u64_count);
storage.resize(u64_count, 0);
Self { storage }
}
fn set(&mut self, idx: usize) {
let idx = idx / 64;
let bit = 1u64 << (idx % 64);
self.storage[idx] |= bit;
}
fn un_set(&mut self, idx: usize) {
let idx = idx / 64;
let bit = 1u64 << (idx % 64);
self.storage[idx] &= !bit;
}
fn is_set(&mut self, idx: usize) -> bool {
let idx = idx / 64;
let bit = 1u64 << (idx % 64);
(self.storage[idx] & bit) != 0
}
fn is_empty(&self) -> bool {
for &b in self.storage.iter() {
if b != 0 {
return false;
}
}
return true;
}
pub fn union_with(&mut self, other: &Self) -> bool {
let mut changed = 0;
for (word_idx, &bits) in other.storage.iter().enumerate() {
if bits == 0 {
continue;
}
let self_word = &mut self.storage[word_idx];
changed |= bits & !*self_word;
*self_word |= bits;
}
changed != 0
}
}
// currently, copy from liveranges.rs
// don't inline for better perf stats
#[inline(never)]
@@ -1210,10 +1156,10 @@ fn calc_live_bitmaps<'a, F: Function>(
) -> Result<(), RegAllocError> {
state
.liveins
.resize(state.blocks.len(), VRegBitmap::init(state.vregs.len()));
.resize(state.blocks.len(), BlockBitmap::init(state.vregs.len()));
state
.liveouts
.resize(state.blocks.len(), VRegBitmap::init(state.vregs.len()));
.resize(state.blocks.len(), BlockBitmap::init(state.vregs.len()));
// Run a worklist algorithm to precisely compute liveins and
// liveouts.