WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

Commit c281eacf authored by qinsoon's avatar qinsoon
Browse files

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