Commit fddf6d35 authored by Isaac Oscar Gariano's avatar Isaac Oscar Gariano

Updated rust formating

parent 71a74d9c
Pipeline #827 failed with stages
in 30 minutes and 35 seconds
...@@ -45,4 +45,4 @@ fn main() { ...@@ -45,4 +45,4 @@ fn main() {
fn built() { fn built() {
built::write_built_file().expect("Failed to acquire build-time information"); built::write_built_file().expect("Failed to acquire build-time information");
} }
\ No newline at end of file
...@@ -365,15 +365,9 @@ impl<'a> InstructionSelection { ...@@ -365,15 +365,9 @@ impl<'a> InstructionSelection {
} }
// jcc - for 8-bits integer // jcc - for 8-bits integer
_ => { _ => {
let blk_true = make_block_name(&node.name(), let blk_true = make_block_name(&node.name(), "select_true");
"select_true" let blk_false = make_block_name(&node.name(), "select_false");
); let blk_end = make_block_name(&node.name(), "select_end");
let blk_false = make_block_name(&node.name(),
"select_false"
);
let blk_end = make_block_name(&node.name(),
"select_end"
);
// jump to blk_true if true // jump to blk_true if true
match cmpop { match cmpop {
...@@ -436,12 +430,9 @@ impl<'a> InstructionSelection { ...@@ -436,12 +430,9 @@ impl<'a> InstructionSelection {
} else if self.match_fpreg(true_val) { } else if self.match_fpreg(true_val) {
let tmp_res = self.get_result_value(node); let tmp_res = self.get_result_value(node);
let blk_true = let blk_true = make_block_name(&node.name(), "select_true");
make_block_name(&node.name(), "select_true"); let blk_false = make_block_name(&node.name(), "select_false");
let blk_false = let blk_end = make_block_name(&node.name(), "select_end");
make_block_name(&node.name(), "select_false");
let blk_end =
make_block_name(&node.name(), "select_end");
// jump to blk_true if true // jump to blk_true if true
match cmpop { match cmpop {
...@@ -596,7 +587,8 @@ impl<'a> InstructionSelection { ...@@ -596,7 +587,8 @@ impl<'a> InstructionSelection {
} }
self.finish_block(); self.finish_block();
let block_name = make_block_name(&node.name(), let block_name = make_block_name(
&node.name(),
format!("switch_not_met_case_{}", case_op_index).as_str() format!("switch_not_met_case_{}", case_op_index).as_str()
); );
self.start_block(block_name); self.start_block(block_name);
...@@ -1089,13 +1081,16 @@ impl<'a> InstructionSelection { ...@@ -1089,13 +1081,16 @@ impl<'a> InstructionSelection {
// testq %tmp_op %tmp_op // testq %tmp_op %tmp_op
self.backend.emit_test_r_r(&tmp_op, &tmp_op); self.backend.emit_test_r_r(&tmp_op, &tmp_op);
let blk_if_signed = make_block_name(&node.name(), let blk_if_signed = make_block_name(
&node.name(),
"uitofp_float_if_signed" "uitofp_float_if_signed"
); );
let blk_if_not_signed = make_block_name(&node.name(), let blk_if_not_signed = make_block_name(
&node.name(),
"uitofp_float_if_not_signed" "uitofp_float_if_not_signed"
); );
let blk_done = make_block_name(&node.name(), let blk_done = make_block_name(
&node.name(),
"uitofp_float_done" "uitofp_float_done"
); );
...@@ -3071,8 +3066,7 @@ impl<'a> InstructionSelection { ...@@ -3071,8 +3066,7 @@ impl<'a> InstructionSelection {
// emit: >> large object alloc // emit: >> large object alloc
// emit: ALLOC_LARGE_END: // emit: ALLOC_LARGE_END:
let blk_alloc_large = make_block_name(&node.name(), "alloc_large"); let blk_alloc_large = make_block_name(&node.name(), "alloc_large");
let blk_alloc_large_end = let blk_alloc_large_end = make_block_name(&node.name(), "alloc_large_end");
make_block_name(&node.name(), "alloc_large_end");
if OBJECT_HEADER_SIZE != 0 { if OBJECT_HEADER_SIZE != 0 {
// if the header size is not zero, we need to calculate a total size to alloc // if the header size is not zero, we need to calculate a total size to alloc
...@@ -4028,8 +4022,7 @@ impl<'a> InstructionSelection { ...@@ -4028,8 +4022,7 @@ impl<'a> InstructionSelection {
// insert an intermediate block to branch to normal // insert an intermediate block to branch to normal
// the branch is inserted later (because we need to deal with postcall convention) // the branch is inserted later (because we need to deal with postcall convention)
self.finish_block(); self.finish_block();
let block_name = let block_name = make_block_name(&node.name(), "normal_cont_for_call");
make_block_name(&node.name(), "normal_cont_for_call");
self.start_block(block_name); self.start_block(block_name);
} else { } else {
self.current_callsites self.current_callsites
......
...@@ -232,44 +232,46 @@ impl BackendType { ...@@ -232,44 +232,46 @@ impl BackendType {
pub fn resolve(ty: &MuType, vm: &VM) -> BackendType { pub fn resolve(ty: &MuType, vm: &VM) -> BackendType {
match ty.v { match ty.v {
// integer // integer
MuType_::Int(size_in_bit) => match size_in_bit { MuType_::Int(size_in_bit) => {
1...8 => BackendType { match size_in_bit {
size: 1, 1...8 => BackendType {
alignment: 1, size: 1,
struct_layout: None, alignment: 1,
elem_size: None, struct_layout: None,
gc_type: mm::add_gc_type(GCType::new_noreftype(1, 1)) elem_size: None,
}, gc_type: mm::add_gc_type(GCType::new_noreftype(1, 1))
9...16 => BackendType { },
size: 2, 9...16 => BackendType {
alignment: 2, size: 2,
struct_layout: None, alignment: 2,
elem_size: None, struct_layout: None,
gc_type: mm::add_gc_type(GCType::new_noreftype(2, 2)) elem_size: None,
}, gc_type: mm::add_gc_type(GCType::new_noreftype(2, 2))
17...32 => BackendType { },
size: 4, 17...32 => BackendType {
alignment: 4, size: 4,
struct_layout: None, alignment: 4,
elem_size: None, struct_layout: None,
gc_type: mm::add_gc_type(GCType::new_noreftype(4, 4)) elem_size: None,
}, gc_type: mm::add_gc_type(GCType::new_noreftype(4, 4))
33...64 => BackendType { },
size: 8, 33...64 => BackendType {
alignment: 8, size: 8,
struct_layout: None, alignment: 8,
elem_size: None, struct_layout: None,
gc_type: mm::add_gc_type(GCType::new_noreftype(8, 8)) elem_size: None,
}, gc_type: mm::add_gc_type(GCType::new_noreftype(8, 8))
128 => BackendType { },
size: 16, 128 => BackendType {
alignment: 16, size: 16,
struct_layout: None, alignment: 16,
elem_size: None, struct_layout: None,
gc_type: mm::add_gc_type(GCType::new_noreftype(16, 16)) elem_size: None,
}, gc_type: mm::add_gc_type(GCType::new_noreftype(16, 16))
_ => unimplemented!() },
}, _ => unimplemented!()
}
}
// reference of any type // reference of any type
MuType_::Ref(_) | MuType_::IRef(_) | MuType_::WeakRef(_) => BackendType { MuType_::Ref(_) | MuType_::IRef(_) | MuType_::WeakRef(_) => BackendType {
size: 8, size: 8,
......
...@@ -466,7 +466,13 @@ fn copy_inline_blocks( ...@@ -466,7 +466,13 @@ fn copy_inline_blocks(
let ref ops = inst.ops; let ref ops = inst.ops;
let ref v = inst.v; let ref v = inst.v;
trace!("ISAAC: Inlining [{} -> {}] : {} -> {}", old_block.name(), block_name, inst_name, hdr.name()); trace!(
"ISAAC: Inlining [{} -> {}] : {} -> {}",
old_block.name(),
block_name,
inst_name,
hdr.name()
);
match v { match v {
&Instruction_::Return(ref vec) => { &Instruction_::Return(ref vec) => {
// change RET to a branch // change RET to a branch
...@@ -517,7 +523,10 @@ fn copy_inline_blocks( ...@@ -517,7 +523,10 @@ fn copy_inline_blocks(
trace!("rewrite to: {}", branch2); trace!("rewrite to: {}", branch2);
block_content.body.push(TreeNode::new_boxed_inst(branch2)); block_content.body.push(TreeNode::new_boxed_inst(branch2));
} }
&Instruction_::Call { ref data, ref resume } => { &Instruction_::Call {
ref data,
ref resume
} => {
let call = Instruction { let call = Instruction {
hdr: hdr, hdr: hdr,
value: value.clone(), value: value.clone(),
...@@ -531,7 +540,10 @@ fn copy_inline_blocks( ...@@ -531,7 +540,10 @@ fn copy_inline_blocks(
trace!("rewrite to: {}", call); trace!("rewrite to: {}", call);
block_content.body.push(TreeNode::new_boxed_inst(call)); block_content.body.push(TreeNode::new_boxed_inst(call));
} }
&Instruction_::CCall { ref data, ref resume } => { &Instruction_::CCall {
ref data,
ref resume
} => {
let call = Instruction { let call = Instruction {
hdr: hdr, hdr: hdr,
value: value.clone(), value: value.clone(),
...@@ -557,8 +569,11 @@ fn copy_inline_blocks( ...@@ -557,8 +569,11 @@ fn copy_inline_blocks(
v: Instruction_::Switch { v: Instruction_::Switch {
cond: *cond, cond: *cond,
default: fix_dest(default.clone()), default: fix_dest(default.clone()),
branches: branches.iter() branches: branches
.map(|&(ref op, ref dest)| (op.clone(), fix_dest(dest.clone()))) .iter()
.map(|&(ref op, ref dest)| {
(op.clone(), fix_dest(dest.clone()))
})
.collect() .collect()
} }
}; };
......
...@@ -177,4 +177,4 @@ use vm::built_info; ...@@ -177,4 +177,4 @@ use vm::built_info;
#[no_mangle] #[no_mangle]
pub extern "C" fn mu_get_version() -> *const c_char { pub extern "C" fn mu_get_version() -> *const c_char {
built_info::ZEBU_VERSION_C_STR.as_ptr() built_info::ZEBU_VERSION_C_STR.as_ptr()
} }
\ No newline at end of file
...@@ -31,4 +31,4 @@ lazy_static! { ...@@ -31,4 +31,4 @@ lazy_static! {
}; };
pub static ref ZEBU_VERSION_C_STR : CString = CString::new(ZEBU_VERSION_STR.clone()).unwrap(); pub static ref ZEBU_VERSION_C_STR : CString = CString::new(ZEBU_VERSION_STR.clone()).unwrap();
} }
\ No newline at end of file
...@@ -4,4 +4,4 @@ use std::ffi::CStr; ...@@ -4,4 +4,4 @@ use std::ffi::CStr;
#[test] #[test]
fn test_mu_get_version() { fn test_mu_get_version() {
println!("{:?}", unsafe { CStr::from_ptr(mu_get_version()) }); println!("{:?}", unsafe { CStr::from_ptr(mu_get_version()) });
} }
\ No newline at end of file
...@@ -29,4 +29,4 @@ mod test_mem_inst; ...@@ -29,4 +29,4 @@ mod test_mem_inst;
mod test_inline; mod test_inline;
mod test_convop; mod test_convop;
mod test_int128; mod test_int128;
mod test_misc; mod test_misc;
\ No newline at end of file
...@@ -167,4 +167,4 @@ fn bitcast_f32_to_u32() -> VM { ...@@ -167,4 +167,4 @@ fn bitcast_f32_to_u32() -> VM {
}); });
vm vm
} }
\ No newline at end of file
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