GitLab will be upgraded on June 2nd 2020 at 2.00 pm (AEDT) to 3.00 pm (AEDT) due to Critical Security Patch Availability. During the update, GitLab and Mattermost services will not be available. If you have any concerns with this, please talk to local Gitlab admin team.

Commit c281eacf authored by qinsoon's avatar qinsoon

stack conservatism: addr needs to be aligned to be a valid object.

cargo test needs ALWAYS run with 1 test thread (RUST_TEST_THREADS=1)
parent 044bb53f
......@@ -89,11 +89,29 @@ pub fn is_valid_object(addr: Address, start: Address, end: Address, live_map: *m
let index = (addr.diff(start) >> LOG_POINTER_SIZE) as isize;
bit_utils::test_nth_bit(unsafe {*live_map.offset(index)}, objectmodel::OBJ_START_BIT)
if !bit_utils::test_nth_bit(unsafe {*live_map.offset(index)}, objectmodel::OBJ_START_BIT) {
return false;
}
if !addr.is_aligned_to(POINTER_SIZE) {
return false;
}
true
}
pub fn stack_scan() -> Vec<ObjectReference> {
trace!("stack scanning...");
let stack_ptr : Address = unsafe {immmix_get_stack_ptr()};
if cfg!(debug_assertions) {
if !stack_ptr.is_aligned_to(8) {
use std::process;
println!("trying to scanning stack, however the current stack pointer is 0x{:x}, which is not aligned to 8bytes", stack_ptr);
process::exit(102);
}
}
let low_water_mark : Address = unsafe {get_low_water_mark()};
let mut cursor = stack_ptr;
......
......@@ -128,9 +128,25 @@ impl ImmixMutatorLocal {
// println!("cursor = {:#X}, after align = {:#X}", c, start);
if end > self.limit {
self.try_alloc_from_local(size, align)
let ret = self.try_alloc_from_local(size, align);
if cfg!(debug_assertions) {
if !ret.is_aligned_to(align) {
use std::process;
println!("wrong alignment on 0x{:x}, expected align: {}", ret, align);
process::exit(102);
}
}
ret
} else {
// fill_alignment_gap(self.cursor, start);
if cfg!(debug_assertions) {
if !start.is_aligned_to(align) {
use std::process;
println!("wrong alignment on 0x{:x}, expected align: {}", start, align);
process::exit(102);
}
}
self.cursor = end;
start
......
......@@ -269,7 +269,7 @@ impl ImmixSpace {
used_blocks_lock.append(&mut live_blocks);
if cfg!(debug_assertions) {
println!("free lines = {} of {} total", free_lines, self.total_blocks * immix::LINES_IN_BLOCK);
println!("free lines = {} of {} total ({} blocks)", free_lines, self.total_blocks * immix::LINES_IN_BLOCK, self.total_blocks);
println!("usable blocks = {}", usable_blocks);
println!("full blocks = {}", full_blocks);
}
......
......@@ -110,6 +110,7 @@ fn alloc(mutator: &mut ImmixMutatorLocal) -> *mut Node {
let addr = mutator.alloc(size_of::<Node>(), 8);
mutator.init_object(addr, 0b1100_0011);
// objectmodel::init_header(unsafe{addr.to_object_reference()}, HEADER_INIT_U64);
addr.to_ptr_mut::<Node>()
}
......
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