Skip to content

Commit 4472263

Browse files
committed
Remove an outdated assertion
1 parent abbde8b commit 4472263

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/policy/marksweepspace/native_ms/global.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ impl<VM: VMBinding> MarkSweepSpace<VM> {
288288
let vm_map = args.vm_map;
289289
let is_discontiguous = args.vmrequest.is_discontiguous();
290290
let local_specs = {
291-
metadata::extract_side_metadata(&vec![
291+
metadata::extract_side_metadata(&[
292292
MetadataSpec::OnSide(Block::NEXT_BLOCK_TABLE),
293293
MetadataSpec::OnSide(Block::PREV_BLOCK_TABLE),
294294
MetadataSpec::OnSide(Block::FREE_LIST_TABLE),

src/util/heap/chunk_map.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,14 @@ impl Chunk {
5252
pub struct ChunkState(u8);
5353

5454
impl ChunkState {
55+
const ALLOC_BIT_MASK: u8 = 0x80;
56+
const SPACE_INDEX_MASK: u8 = 0x0F;
57+
5558
/// Create a new ChunkState that represents being allocated in the given space
5659
pub fn allocated(space_index: usize) -> ChunkState {
5760
debug_assert!(space_index < crate::util::heap::layout::heap_parameters::MAX_SPACES);
5861
let mut encode = space_index as u8;
59-
encode |= 0x80;
62+
encode |= Self::ALLOC_BIT_MASK;
6063
ChunkState(encode)
6164
}
6265
/// Create a new ChunkState that represents being free in the given space
@@ -66,16 +69,15 @@ impl ChunkState {
6669
}
6770
/// Is the chunk free?
6871
pub fn is_free(&self) -> bool {
69-
self.0 & 0x80 == 0
72+
self.0 & Self::ALLOC_BIT_MASK == 0
7073
}
7174
/// Is the chunk allocated?
7275
pub fn is_allocated(&self) -> bool {
7376
!self.is_free()
7477
}
7578
/// Get the space index of the chunk
7679
pub fn get_space_index(&self) -> usize {
77-
debug_assert!(self.is_allocated());
78-
let index = (self.0 & 0x0F) as usize;
80+
let index = (self.0 & Self::SPACE_INDEX_MASK) as usize;
7981
debug_assert!(index < crate::util::heap::layout::heap_parameters::MAX_SPACES);
8082
index
8183
}

0 commit comments

Comments
 (0)