Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
qinsoon committed Sep 29, 2020
1 parent 3f4d795 commit 4af50fc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
12 changes: 10 additions & 2 deletions src/util/alloc/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ use crate::vm::VMBinding;
use crate::vm::{ActivePlan, Collection};

#[inline(always)]
pub fn align_allocation_no_fill<VM: VMBinding>(region: Address, alignment: usize, offset: isize) -> Address {
pub fn align_allocation_no_fill<VM: VMBinding>(
region: Address,
alignment: usize,
offset: isize,
) -> Address {
align_allocation::<VM>(region, alignment, offset, VM::MIN_ALIGNMENT, false)
}

Expand Down Expand Up @@ -77,7 +81,11 @@ pub fn fill_alignment_gap<VM: VMBinding>(immut_start: Address, end: Address) {
}

#[inline(always)]
pub fn get_maximum_aligned_size<VM: VMBinding>(size: usize, alignment: usize, known_alignment: usize) -> usize {
pub fn get_maximum_aligned_size<VM: VMBinding>(
size: usize,
alignment: usize,
known_alignment: usize,
) -> usize {
trace!(
"size={}, alignment={}, known_alignment={}, MIN_ALIGNMENT={}",
size,
Expand Down
9 changes: 6 additions & 3 deletions src/vm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ where
const MAX_ALIGNMENT_SHIFT: usize = 1 + LOG_BYTES_IN_LONG as usize - LOG_BYTES_IN_INT as usize;
#[cfg(target_arch = "x86_64")]
const MAX_ALIGNMENT_SHIFT: usize = LOG_BYTES_IN_LONG as usize - LOG_BYTES_IN_INT as usize;

const MAX_ALIGNMENT: usize = Self::MIN_ALIGNMENT << Self::MAX_ALIGNMENT_SHIFT;
// This value is used to assert if the cursor is reasonable after last allocation.
// At the end of an allocation, the allocation cursor should be aligned to this value.

// This value is used to assert if the cursor is reasonable after last allocation.
// At the end of an allocation, the allocation cursor should be aligned to this value.
// Note that MMTk does not attempt to do anything to align the cursor to this value, but
// it merely asserts with this constant.
const ALLOC_END_ALIGNMENT: usize = 1;
}

0 comments on commit 4af50fc

Please sign in to comment.