Commit 10495f88 authored by qinsoon's avatar qinsoon

remove warnings

parent ef467bc0
...@@ -14,14 +14,8 @@ ...@@ -14,14 +14,8 @@
use utils::Address; use utils::Address;
use utils::ByteSize; use utils::ByteSize;
use utils::POINTER_SIZE;
use common::gctype::*;
use MY_GC;
use objectmodel;
use std::collections::HashMap; use std::collections::HashMap;
use std::sync::Arc;
pub struct HeapDump { pub struct HeapDump {
pub objects: HashMap<Address, ObjectDump>, pub objects: HashMap<Address, ObjectDump>,
...@@ -63,6 +57,7 @@ impl HeapDump { ...@@ -63,6 +57,7 @@ impl HeapDump {
} }
#[cfg(feature = "use-sidemap")] #[cfg(feature = "use-sidemap")]
#[allow(unused_variables)]
fn persist_object(&self, obj: Address) -> ObjectDump { fn persist_object(&self, obj: Address) -> ObjectDump {
unimplemented!() unimplemented!()
} }
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
// limitations under the License. // limitations under the License.
use utils::Address; use utils::Address;
use utils::ByteSize;
use std::ops::Deref; use std::ops::Deref;
use std::ops::DerefMut; use std::ops::DerefMut;
use std::fmt; use std::fmt;
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
// limitations under the License. // limitations under the License.
use utils::Address; use utils::Address;
use heap::gc; use heap::gc;
use heap::immix;
use heap::Mutator; use heap::Mutator;
mod malloc_list; mod malloc_list;
......
...@@ -109,6 +109,7 @@ impl FreeListSpace { ...@@ -109,6 +109,7 @@ impl FreeListSpace {
#[inline(always)] #[inline(always)]
#[cfg(feature = "use-sidemap")] #[cfg(feature = "use-sidemap")]
#[allow(unused_variables)]
fn is_traced(&self, addr: Address, mark_state: u8) -> bool { fn is_traced(&self, addr: Address, mark_state: u8) -> bool {
unimplemented!() unimplemented!()
} }
......
...@@ -13,14 +13,9 @@ ...@@ -13,14 +13,9 @@
// limitations under the License. // limitations under the License.
use heap::*; use heap::*;
use heap::immix::*;
use heap::freelist::FreeListSpace;
use objectmodel; use objectmodel;
use objectmodel::sidemap::*; use objectmodel::sidemap::*;
use common::gctype::*;
use MY_GC; use MY_GC;
use utils::*;
use utils::bit_utils;
use std::sync::atomic::{AtomicIsize, AtomicBool, Ordering}; use std::sync::atomic::{AtomicIsize, AtomicBool, Ordering};
use std::sync::{Arc, Mutex, Condvar, RwLock}; use std::sync::{Arc, Mutex, Condvar, RwLock};
......
...@@ -16,17 +16,10 @@ use heap::Mutator; ...@@ -16,17 +16,10 @@ use heap::Mutator;
use heap::immix::*; use heap::immix::*;
use heap::immix::ImmixSpace; use heap::immix::ImmixSpace;
use heap::immix::immix_space::ImmixBlock; use heap::immix::immix_space::ImmixBlock;
use heap::gc;
use objectmodel; use objectmodel;
use objectmodel::sidemap::*;
use utils::Address; use utils::Address;
use utils::ByteSize; use utils::ByteSize;
use common::ptr::*;
use std::*; use std::*;
use std::sync::Arc;
use std::sync::RwLock;
use std::sync::atomic::{AtomicBool, Ordering};
const TRACE_ALLOC: bool = false; const TRACE_ALLOC: bool = false;
...@@ -173,6 +166,7 @@ impl ImmixAllocator { ...@@ -173,6 +166,7 @@ impl ImmixAllocator {
#[inline(always)] #[inline(always)]
#[cfg(feature = "use-sidemap")] #[cfg(feature = "use-sidemap")]
#[allow(unused_variables)]
pub fn init_hybrid<T>(&mut self, addr: Address, encode: T, len: u64) { pub fn init_hybrid<T>(&mut self, addr: Address, encode: T, len: u64) {
unimplemented!() unimplemented!()
} }
......
...@@ -12,46 +12,19 @@ ...@@ -12,46 +12,19 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use common::AddressMap;
use common::ptr::*; use common::ptr::*;
use heap::*; use heap::*;
use heap::immix::*; use heap::immix::*;
use heap::gc; use heap::gc;
use objectmodel::sidemap::*;
use utils::*;
use utils::mem::malloc_zero;
use utils::mem::memmap; use utils::mem::memmap;
use utils::mem::memsec; use utils::mem::memsec;
use std::*; use std::*;
use std::collections::LinkedList; use std::collections::LinkedList;
use std::sync::Mutex; use std::sync::Mutex;
use std::sync::Arc;
const TRACE_ALLOC: bool = true; const TRACE_ALLOC: bool = true;
#[repr(C, packed)]
#[derive(Copy, Clone)]
/// Every Immix block owns its own segment of the line mark table
pub struct BlockLineMarkTable {
ptr: *mut LineMark
}
impl BlockLineMarkTable {
#[inline(always)]
pub fn get(&self, index: u8) -> LineMark {
unsafe { *self.ptr.offset(index as isize) }
}
#[inline(always)]
pub fn set(&mut self, index: u8, value: LineMark) {
unsafe { *self.ptr.offset(index as isize) = value };
}
#[inline(always)]
pub fn len(&self) -> u8 {
LINES_IN_BLOCK as u8
}
}
/// An ImmixSpace represents a memory area that is used for immix heap and also its meta data /// An ImmixSpace represents a memory area that is used for immix heap and also its meta data
/// ///
/// Memory layout /// Memory layout
...@@ -232,7 +205,7 @@ impl ImmixSpace { ...@@ -232,7 +205,7 @@ impl ImmixSpace {
let line_start = (cur_addr - self.mem_start()) >> LOG_BYTES_IN_LINE; let line_start = (cur_addr - self.mem_start()) >> LOG_BYTES_IN_LINE;
let block_start = self.cur_blocks; let block_start = self.cur_blocks;
for i in 0..n_blocks { for _ in 0..n_blocks {
let block: Raw<ImmixBlock> = unsafe { Raw::from_addr(cur_addr) }; let block: Raw<ImmixBlock> = unsafe { Raw::from_addr(cur_addr) };
// add to usable blocks // add to usable blocks
lock.push_back(block); lock.push_back(block);
...@@ -401,7 +374,7 @@ impl ImmixSpace { ...@@ -401,7 +374,7 @@ impl ImmixSpace {
let mut live_blocks: LinkedList<Raw<ImmixBlock>> = LinkedList::new(); let mut live_blocks: LinkedList<Raw<ImmixBlock>> = LinkedList::new();
while !used_blocks_lock.is_empty() { while !used_blocks_lock.is_empty() {
let mut block = used_blocks_lock.pop_front().unwrap(); let block = used_blocks_lock.pop_front().unwrap();
let line_index = self.get_line_mark_index(block.mem_start()); let line_index = self.get_line_mark_index(block.mem_start());
let block_index = self.get_block_mark_index(block.mem_start()); let block_index = self.get_block_mark_index(block.mem_start());
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
use utils::*; use utils::*;
use heap::*; use heap::*;
use std::mem::size_of;
mod immix_space; mod immix_space;
mod immix_mutator; mod immix_mutator;
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
// limitations under the License. // limitations under the License.
use utils::*; use utils::*;
use utils::bit_utils;
use objectmodel;
use common::ptr::*; use common::ptr::*;
use heap::immix::*; use heap::immix::*;
......
...@@ -87,14 +87,11 @@ use heap::*; ...@@ -87,14 +87,11 @@ use heap::*;
use heap::immix::BYTES_IN_LINE; use heap::immix::BYTES_IN_LINE;
use heap::immix::ImmixSpace; use heap::immix::ImmixSpace;
use heap::immix::ImmixAllocator; use heap::immix::ImmixAllocator;
use heap::freelist;
use heap::freelist::FreeListSpace;
use utils::LinkedHashSet; use utils::LinkedHashSet;
use utils::Address; use utils::Address;
use utils::ObjectReference; use utils::ObjectReference;
use objectmodel::sidemap::*; use objectmodel::sidemap::*;
use std::fmt;
use std::sync::Arc; use std::sync::Arc;
use std::sync::RwLock; use std::sync::RwLock;
use std::sync::atomic::Ordering; use std::sync::atomic::Ordering;
...@@ -328,6 +325,7 @@ pub extern "C" fn muentry_alloc_normal_slow( ...@@ -328,6 +325,7 @@ pub extern "C" fn muentry_alloc_normal_slow(
/// allocates an object in the freelist space (large object space) /// allocates an object in the freelist space (large object space)
#[no_mangle] #[no_mangle]
#[inline(never)] #[inline(never)]
#[allow(unused_variables)]
pub extern "C" fn muentry_alloc_large( pub extern "C" fn muentry_alloc_large(
mutator: *mut Mutator, mutator: *mut Mutator,
size: usize, size: usize,
...@@ -371,10 +369,10 @@ pub extern "C" fn muentry_alloc_any( ...@@ -371,10 +369,10 @@ pub extern "C" fn muentry_alloc_any(
/// initializes a fix-sized object /// initializes a fix-sized object
#[no_mangle] #[no_mangle]
#[inline(always)] #[inline(always)]
pub extern "C" fn muentry_init_tiny_object<T>( pub extern "C" fn muentry_init_tiny_object(
mutator: *mut Mutator, mutator: *mut Mutator,
obj: ObjectReference, obj: ObjectReference,
encode: T encode: TinyObjectEncode
) { ) {
unsafe { &mut *mutator } unsafe { &mut *mutator }
.tiny .tiny
......
...@@ -55,18 +55,18 @@ const SMALL_ENTRY_CAP: usize = 1 << SMALL_ID_WIDTH; ...@@ -55,18 +55,18 @@ const SMALL_ENTRY_CAP: usize = 1 << SMALL_ID_WIDTH;
const LARGE_ENTRY_CAP: usize = N_TYPES; const LARGE_ENTRY_CAP: usize = N_TYPES;
/// storing a pointer to the actual type table /// storing a pointer to the actual type table
static global_type_table_ptr: AtomicUsize = ATOMIC_USIZE_INIT; static GLOBAL_TYPE_TABLE_PTR: AtomicUsize = ATOMIC_USIZE_INIT;
/// storing a pointer to the metadata of the type table /// storing a pointer to the metadata of the type table
static global_type_table_meta: AtomicUsize = ATOMIC_USIZE_INIT; static GLOBAL_TYPE_TABLE_META: AtomicUsize = ATOMIC_USIZE_INIT;
/// save Mmap to keep the memory map alive /// save Mmap to keep the memory map alive
// it is okay to use lock here, as we won't actually access this field // it is okay to use lock here, as we won't actually access this field
lazy_static!{ lazy_static!{
static ref gtt_mmap: Mutex<Option<memmap::MmapMut>> = Mutex::new(None); static ref GTT_MMAP: Mutex<Option<memmap::MmapMut>> = Mutex::new(None);
} }
impl GlobalTypeTable { impl GlobalTypeTable {
pub fn init() { pub fn init() {
let mut mmap_lock = gtt_mmap.lock().unwrap(); let mut mmap_lock = GTT_MMAP.lock().unwrap();
assert!(mmap_lock.is_none()); assert!(mmap_lock.is_none());
let entry_size = mem::size_of::<TypeEncode>(); let entry_size = mem::size_of::<TypeEncode>();
...@@ -81,10 +81,10 @@ impl GlobalTypeTable { ...@@ -81,10 +81,10 @@ impl GlobalTypeTable {
// start address of metadata // start address of metadata
let meta_addr = Address::from_ptr::<u8>(mmap.as_mut_ptr()); let meta_addr = Address::from_ptr::<u8>(mmap.as_mut_ptr());
global_type_table_meta.store(meta_addr.as_usize(), Ordering::Relaxed); GLOBAL_TYPE_TABLE_META.store(meta_addr.as_usize(), Ordering::Relaxed);
// actual table // actual table
let table_addr = meta_addr + metadata_size; let table_addr = meta_addr + metadata_size;
global_type_table_ptr.store(table_addr.as_usize(), Ordering::Relaxed); GLOBAL_TYPE_TABLE_PTR.store(table_addr.as_usize(), Ordering::Relaxed);
// initialize meta // initialize meta
let meta: &mut GlobalTypeTable = unsafe { meta_addr.to_ptr_mut().as_mut().unwrap() }; let meta: &mut GlobalTypeTable = unsafe { meta_addr.to_ptr_mut().as_mut().unwrap() };
...@@ -98,12 +98,12 @@ impl GlobalTypeTable { ...@@ -98,12 +98,12 @@ impl GlobalTypeTable {
#[inline(always)] #[inline(always)]
fn table_meta() -> &'static mut GlobalTypeTable { fn table_meta() -> &'static mut GlobalTypeTable {
unsafe { mem::transmute(global_type_table_meta.load(Ordering::Relaxed)) } unsafe { mem::transmute(GLOBAL_TYPE_TABLE_META.load(Ordering::Relaxed)) }
} }
#[inline(always)] #[inline(always)]
pub fn table() -> &'static mut [TypeEncode; N_TYPES] { pub fn table() -> &'static mut [TypeEncode; N_TYPES] {
unsafe { mem::transmute(global_type_table_ptr.load(Ordering::Relaxed)) } unsafe { mem::transmute(GLOBAL_TYPE_TABLE_PTR.load(Ordering::Relaxed)) }
} }
pub fn insert_small_entry(entry: TypeEncode) -> TypeID { pub fn insert_small_entry(entry: TypeEncode) -> TypeID {
......
...@@ -79,15 +79,8 @@ ...@@ -79,15 +79,8 @@
//! 4 bytes - type ID //! 4 bytes - type ID
//! 4 bytes - unused //! 4 bytes - unused
use std::sync::atomic;
use common::gctype::GCType; use common::gctype::GCType;
use heap::SpaceDescriptor; use utils::*;
use heap::immix::*;
use utils::{Address, ObjectReference};
use utils::{LOG_POINTER_SIZE, POINTER_SIZE};
use utils::bit_utils;
use utils::{ByteSize, ByteOffset};
use std::mem::transmute;
pub const MINIMAL_ALIGNMENT: ByteSize = 16; pub const MINIMAL_ALIGNMENT: ByteSize = 16;
pub const MINIMAL_OBJECT_SIZE: ByteSize = 16; pub const MINIMAL_OBJECT_SIZE: ByteSize = 16;
...@@ -107,10 +100,12 @@ pub use objectmodel::sidemap::object_encode::*; ...@@ -107,10 +100,12 @@ pub use objectmodel::sidemap::object_encode::*;
pub use objectmodel::sidemap::type_encode::*; pub use objectmodel::sidemap::type_encode::*;
pub use objectmodel::sidemap::global_type_table::*; pub use objectmodel::sidemap::global_type_table::*;
#[allow(unused_variables)]
pub fn gen_gctype_encode(ty: &GCType) -> u64 { pub fn gen_gctype_encode(ty: &GCType) -> u64 {
unimplemented!() unimplemented!()
} }
#[allow(unused_variables)]
pub fn gen_hybrid_gctype_encode(ty: &GCType, length: u32) -> u64 { pub fn gen_hybrid_gctype_encode(ty: &GCType, length: u32) -> u64 {
unimplemented!() unimplemented!()
} }
......
...@@ -12,15 +12,10 @@ ...@@ -12,15 +12,10 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
use common::gctype::GCType;
use objectmodel::sidemap::TypeID; use objectmodel::sidemap::TypeID;
use objectmodel::sidemap::type_encode::WordType; use objectmodel::sidemap::type_encode::WordType;
use std::sync::atomic; use utils::*;
use utils::{Address, ObjectReference};
use utils::{LOG_POINTER_SIZE, POINTER_SIZE};
use utils::bit_utils;
use utils::{ByteSize, ByteOffset};
use std::mem::transmute; use std::mem::transmute;
pub const MAX_TINY_OBJECT: ByteSize = 32; pub const MAX_TINY_OBJECT: ByteSize = 32;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment