cleanup
This commit is contained in:
parent
cd0e1344e4
commit
228513a638
2 changed files with 6 additions and 13 deletions
|
@ -7,7 +7,6 @@ use crate::{
|
||||||
threading::Thread,
|
threading::Thread,
|
||||||
VirtualMachine,
|
VirtualMachine,
|
||||||
};
|
};
|
||||||
use easy_bitfield::{AtomicBitfieldContainer, ToBitfield};
|
|
||||||
use mmtk::{
|
use mmtk::{
|
||||||
util::{
|
util::{
|
||||||
alloc::{AllocatorSelector, BumpAllocator, ImmixAllocator},
|
alloc::{AllocatorSelector, BumpAllocator, ImmixAllocator},
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
use crate::{define_vm_metadata_spec, VirtualMachine};
|
use crate::VirtualMachine;
|
||||||
use easy_bitfield::*;
|
use easy_bitfield::*;
|
||||||
|
|
||||||
use super::object::ADDRESS_BASED_HASHING;
|
use super::object::ADDRESS_BASED_HASHING;
|
||||||
|
@ -11,17 +11,11 @@ pub const OBJECT_REF_OFFSET: isize = 8;
|
||||||
pub const OBJECT_HEADER_OFFSET: isize = -OBJECT_REF_OFFSET;
|
pub const OBJECT_HEADER_OFFSET: isize = -OBJECT_REF_OFFSET;
|
||||||
pub const HASHCODE_OFFSET: isize = -(OBJECT_REF_OFFSET + size_of::<usize>() as isize);
|
pub const HASHCODE_OFFSET: isize = -(OBJECT_REF_OFFSET + size_of::<usize>() as isize);
|
||||||
|
|
||||||
|
pub const METADATA_BIT_LIMIT: usize = if ADDRESS_BASED_HASHING { 60 } else { 63 };
|
||||||
pub const METADATA_BIT_LIMIT: usize = if ADDRESS_BASED_HASHING {
|
|
||||||
60
|
|
||||||
} else {
|
|
||||||
63
|
|
||||||
};
|
|
||||||
|
|
||||||
pub type MetadataField = BitField<u64, usize, 0, METADATA_BIT_LIMIT, false>;
|
pub type MetadataField = BitField<u64, usize, 0, METADATA_BIT_LIMIT, false>;
|
||||||
pub type HashStateField = BitField<u64, HashState, { MetadataField::NEXT_BIT }, 2, false>;
|
pub type HashStateField = BitField<u64, HashState, { MetadataField::NEXT_BIT }, 2, false>;
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum HashState {
|
pub enum HashState {
|
||||||
Unhashed,
|
Unhashed,
|
||||||
|
@ -96,7 +90,7 @@ impl<VM: VirtualMachine> HeapObjectHeader<VM> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_metadata(&self, metadata: VM::Metadata) {
|
pub fn set_metadata(&self, metadata: VM::Metadata) {
|
||||||
self.metadata.update_synchronized::<MetadataField>(metadata.to_bitfield() as _);
|
self.metadata
|
||||||
|
.update_synchronized::<MetadataField>(metadata.to_bitfield() as _);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue