Commit 9883ddf1 authored by qinsoon's avatar qinsoon

reformat subcrates with new rustfmt.toml

parent af9e8261
This diff is collapsed.
This diff is collapsed.
...@@ -36,7 +36,7 @@ pub enum BinOp { ...@@ -36,7 +36,7 @@ pub enum BinOp {
FSub, FSub,
FMul, FMul,
FDiv, FDiv,
FRem, FRem
} }
#[derive(Copy, Clone, Debug, PartialEq)] #[derive(Copy, Clone, Debug, PartialEq)]
...@@ -69,7 +69,7 @@ pub enum CmpOp { ...@@ -69,7 +69,7 @@ pub enum CmpOp {
FULT, FULT,
FULE, FULE,
FUNE, FUNE,
FUNO, FUNO
} }
impl CmpOp { impl CmpOp {
...@@ -97,7 +97,7 @@ impl CmpOp { ...@@ -97,7 +97,7 @@ impl CmpOp {
FUGT => FULT, FUGT => FULT,
FULT => FUGT, FULT => FUGT,
_ => self, // all other comparisons are symmetric _ => self // all other comparisons are symmetric
} }
} }
...@@ -142,7 +142,7 @@ impl CmpOp { ...@@ -142,7 +142,7 @@ impl CmpOp {
FONE => FUEQ, FONE => FUEQ,
FFALSE => FTRUE, FFALSE => FTRUE,
FTRUE => FFALSE, FTRUE => FFALSE
} }
} }
...@@ -154,7 +154,7 @@ impl CmpOp { ...@@ -154,7 +154,7 @@ impl CmpOp {
SLT => ULT, SLT => ULT,
SGT => UGT, SGT => UGT,
SLE => ULE, SLE => ULE,
_ => self, _ => self
} }
} }
...@@ -162,7 +162,7 @@ impl CmpOp { ...@@ -162,7 +162,7 @@ impl CmpOp {
use op::CmpOp::*; use op::CmpOp::*;
match self { match self {
SGE | SLT | SGT | SLE => true, SGE | SLT | SGT | SLE => true,
_ => false, _ => false
} }
} }
...@@ -170,7 +170,7 @@ impl CmpOp { ...@@ -170,7 +170,7 @@ impl CmpOp {
use op::CmpOp::*; use op::CmpOp::*;
match self { match self {
EQ | NE | SGE | SGT | SLE | SLT | UGE | UGT | ULE | ULT => true, EQ | NE | SGE | SGT | SLE | SLT | UGE | UGT | ULE | ULT => true,
_ => false, _ => false
} }
} }
...@@ -178,7 +178,7 @@ impl CmpOp { ...@@ -178,7 +178,7 @@ impl CmpOp {
use op::CmpOp::*; use op::CmpOp::*;
match self { match self {
EQ | NE | FORD | FUNO | FUNE | FUEQ | FONE | FOEQ => true, EQ | NE | FORD | FUNO | FUNE | FUEQ | FONE | FOEQ => true,
_ => false, _ => false
} }
} }
} }
...@@ -196,7 +196,7 @@ pub enum ConvOp { ...@@ -196,7 +196,7 @@ pub enum ConvOp {
SITOFP, SITOFP,
BITCAST, BITCAST,
REFCAST, REFCAST,
PTRCAST, PTRCAST
} }
#[derive(Copy, Clone, Debug, PartialEq)] #[derive(Copy, Clone, Debug, PartialEq)]
...@@ -211,5 +211,5 @@ pub enum AtomicRMWOp { ...@@ -211,5 +211,5 @@ pub enum AtomicRMWOp {
MAX, MAX,
MIN, MIN,
UMAX, UMAX,
UMIN, UMIN
} }
...@@ -108,7 +108,7 @@ pub fn init_types() { ...@@ -108,7 +108,7 @@ pub fn init_types() {
#[derive(PartialEq, Debug)] #[derive(PartialEq, Debug)]
pub struct MuType { pub struct MuType {
pub hdr: MuEntityHeader, pub hdr: MuEntityHeader,
pub v: MuType_, pub v: MuType_
} }
rodal_struct!(MuType { hdr, v }); rodal_struct!(MuType { hdr, v });
...@@ -118,7 +118,7 @@ impl MuType { ...@@ -118,7 +118,7 @@ impl MuType {
pub fn new(id: MuID, v: MuType_) -> MuType { pub fn new(id: MuID, v: MuType_) -> MuType {
MuType { MuType {
hdr: MuEntityHeader::unnamed(id), hdr: MuEntityHeader::unnamed(id),
v: v, v: v
} }
} }
...@@ -126,7 +126,7 @@ impl MuType { ...@@ -126,7 +126,7 @@ impl MuType {
pub fn is_struct(&self) -> bool { pub fn is_struct(&self) -> bool {
match self.v { match self.v {
MuType_::Struct(_) => true, MuType_::Struct(_) => true,
_ => false, _ => false
} }
} }
...@@ -134,7 +134,7 @@ impl MuType { ...@@ -134,7 +134,7 @@ impl MuType {
pub fn is_hybrid(&self) -> bool { pub fn is_hybrid(&self) -> bool {
match self.v { match self.v {
MuType_::Hybrid(_) => true, MuType_::Hybrid(_) => true,
_ => false, _ => false
} }
} }
...@@ -142,7 +142,7 @@ impl MuType { ...@@ -142,7 +142,7 @@ impl MuType {
pub fn is_fp(&self) -> bool { pub fn is_fp(&self) -> bool {
match self.v { match self.v {
MuType_::Float | MuType_::Double => true, MuType_::Float | MuType_::Double => true,
_ => false, _ => false
} }
} }
...@@ -150,7 +150,7 @@ impl MuType { ...@@ -150,7 +150,7 @@ impl MuType {
pub fn is_float(&self) -> bool { pub fn is_float(&self) -> bool {
match self.v { match self.v {
MuType_::Float => true, MuType_::Float => true,
_ => false, _ => false
} }
} }
...@@ -158,7 +158,7 @@ impl MuType { ...@@ -158,7 +158,7 @@ impl MuType {
pub fn is_double(&self) -> bool { pub fn is_double(&self) -> bool {
match self.v { match self.v {
MuType_::Double => true, MuType_::Double => true,
_ => false, _ => false
} }
} }
...@@ -177,7 +177,7 @@ impl MuType { ...@@ -177,7 +177,7 @@ impl MuType {
MuType_::StackRef | MuType_::StackRef |
MuType_::Tagref64 | MuType_::Tagref64 |
MuType_::UPtr(_) => true, MuType_::UPtr(_) => true,
_ => false, _ => false
} }
} }
...@@ -186,7 +186,7 @@ impl MuType { ...@@ -186,7 +186,7 @@ impl MuType {
pub fn get_struct_hybrid_tag(&self) -> Option<MuName> { pub fn get_struct_hybrid_tag(&self) -> Option<MuName> {
match self.v { match self.v {
MuType_::Hybrid(ref name) | MuType_::Struct(ref name) => Some(name.clone()), MuType_::Hybrid(ref name) | MuType_::Struct(ref name) => Some(name.clone()),
_ => None, _ => None
} }
} }
...@@ -195,7 +195,7 @@ impl MuType { ...@@ -195,7 +195,7 @@ impl MuType {
pub fn is_ref(&self) -> bool { pub fn is_ref(&self) -> bool {
match self.v { match self.v {
MuType_::Ref(_) => true, MuType_::Ref(_) => true,
_ => false, _ => false
} }
} }
...@@ -203,7 +203,7 @@ impl MuType { ...@@ -203,7 +203,7 @@ impl MuType {
pub fn is_heap_reference(&self) -> bool { pub fn is_heap_reference(&self) -> bool {
match self.v { match self.v {
MuType_::Ref(_) | MuType_::IRef(_) | MuType_::WeakRef(_) => true, MuType_::Ref(_) | MuType_::IRef(_) | MuType_::WeakRef(_) => true,
_ => false, _ => false
} }
} }
...@@ -211,7 +211,7 @@ impl MuType { ...@@ -211,7 +211,7 @@ impl MuType {
pub fn is_iref(&self) -> bool { pub fn is_iref(&self) -> bool {
match self.v { match self.v {
MuType_::IRef(_) => true, MuType_::IRef(_) => true,
_ => false, _ => false
} }
} }
...@@ -219,7 +219,7 @@ impl MuType { ...@@ -219,7 +219,7 @@ impl MuType {
pub fn is_ptr(&self) -> bool { pub fn is_ptr(&self) -> bool {
match self.v { match self.v {
MuType_::UPtr(_) | MuType_::UFuncPtr(_) => true, MuType_::UPtr(_) | MuType_::UFuncPtr(_) => true,
_ => false, _ => false
} }
} }
...@@ -227,7 +227,7 @@ impl MuType { ...@@ -227,7 +227,7 @@ impl MuType {
pub fn is_aggregate(&self) -> bool { pub fn is_aggregate(&self) -> bool {
match self.v { match self.v {
MuType_::Struct(_) | MuType_::Hybrid(_) | MuType_::Array(_, _) => true, MuType_::Struct(_) | MuType_::Hybrid(_) | MuType_::Array(_, _) => true,
_ => false, _ => false
} }
} }
...@@ -264,7 +264,7 @@ impl MuType { ...@@ -264,7 +264,7 @@ impl MuType {
.map(|ty| ty.is_traced()) .map(|ty| ty.is_traced())
.fold(false, |ret, this| ret || this) .fold(false, |ret, this| ret || this)
} }
_ => false, _ => false
} }
} }
...@@ -305,7 +305,7 @@ impl MuType { ...@@ -305,7 +305,7 @@ impl MuType {
.map(|ty| ty.is_native_safe()) .map(|ty| ty.is_native_safe())
.fold(true, |ret, this| ret && this) .fold(true, |ret, this| ret && this)
} }
_ => false, _ => false
} }
} }
...@@ -313,7 +313,7 @@ impl MuType { ...@@ -313,7 +313,7 @@ impl MuType {
pub fn get_elem_ty(&self) -> Option<P<MuType>> { pub fn get_elem_ty(&self) -> Option<P<MuType>> {
match self.v { match self.v {
MuType_::Array(ref elem_ty, _) => Some(elem_ty.clone()), MuType_::Array(ref elem_ty, _) => Some(elem_ty.clone()),
_ => None, _ => None
} }
} }
...@@ -333,7 +333,7 @@ impl MuType { ...@@ -333,7 +333,7 @@ impl MuType {
Some(hybrid_inner.fix_tys[index].clone()) Some(hybrid_inner.fix_tys[index].clone())
} }
_ => None, _ => None
} }
} }
...@@ -346,7 +346,7 @@ impl MuType { ...@@ -346,7 +346,7 @@ impl MuType {
Some(hybrid_inner.var_ty.clone()) Some(hybrid_inner.var_ty.clone())
} }
_ => None, _ => None
} }
} }
...@@ -356,7 +356,7 @@ impl MuType { ...@@ -356,7 +356,7 @@ impl MuType {
use types::MuType_::*; use types::MuType_::*;
match self.v { match self.v {
Ref(ref ty) | IRef(ref ty) | WeakRef(ref ty) | UPtr(ref ty) => Some(ty.clone()), Ref(ref ty) | IRef(ref ty) | WeakRef(ref ty) | UPtr(ref ty) => Some(ty.clone()),
_ => None, _ => None
} }
} }
...@@ -375,7 +375,7 @@ impl MuType { ...@@ -375,7 +375,7 @@ impl MuType {
Tagref64 | Tagref64 |
FuncRef(_) | FuncRef(_) |
UFuncPtr(_) => Some(64), UFuncPtr(_) => Some(64),
_ => None, _ => None
} }
} }
} }
...@@ -430,7 +430,7 @@ pub enum MuType_ { ...@@ -430,7 +430,7 @@ pub enum MuType_ {
FuncRef(P<MuFuncSig>), FuncRef(P<MuFuncSig>),
/// ufuncptr<@sig> /// ufuncptr<@sig>
UFuncPtr(P<MuFuncSig>), UFuncPtr(P<MuFuncSig>)
} }
rodal_enum!(MuType_{(Int: size), Float, Double, (Ref: ty), (IRef: ty), (WeakRef: ty), (UPtr: ty), rodal_enum!(MuType_{(Int: size), Float, Double, (Ref: ty), (IRef: ty), (WeakRef: ty), (UPtr: ty),
...@@ -462,7 +462,7 @@ impl fmt::Display for MuType_ { ...@@ -462,7 +462,7 @@ impl fmt::Display for MuType_ {
&MuType_::FuncRef(ref sig) => write!(f, "funcref<{}>", sig), &MuType_::FuncRef(ref sig) => write!(f, "funcref<{}>", sig),
&MuType_::UFuncPtr(ref sig) => write!(f, "ufuncref<{}>", sig), &MuType_::UFuncPtr(ref sig) => write!(f, "ufuncref<{}>", sig),
&MuType_::Struct(ref tag) => write!(f, "{}(struct)", tag), &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! { ...@@ -479,7 +479,7 @@ lazy_static! {
rodal_struct!(StructType_{tys}); rodal_struct!(StructType_{tys});
#[derive(PartialEq, Debug)] #[derive(PartialEq, Debug)]
pub struct StructType_ { pub struct StructType_ {
tys: Vec<P<MuType>>, tys: Vec<P<MuType>>
} }
impl fmt::Display for StructType_ { impl fmt::Display for StructType_ {
...@@ -515,14 +515,14 @@ rodal_struct!(HybridType_{fix_tys, var_ty}); ...@@ -515,14 +515,14 @@ rodal_struct!(HybridType_{fix_tys, var_ty});
#[derive(PartialEq, Debug)] #[derive(PartialEq, Debug)]
pub struct HybridType_ { pub struct HybridType_ {
fix_tys: Vec<P<MuType>>, fix_tys: Vec<P<MuType>>,
var_ty: P<MuType>, var_ty: P<MuType>
} }
impl HybridType_ { impl HybridType_ {
pub fn new(fix_tys: Vec<P<MuType>>, var_ty: P<MuType>) -> HybridType_ { pub fn new(fix_tys: Vec<P<MuType>>, var_ty: P<MuType>) -> HybridType_ {
HybridType_ { HybridType_ {
fix_tys: fix_tys, fix_tys: fix_tys,
var_ty: var_ty, var_ty: var_ty
} }
} }
...@@ -626,7 +626,7 @@ impl MuType_ { ...@@ -626,7 +626,7 @@ impl MuType_ {
struct_ty_.tys.clear(); struct_ty_.tys.clear();
struct_ty_.tys.append(&mut list); 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 /// creates a Mu struct with specified field types
...@@ -658,7 +658,7 @@ impl MuType_ { ...@@ -658,7 +658,7 @@ impl MuType_ {
pub fn hybrid_empty(tag: HybridTag) -> MuType_ { pub fn hybrid_empty(tag: HybridTag) -> MuType_ {
let hybrid_ty_ = HybridType_ { let hybrid_ty_ = HybridType_ {
fix_tys: vec![], fix_tys: vec![],
var_ty: VOID_TYPE.clone(), var_ty: VOID_TYPE.clone()
}; };
HYBRID_TAG_MAP HYBRID_TAG_MAP
.write() .write()
...@@ -682,14 +682,14 @@ impl MuType_ { ...@@ -682,14 +682,14 @@ impl MuType_ {
hybrid_ty_.var_ty = var_ty; 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 /// 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_ { pub fn hybrid(tag: HybridTag, fix_tys: Vec<P<MuType>>, var_ty: P<MuType>) -> MuType_ {
let hybrid_ty_ = HybridType_ { let hybrid_ty_ = HybridType_ {
fix_tys: fix_tys, fix_tys: fix_tys,
var_ty: var_ty, var_ty: var_ty
}; };
...@@ -717,7 +717,7 @@ impl MuType_ { ...@@ -717,7 +717,7 @@ impl MuType_ {
pub struct MuFuncSig { pub struct MuFuncSig {
pub hdr: MuEntityHeader, pub hdr: MuEntityHeader,
pub ret_tys: Vec<P<MuType>>, 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}); rodal_struct!(MuFuncSig{hdr, ret_tys, arg_tys});
......
...@@ -21,7 +21,7 @@ pub struct AddressBitmap { ...@@ -21,7 +21,7 @@ pub struct AddressBitmap {
start: Address, start: Address,
end: Address, end: Address,
bitmap: Bitmap, bitmap: Bitmap
} }
impl AddressBitmap { impl AddressBitmap {
...@@ -32,7 +32,7 @@ impl AddressBitmap { ...@@ -32,7 +32,7 @@ impl AddressBitmap {
AddressBitmap { AddressBitmap {
start: start, start: start,
end: end, end: end,
bitmap: bitmap, bitmap: bitmap
} }
} }
......
...@@ -24,12 +24,12 @@ pub struct AddressMap<T: Copy> { ...@@ -24,12 +24,12 @@ pub struct AddressMap<T: Copy> {
end: Address, end: Address,
pub ptr: *mut T, pub ptr: *mut T,
len: usize, len: usize
} }
impl<T> AddressMap<T> impl<T> AddressMap<T>
where where
T: Copy, T: Copy
{ {
pub fn new(start: Address, end: Address) -> AddressMap<T> { pub fn new(start: Address, end: Address) -> AddressMap<T> {
let len = (end - start) >> LOG_POINTER_SIZE; let len = (end - start) >> LOG_POINTER_SIZE;
...@@ -39,7 +39,7 @@ where ...@@ -39,7 +39,7 @@ where
start: start, start: start,
end: end, end: end,
ptr: ptr, ptr: ptr,
len: len, len: len
} }
} }
......
...@@ -19,7 +19,7 @@ use heap::gc::malloc_zero; ...@@ -19,7 +19,7 @@ use heap::gc::malloc_zero;
#[derive(Clone)] #[derive(Clone)]
pub struct Bitmap { pub struct Bitmap {
bitmap: *mut u64, bitmap: *mut u64,
bitmap_len: usize, bitmap_len: usize
} }
impl Bitmap { impl Bitmap {
...@@ -32,7 +32,7 @@ impl Bitmap { ...@@ -32,7 +32,7 @@ impl Bitmap {
Bitmap { Bitmap {
bitmap: bitmap, bitmap: bitmap,
bitmap_len: bitmap_len, bitmap_len: bitmap_len
} }
} }
......
...@@ -39,7 +39,7 @@ pub struct GCType { ...@@ -39,7 +39,7 @@ pub struct GCType {
pub fix_refs: Option<RefPattern>, //+16 pub fix_refs: Option<RefPattern>, //+16
pub var_refs: Option<RefPattern>, //+64 pub var_refs: Option<RefPattern>, //+64
pub var_size: Option<ByteSize>, //+112 pub var_size: Option<ByteSize> //+112
} }
impl GCType { impl GCType {
...@@ -47,7 +47,7 @@ impl GCType { ...@@ -47,7 +47,7 @@ impl GCType {
id: u32, id: u32,
size: ByteSize, size: ByteSize,
alignment: ByteSize, alignment: ByteSize,
fix_refs: Option<RefPattern>, fix_refs: Option<RefPattern>
) -> GCType { ) -> GCType {
GCType { GCType {
id: id, id: id,
...@@ -57,7 +57,7 @@ impl GCType { ...@@ -57,7 +57,7 @@ impl GCType {
fix_size: size, fix_size: size,
var_refs: None, var_refs: None,
var_size: None, var_size: None
} }
} }
...@@ -67,7 +67,7 @@ impl GCType { ...@@ -67,7 +67,7 @@ impl GCType {
alignment: ByteSize, alignment: ByteSize,
fix_refs: Option<RefPattern>, fix_refs: Option<RefPattern>,
var_refs: Option<RefPattern>, var_refs: Option<RefPattern>,
var_size: ByteSize, var_size: ByteSize
) -> GCType { ) -> GCType {
GCType { GCType {
id: id, id: id,
...@@ -77,7 +77,7 @@ impl GCType { ...@@ -77,7 +77,7 @@ impl GCType {
fix_size: size, fix_size: size,
var_refs: var_refs, var_refs: var_refs,
var_size: Some(var_size), var_size: Some(var_size)
} }
} }
...@@ -90,7 +90,7 @@ impl GCType { ...@@ -90,7 +90,7 @@ impl GCType {
fix_size: size, fix_size: size,
var_refs: None, var_refs: None,
var_size: None, var_size: None
} }
} }
...@@ -101,12 +101,12 @@ impl GCType { ...@@ -101,12 +101,12 @@ impl GCType {
fix_refs: Some(RefPattern::Map { fix_refs: Some(RefPattern::Map {
offsets: vec![0], offsets: vec![0],
size: POINTER_SIZE, size: POINTER_SIZE
}), }),
fix_size: POINTER_SIZE, fix_size: POINTER_SIZE,
var_refs: None, var_refs: None,
var_size: None, var_size: None
} }
} }
...@@ -175,13 +175,13 @@ pub enum RefPattern { ...@@ -175,13 +175,13 @@ pub enum RefPattern {
// discriminat 8 bytes // discriminat 8 bytes
Map { Map {
offsets: Vec<ByteSize>, // +8 offsets: Vec<ByteSize>, // +8