Commit 9883ddf1 authored by qinsoon's avatar qinsoon

reformat subcrates with new rustfmt.toml

parent af9e8261
Pipeline #756 passed with stages
in 31 minutes and 9 seconds
This diff is collapsed.
This diff is collapsed.
......@@ -36,7 +36,7 @@ pub enum BinOp {
FSub,
FMul,
FDiv,
FRem,
FRem
}
#[derive(Copy, Clone, Debug, PartialEq)]
......@@ -69,7 +69,7 @@ pub enum CmpOp {
FULT,
FULE,
FUNE,
FUNO,
FUNO
}
impl CmpOp {
......@@ -97,7 +97,7 @@ impl CmpOp {
FUGT => FULT,
FULT => FUGT,
_ => self, // all other comparisons are symmetric
_ => self // all other comparisons are symmetric
}
}
......@@ -142,7 +142,7 @@ impl CmpOp {
FONE => FUEQ,
FFALSE => FTRUE,
FTRUE => FFALSE,
FTRUE => FFALSE
}
}
......@@ -154,7 +154,7 @@ impl CmpOp {
SLT => ULT,
SGT => UGT,
SLE => ULE,
_ => self,
_ => self
}
}
......@@ -162,7 +162,7 @@ impl CmpOp {
use op::CmpOp::*;
match self {
SGE | SLT | SGT | SLE => true,
_ => false,
_ => false
}
}
......@@ -170,7 +170,7 @@ impl CmpOp {
use op::CmpOp::*;
match self {
EQ | NE | SGE | SGT | SLE | SLT | UGE | UGT | ULE | ULT => true,
_ => false,
_ => false
}
}
......@@ -178,7 +178,7 @@ impl CmpOp {
use op::CmpOp::*;
match self {
EQ | NE | FORD | FUNO | FUNE | FUEQ | FONE | FOEQ => true,
_ => false,
_ => false
}
}
}
......@@ -196,7 +196,7 @@ pub enum ConvOp {
SITOFP,
BITCAST,
REFCAST,
PTRCAST,
PTRCAST
}
#[derive(Copy, Clone, Debug, PartialEq)]
......@@ -211,5 +211,5 @@ pub enum AtomicRMWOp {
MAX,
MIN,
UMAX,
UMIN,
UMIN
}
......@@ -108,7 +108,7 @@ pub fn init_types() {
#[derive(PartialEq, Debug)]
pub struct MuType {
pub hdr: MuEntityHeader,
pub v: MuType_,
pub v: MuType_
}
rodal_struct!(MuType { hdr, v });
......@@ -118,7 +118,7 @@ impl MuType {
pub fn new(id: MuID, v: MuType_) -> MuType {
MuType {
hdr: MuEntityHeader::unnamed(id),
v: v,
v: v
}
}
......@@ -126,7 +126,7 @@ impl MuType {
pub fn is_struct(&self) -> bool {
match self.v {
MuType_::Struct(_) => true,
_ => false,
_ => false
}
}
......@@ -134,7 +134,7 @@ impl MuType {
pub fn is_hybrid(&self) -> bool {
match self.v {
MuType_::Hybrid(_) => true,
_ => false,
_ => false
}
}
......@@ -142,7 +142,7 @@ impl MuType {
pub fn is_fp(&self) -> bool {
match self.v {
MuType_::Float | MuType_::Double => true,
_ => false,
_ => false
}
}
......@@ -150,7 +150,7 @@ impl MuType {
pub fn is_float(&self) -> bool {
match self.v {
MuType_::Float => true,
_ => false,
_ => false
}
}
......@@ -158,7 +158,7 @@ impl MuType {
pub fn is_double(&self) -> bool {
match self.v {
MuType_::Double => true,
_ => false,
_ => false
}
}
......@@ -177,7 +177,7 @@ impl MuType {
MuType_::StackRef |
MuType_::Tagref64 |
MuType_::UPtr(_) => true,
_ => false,
_ => false
}
}
......@@ -186,7 +186,7 @@ impl MuType {
pub fn get_struct_hybrid_tag(&self) -> Option<MuName> {
match self.v {
MuType_::Hybrid(ref name) | MuType_::Struct(ref name) => Some(name.clone()),
_ => None,
_ => None
}
}
......@@ -195,7 +195,7 @@ impl MuType {
pub fn is_ref(&self) -> bool {
match self.v {
MuType_::Ref(_) => true,
_ => false,
_ => false
}
}
......@@ -203,7 +203,7 @@ impl MuType {
pub fn is_heap_reference(&self) -> bool {
match self.v {
MuType_::Ref(_) | MuType_::IRef(_) | MuType_::WeakRef(_) => true,
_ => false,
_ => false
}
}
......@@ -211,7 +211,7 @@ impl MuType {
pub fn is_iref(&self) -> bool {
match self.v {
MuType_::IRef(_) => true,
_ => false,
_ => false
}
}
......@@ -219,7 +219,7 @@ impl MuType {
pub fn is_ptr(&self) -> bool {
match self.v {
MuType_::UPtr(_) | MuType_::UFuncPtr(_) => true,
_ => false,
_ => false
}
}
......@@ -227,7 +227,7 @@ impl MuType {
pub fn is_aggregate(&self) -> bool {
match self.v {
MuType_::Struct(_) | MuType_::Hybrid(_) | MuType_::Array(_, _) => true,
_ => false,
_ => false
}
}
......@@ -264,7 +264,7 @@ impl MuType {
.map(|ty| ty.is_traced())
.fold(false, |ret, this| ret || this)
}
_ => false,
_ => false
}
}
......@@ -305,7 +305,7 @@ impl MuType {
.map(|ty| ty.is_native_safe())
.fold(true, |ret, this| ret && this)
}
_ => false,
_ => false
}
}
......@@ -313,7 +313,7 @@ impl MuType {
pub fn get_elem_ty(&self) -> Option<P<MuType>> {
match self.v {
MuType_::Array(ref elem_ty, _) => Some(elem_ty.clone()),
_ => None,
_ => None
}
}
......@@ -333,7 +333,7 @@ impl MuType {
Some(hybrid_inner.fix_tys[index].clone())
}
_ => None,
_ => None
}
}
......@@ -346,7 +346,7 @@ impl MuType {
Some(hybrid_inner.var_ty.clone())
}
_ => None,
_ => None
}
}
......@@ -356,7 +356,7 @@ impl MuType {
use types::MuType_::*;
match self.v {
Ref(ref ty) | IRef(ref ty) | WeakRef(ref ty) | UPtr(ref ty) => Some(ty.clone()),
_ => None,
_ => None
}
}
......@@ -375,7 +375,7 @@ impl MuType {
Tagref64 |
FuncRef(_) |
UFuncPtr(_) => Some(64),
_ => None,
_ => None
}
}
}
......@@ -430,7 +430,7 @@ pub enum MuType_ {
FuncRef(P<MuFuncSig>),
/// ufuncptr<@sig>
UFuncPtr(P<MuFuncSig>),
UFuncPtr(P<MuFuncSig>)
}
rodal_enum!(MuType_{(Int: size), Float, Double, (Ref: ty), (IRef: ty), (WeakRef: ty), (UPtr: ty),
......@@ -462,7 +462,7 @@ impl fmt::Display for MuType_ {
&MuType_::FuncRef(ref sig) => write!(f, "funcref<{}>", sig),
&MuType_::UFuncPtr(ref sig) => write!(f, "ufuncref<{}>", sig),
&MuType_::Struct(ref tag) => write!(f, "{}(struct)", tag),
&MuType_::Hybrid(ref tag) => write!(f, "{}(hybrid)", tag),
&MuType_::Hybrid(ref tag) => write!(f, "{}(hybrid)", tag)
}
}
}
......@@ -479,7 +479,7 @@ lazy_static! {
rodal_struct!(StructType_{tys});
#[derive(PartialEq, Debug)]
pub struct StructType_ {
tys: Vec<P<MuType>>,
tys: Vec<P<MuType>>
}
impl fmt::Display for StructType_ {
......@@ -515,14 +515,14 @@ rodal_struct!(HybridType_{fix_tys, var_ty});
#[derive(PartialEq, Debug)]
pub struct HybridType_ {
fix_tys: Vec<P<MuType>>,
var_ty: P<MuType>,
var_ty: P<MuType>
}
impl HybridType_ {
pub fn new(fix_tys: Vec<P<MuType>>, var_ty: P<MuType>) -> HybridType_ {
HybridType_ {
fix_tys: fix_tys,
var_ty: var_ty,
var_ty: var_ty
}
}
......@@ -626,7 +626,7 @@ impl MuType_ {
struct_ty_.tys.clear();
struct_ty_.tys.append(&mut list);
}
None => panic!("call mustruct_empty() to create an empty struct before mustruct_put()"),
None => panic!("call mustruct_empty() to create an empty struct before mustruct_put()")
}
}
/// creates a Mu struct with specified field types
......@@ -658,7 +658,7 @@ impl MuType_ {
pub fn hybrid_empty(tag: HybridTag) -> MuType_ {
let hybrid_ty_ = HybridType_ {
fix_tys: vec![],
var_ty: VOID_TYPE.clone(),
var_ty: VOID_TYPE.clone()
};
HYBRID_TAG_MAP
.write()
......@@ -682,14 +682,14 @@ impl MuType_ {
hybrid_ty_.var_ty = var_ty;
}
None => panic!("call hybrid_empty() to create an empty struct before hybrid_put()"),
None => panic!("call hybrid_empty() to create an empty struct before hybrid_put()")
}
}
/// creates a Mu hybrid with specified fix part and var part types
pub fn hybrid(tag: HybridTag, fix_tys: Vec<P<MuType>>, var_ty: P<MuType>) -> MuType_ {
let hybrid_ty_ = HybridType_ {
fix_tys: fix_tys,
var_ty: var_ty,
var_ty: var_ty
};
......@@ -717,7 +717,7 @@ impl MuType_ {
pub struct MuFuncSig {
pub hdr: MuEntityHeader,
pub ret_tys: Vec<P<MuType>>,
pub arg_tys: Vec<P<MuType>>,
pub arg_tys: Vec<P<MuType>>
}
rodal_struct!(MuFuncSig{hdr, ret_tys, arg_tys});
......
......@@ -21,7 +21,7 @@ pub struct AddressBitmap {
start: Address,
end: Address,
bitmap: Bitmap,
bitmap: Bitmap
}
impl AddressBitmap {
......@@ -32,7 +32,7 @@ impl AddressBitmap {
AddressBitmap {
start: start,
end: end,
bitmap: bitmap,
bitmap: bitmap
}
}
......
......@@ -24,12 +24,12 @@ pub struct AddressMap<T: Copy> {
end: Address,
pub ptr: *mut T,
len: usize,
len: usize
}
impl<T> AddressMap<T>
where
T: Copy,
T: Copy
{
pub fn new(start: Address, end: Address) -> AddressMap<T> {
let len = (end - start) >> LOG_POINTER_SIZE;
......@@ -39,7 +39,7 @@ where
start: start,
end: end,
ptr: ptr,
len: len,
len: len
}
}
......
......@@ -19,7 +19,7 @@ use heap::gc::malloc_zero;
#[derive(Clone)]
pub struct Bitmap {
bitmap: *mut u64,
bitmap_len: usize,
bitmap_len: usize
}
impl Bitmap {
......@@ -32,7 +32,7 @@ impl Bitmap {
Bitmap {
bitmap: bitmap,
bitmap_len: bitmap_len,
bitmap_len: bitmap_len
}
}
......
......@@ -39,7 +39,7 @@ pub struct GCType {
pub fix_refs: Option<RefPattern>, //+16
pub var_refs: Option<RefPattern>, //+64
pub var_size: Option<ByteSize>, //+112
pub var_size: Option<ByteSize> //+112
}
impl GCType {
......@@ -47,7 +47,7 @@ impl GCType {
id: u32,
size: ByteSize,
alignment: ByteSize,
fix_refs: Option<RefPattern>,
fix_refs: Option<RefPattern>
) -> GCType {
GCType {
id: id,
......@@ -57,7 +57,7 @@ impl GCType {
fix_size: size,
var_refs: None,
var_size: None,
var_size: None
}
}
......@@ -67,7 +67,7 @@ impl GCType {
alignment: ByteSize,
fix_refs: Option<RefPattern>,
var_refs: Option<RefPattern>,
var_size: ByteSize,
var_size: ByteSize
) -> GCType {
GCType {
id: id,
......@@ -77,7 +77,7 @@ impl GCType {
fix_size: size,
var_refs: var_refs,
var_size: Some(var_size),
var_size: Some(var_size)
}
}
......@@ -90,7 +90,7 @@ impl GCType {
fix_size: size,
var_refs: None,
var_size: None,
var_size: None
}
}
......@@ -101,12 +101,12 @@ impl GCType {
fix_refs: Some(RefPattern::Map {
offsets: vec![0],
size: POINTER_SIZE,
size: POINTER_SIZE
}),
fix_size: POINTER_SIZE,
var_refs: None,
var_size: None,
var_size: None
}
}
......@@ -175,13 +175,13 @@ pub enum RefPattern {
// discriminat 8 bytes
Map {
offsets: Vec<ByteSize>, // +8
size: usize, // +32
size: usize // +32
},
NestedType(Vec<Arc<GCType>>), // +8
Repeat {
pattern: Box<RefPattern>, // +8
count: usize, // +16
},
count: usize // +16
}
}
impl RefPattern {
......@@ -195,7 +195,7 @@ impl RefPattern {
}
size
}
&RefPattern::Repeat { ref pattern, count } => pattern.size() * count,
&RefPattern::Repeat { ref pattern, count } => pattern.size() * count
}
}
......@@ -250,11 +250,11 @@ mod tests {
fix_size: 16,
fix_refs: Some(RefPattern::Map {
offsets: vec![0],
size: 16,
size: 16
}),
var_size: None,
var_refs: None,
var_refs: None
};
// array of struct {ref, int64} with length 10
......@@ -266,13 +266,13 @@ mod tests {
fix_refs: Some(RefPattern::Repeat {
pattern: Box::new(RefPattern::Map {
offsets: vec![0],
size: 16,
size: 16
}),
count: 10,
count: 10
}),
var_size: None,
var_refs: None,
var_refs: None
};
// array(10) of array(10) of struct {ref, int64}
......@@ -283,11 +283,11 @@ mod tests {
fix_size: 1600,
fix_refs: Some(RefPattern::Repeat {
pattern: Box::new(RefPattern::NestedType(vec![Arc::new(b.clone()).clone()])),
count: 10,
count: 10
}),
var_size: None,
var_refs: None,
var_refs: None
};
vec![a, b, c]
......@@ -308,11 +308,11 @@ mod tests {
fix_size: 16,
fix_refs: Some(RefPattern::Map {
offsets: vec![0],
size: 16,
size: 16
}),
var_size: Some(8),
var_refs: None,
var_refs: None
};
assert_eq!(a.gen_hybrid_ref_offsets(5), vec![0]);
......@@ -329,14 +329,14 @@ mod tests {
fix_size: 16,
fix_refs: Some(RefPattern::Map {
offsets: vec![0],
size: 16,
size: 16
}),
var_size: Some(8),
var_refs: Some(RefPattern::Map {
offsets: vec![0],
size: 8,
}),
size: 8
})
};
assert_eq!(a.gen_hybrid_ref_offsets(5), vec![0, 16, 24, 32, 40, 48]);
......@@ -359,7 +359,7 @@ mod tests {
fix_refs: None,
var_size: None,
var_refs: None,
var_refs: None
};
assert_eq!(int.gen_ref_offsets(), vec![]);
......
......@@ -25,7 +25,7 @@ use std::sync::Arc;
pub struct HeapDump {
pub objects: HashMap<Address, ObjectDump>,
pub relocatable_refs: HashMap<Address, String>,
pub relocatable_refs: HashMap<Address, String>
}
pub struct ObjectDump {
......@@ -33,7 +33,7 @@ pub struct ObjectDump {
pub mem_size: ByteSize,
pub reference_addr: Address,
pub reference_offsets: Vec<ByteSize>, // based on reference_addr
pub reference_offsets: Vec<ByteSize> // based on reference_addr
}
impl HeapDump {
......@@ -42,7 +42,7 @@ impl HeapDump {
let mut work_queue: Vec<Address> = roots;
let mut heap: HeapDump = HeapDump {
objects: HashMap::new(),
relocatable_refs: HashMap::new(),
relocatable_refs: HashMap::new()
};
while !work_queue.is_empty() {
......@@ -92,7 +92,7 @@ impl HeapDump {
mem_start: hdr_addr,
mem_size: objectmodel::header_get_object_size(hdr) as usize +
objectmodel::OBJECT_HEADER_SIZE,
reference_offsets: offsets,
reference_offsets: offsets
}
} else {
// by type ID
......@@ -108,7 +108,7 @@ impl HeapDump {
reference_addr: obj,
mem_start: hdr_addr,
mem_size: gctype.size() + objectmodel::OBJECT_HEADER_SIZE,
reference_offsets: gctype.gen_ref_offsets(),
reference_offsets: gctype.gen_ref_offsets()
}
}
} else {
......@@ -126,7 +126,7 @@ impl HeapDump {
reference_addr: obj,
mem_start: hdr_addr,
mem_size: gctype.size_hybrid(var_length) + objectmodel::OBJECT_HEADER_SIZE,
reference_offsets: gctype.gen_hybrid_ref_offsets(var_length),
reference_offsets: gctype.gen_hybrid_ref_offsets(var_length)
}
}
}
......
......@@ -25,7 +25,7 @@ pub struct FreeListSpace {
node_id: usize,
size: usize,
used_bytes: usize,
used_bytes: usize
}
impl FreeListSpace {
......@@ -34,7 +34,7 @@ impl FreeListSpace {
current_nodes: LinkedList::new(),
node_id: 0,
size: size,
used_bytes: 0,
used_bytes: 0
}
}
......@@ -53,7 +53,7 @@ impl FreeListSpace {
id: self.node_id,
start: addr,
size: size,
mark: NodeMark::FreshAlloc,
mark: NodeMark::FreshAlloc
}));
self.node_id += 1;
self.used_bytes += size;
......@@ -106,7 +106,7 @@ pub struct FreeListNode {
id: usize,
start: Address,
size: usize,
mark: NodeMark,
mark: NodeMark
}
impl FreeListNode {
......@@ -119,7 +119,7 @@ impl FreeListNode {
pub enum NodeMark {
FreshAlloc,
PrevLive,
Live,
Live
}
unsafe impl Sync for NodeMark {}
......
......@@ -28,7 +28,7 @@ pub fn alloc_large(
size: usize,
align: usize,
mutator: &mut immix::ImmixMutatorLocal,
space: Arc<FreeListSpace>,
space: Arc<FreeListSpace>
) -> Address {
loop {
mutator.yieldpoint();
......
......@@ -40,17 +40,17 @@ pub struct FreeListSpace {
#[allow(dead_code)]
mmap: memmap::Mmap,
treadmill: Mutex<Treadmill>,
treadmill: Mutex<Treadmill>
}
impl FreeListSpace {
pub fn new(space_size: usize) -> FreeListSpace {
let anon_mmap: memmap::Mmap = match memmap::Mmap::anonymous(
space_size + SPACE_ALIGN,
memmap::Protection::ReadWrite,
memmap::Protection::ReadWrite
) {
Ok(m) => m,
Err(_) => panic!("failed to call mmap"),
Err(_) => panic!("failed to call mmap")
};
let start: Address = Address::from_ptr::<u8>(anon_mmap.ptr()).align_up(SPACE_ALIGN);
let end: Address = start + space_size;
......@@ -70,7 +70,7 @@ impl FreeListSpace {
alloc_map: Arc::new(alloc_map),
trace_map: Arc::new(trace_map),
mmap: anon_mmap,
treadmill: Mutex::new(treadmill),
treadmill: Mutex::new(treadmill)
}
}
......@@ -116,7 +116,7 @@ impl FreeListSpace {
self.trace_map(),
self.start,
unsafe { addr.to_object_reference() },
mark_state,
mark_state
)
}
......@@ -263,7 +263,7 @@ struct Treadmill {
from_space_next: usize, // next available node in from_space
from: usize,
to: usize,
spaces: [Vec<TreadmillNode>; 2],
spaces: [Vec<TreadmillNode>; 2]
}
impl Treadmill {
......@@ -289,7 +289,7 @@ impl Treadmill {
from_space_next: 0,
from: 0,
to: 1,
spaces: [from_space, to_space],