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

Autoformatted code

parent b067db8c
......@@ -16,16 +16,16 @@
#![warn(unreachable_code)]
#![warn(dead_code)]
use crate::runtime::mm;
use crate::vm::VM;
use ast::inst::*;
use ast::ir::*;
use ast::op;
use ast::op::*;
use ast::ptr::*;
use ast::types::*;
use crate::runtime::mm;
use utils::POINTER_SIZE;
use utils::WORD_SIZE;
use crate::vm::VM;
use crate::compiler::backend::BackendType;
use crate::compiler::CompilerPass;
......@@ -4935,7 +4935,9 @@ impl<'a> InstructionSelection {
match ty.v {
MuType_::Vector(_, _) => unimplemented!(),
MuType_::Void => panic!("Unexpected void"),
MuType_::Struct(_) | MuType_::Array(_, _) => unimplemented!(),
MuType_::Struct(_) | MuType_::Array(_, _) => {
unimplemented!()
}
// Integral, pointer of floating point type
_ => self.extract_bytes(
......
......@@ -40,12 +40,12 @@ use utils::Address;
#[cfg(feature = "aot")]
pub use crate::compiler::backend::aarch64::asm_backend::spill_rewrite;
use crate::compiler::backend::RegGroup;
use crate::vm::VM;
use ast::ir::*;
use ast::op;
use ast::ptr::P;
use ast::types::*;
use crate::compiler::backend::RegGroup;
use crate::vm::VM;
use std::collections::HashMap;
use utils::math::align_up;
......
......@@ -23,10 +23,10 @@ use crate::compiler::backend::{Mem, Reg};
use crate::compiler::machine_code::MachineCode;
use crate::runtime::mm::*;
use crate::runtime::ValueLocation;
use crate::vm::VM;
use utils::Address;
use utils::ByteSize;
use utils::POINTER_SIZE;
use crate::vm::VM;
use utils::string_utils;
use utils::vec_utils;
......
use ast::ir::*;
use ast::ptr::*;
use ast::types::*;
use crate::compiler::backend::x86_64;
use crate::compiler::backend::BackendType;
use crate::compiler::backend::RegGroup;
use utils::ByteSize;
use crate::vm::VM;
use ast::ir::*;
use ast::ptr::*;
use ast::types::*;
use utils::ByteSize;
#[derive(Clone, Debug)]
pub enum CallConvResult {
......
......@@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::runtime::ValueLocation;
use ast::ir::*;
use ast::ptr::P;
use crate::runtime::ValueLocation;
use crate::compiler::backend::{Mem, Reg};
use crate::compiler::machine_code::MachineCode;
......
......@@ -12,18 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use ast::inst::*;
use ast::ir::*;
use ast::op;
use ast::op::*;
use ast::ptr::*;
use ast::types::*;
use crate::runtime::entrypoints;
use crate::runtime::entrypoints::RuntimeEntrypoint;
use crate::runtime::mm;
use crate::runtime::thread;
use crate::runtime::ValueLocation;
use crate::vm::VM;
use ast::inst::*;
use ast::ir::*;
use ast::op;
use ast::op::*;
use ast::ptr::*;
use ast::types::*;
use crate::compiler::backend::x86_64;
use crate::compiler::backend::x86_64::callconv;
......
......@@ -40,14 +40,14 @@ pub use crate::compiler::backend::x86_64::asm_backend::emit_context_with_reloc;
#[cfg(feature = "aot")]
pub use crate::compiler::backend::x86_64::asm_backend::spill_rewrite;
use crate::compiler::backend::RegGroup;
use crate::vm::VM;
use ast::ir::*;
use ast::ptr::P;
use ast::types::*;
use crate::compiler::backend::RegGroup;
use std::sync::Arc;
use utils::Address;
use utils::ByteSize;
use crate::vm::VM;
use std::collections::HashMap;
use utils::LinkedHashMap;
......
......@@ -14,17 +14,17 @@
#![allow(dead_code)]
use ast::ir::*;
use crate::compiler::backend::emit_code;
use crate::compiler::CompilerPass;
use std::any::Any;
use crate::vm::VM;
use ast::ir::*;
use std::any::Any;
pub use crate::vm::uir_output::create_emit_directory;
use std::collections::HashMap;
use std::fs::File;
use std::io::prelude::*;
use std::path;
pub use crate::vm::uir_output::create_emit_directory;
/// should emit machien code dot graph?
pub const EMIT_MC_DOT: bool = true;
......
......@@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use ast::ir::*;
use crate::compiler::machine_code::*;
use crate::compiler::CompilerPass;
use crate::vm::VM;
use ast::ir::*;
use utils::LinkedHashMap;
use utils::LinkedHashSet;
use utils::LinkedMultiMap;
use utils::LinkedRepeatableMultiMap;
use utils::Tree;
use crate::vm::VM;
use std::any::Any;
......
......@@ -23,8 +23,8 @@ pub mod peephole_opt;
/// A register allocation pass. Graph coloring.
pub mod reg_alloc;
use num::integer::lcm;
use crate::runtime::mm::*;
use num::integer::lcm;
use std;
use utils::math::align_up;
use utils::*;
......@@ -195,10 +195,10 @@ pub use compiler::backend::aarch64::ARGUMENT_GPRS;
#[cfg(target_arch = "aarch64")]
pub use compiler::backend::aarch64::CALLEE_SAVED_COUNT;
use crate::vm::VM;
use ast::ir::*;
use ast::ptr::*;
use ast::types::*;
use crate::vm::VM;
/// BackendType describes storage type info for a MuType, including
/// size, alignment, struct layout, array element padded size, GC type.
......
......@@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use ast::ir::*;
use crate::compiler::backend;
use crate::compiler::machine_code::CompiledFunction;
use crate::compiler::CompilerPass;
use crate::vm::VM;
use ast::ir::*;
use std::any::Any;
......
......@@ -14,16 +14,16 @@
extern crate hprof;
use ast::ir::*;
use ast::ptr::*;
use crate::compiler::backend;
use crate::compiler::backend::reg_alloc::graph_coloring;
use crate::compiler::backend::reg_alloc::graph_coloring::liveness::InterferenceGraph;
use crate::compiler::backend::reg_alloc::graph_coloring::liveness::Move;
use crate::compiler::machine_code::CompiledFunction;
use crate::vm::VM;
use ast::ir::*;
use ast::ptr::*;
use utils::LinkedHashMap;
use utils::LinkedHashSet;
use crate::vm::VM;
/// allows coalescing
const COALESCING: bool = true;
......
......@@ -14,9 +14,9 @@
extern crate hprof;
use ast::ir::*;
use crate::compiler::backend;
use crate::compiler::machine_code::CompiledFunction;
use ast::ir::*;
use std::fmt;
use utils::LinkedHashMap;
use utils::LinkedHashSet;
......
......@@ -20,13 +20,13 @@ mod liveness;
use crate::compiler::backend::reg_alloc::graph_coloring::coloring::GraphColoring;
use crate::compiler::backend::reg_alloc::graph_coloring::liveness::build_interference_graph_chaitin_briggs as build_inteference_graph;
use ast::ir::*;
use crate::compiler::backend::init_machine_regs_for_func;
use crate::compiler::backend::is_callee_saved;
use crate::compiler::backend::reg_alloc::validate;
use crate::compiler::CompilerPass;
use std::any::Any;
use crate::vm::VM;
use ast::ir::*;
use std::any::Any;
pub struct RegisterAllocation {
name: &'static str
......
......@@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use ast::ir::*;
use crate::compiler::machine_code::CompiledFunction;
use ast::ir::*;
use utils::LinkedHashMap;
use utils::LinkedHashSet;
......
......@@ -19,11 +19,11 @@
#![allow(dead_code)]
use ast::ir::*;
use ast::ptr::*;
use crate::compiler::backend::get_color_for_precolored as alias;
use crate::compiler::machine_code::CompiledFunction;
use crate::compiler::PROLOGUE_BLOCK_NAME;
use ast::ir::*;
use ast::ptr::*;
use utils::LinkedHashMap;
mod alive_entry;
......
......@@ -12,16 +12,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::compiler::backend::get_callee_saved_offset;
use ast::ir::*;
use ast::ptr::*;
use ast::types::*;
use crate::compiler::backend::get_callee_saved_offset;
use utils::ByteOffset;
use crate::vm::VM;
use std;
use std::collections::HashMap;
use std::fmt;
use crate::vm::VM;
/// Frame serves two purposes:
/// * it manages stack allocation that are known statically (such as callee
......
......@@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use ast::ir::*;
use ast::ptr::*;
use crate::compiler;
use crate::compiler::backend::mc_loopanalysis::MCLoopAnalysisResult;
use crate::compiler::frame::*;
use rodal;
use crate::runtime::resolve_symbol;
use crate::runtime::ValueLocation;
use ast::ir::*;
use ast::ptr::*;
use rodal;
use std;
use std::collections::HashMap;
use std::collections::HashSet;
......
......@@ -14,9 +14,9 @@
extern crate hprof;
use crate::vm::VM;
use ast::ir::*;
use std::cell::RefCell;
use crate::vm::VM;
/// compiler backends, include target description, and target dependent passes
pub mod backend;
......
......@@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::compiler::CompilerPass;
use crate::vm::VM;
use ast::inst::Instruction_::*;
use ast::ir::*;
use crate::compiler::CompilerPass;
use std::any::Any;
use utils::vec_utils::as_str as vector_as_str;
use utils::LinkedHashMap;
use utils::LinkedHashSet;
use crate::vm::VM;
pub struct ControlFlowAnalysis {
name: &'static str
......
......@@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::compiler::CompilerPass;
use crate::vm::VM;
use ast::ir::*;
use ast::ptr::*;
use crate::compiler::CompilerPass;
use std::any::Any;
use crate::vm::VM;
pub struct DefUse {
name: &'static str
......
......@@ -14,15 +14,15 @@
#![allow(dead_code)]
use ast::ir::*;
use crate::compiler::CompilerPass;
use std::any::Any;
use crate::vm::VM;
use ast::ir::*;
use std::any::Any;
use crate::vm::uir_output::{create_emit_directory, EMIT_MUIR};
use std::fs::File;
use std::io::prelude::*;
use std::path;
use crate::vm::uir_output::{create_emit_directory, EMIT_MUIR};
fn create_emit_file(name: String, vm: &VM) -> File {
let mut file_path = path::PathBuf::new();
......
......@@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::vm::VM;
use ast::inst::*;
use ast::ir::*;
use ast::ptr::*;
use crate::vm::VM;
use crate::compiler::CompilerPass;
use std::any::Any;
......@@ -241,8 +241,12 @@ impl CompilerPass for GenMovPhi {
trace!("rewrite to {}", new_inst);
new_body.push(new_inst);
}
Instruction_::Watchpoint { .. } => unimplemented!(),
Instruction_::WPBranch { .. } => unimplemented!(),
Instruction_::Watchpoint { .. } => {
unimplemented!()
}
Instruction_::WPBranch { .. } => {
unimplemented!()
}
Instruction_::SwapStackExc {
stack,
is_exception,
......@@ -284,7 +288,9 @@ impl CompilerPass for GenMovPhi {
trace!("rewrite to {}", new_inst);
new_body.push(new_inst);
}
Instruction_::ExnInstruction { .. } => unimplemented!(),
Instruction_::ExnInstruction { .. } => {
unimplemented!()
}
_ => {
trace!("no rewrite");
new_body.push(node.clone())
......
......@@ -12,20 +12,20 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use ast::inst::*;
use ast::ir::*;
use ast::op::*;
use ast::ptr::*;
use ast::types::*;
use crate::compiler::CompilerPass;
use crate::runtime::entrypoints;
use crate::runtime::mm;
use crate::runtime::mm::*;
use crate::runtime::thread;
use crate::vm::VM;
use ast::inst::*;
use ast::ir::*;
use ast::op::*;
use ast::ptr::*;
use ast::types::*;
use std::any::Any;
use utils::math;
use utils::*;
use crate::vm::VM;
pub struct InjectRuntime {
name: &'static str
......
......@@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::vm::VM;
use ast::inst::*;
use ast::ir::*;
use ast::ptr::*;
use crate::vm::VM;
use crate::compiler::CompilerPass;
use std::any::Any;
......@@ -710,7 +710,9 @@ fn copy_inline_blocks(
}
&Instruction_::Watchpoint { .. }
| &Instruction_::WPBranch { .. }
| &Instruction_::ExnInstruction { .. } => unimplemented!(),
| &Instruction_::ExnInstruction { .. } => {
unimplemented!()
}
_ => {
block_content.body.push(last_inst_clone);
......
......@@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::vm::VM;
use ast::ir::*;
use ast::ptr::*;
use std::any::Any;
use crate::vm::VM;
/// An inlining pass. Based on a certain criteria, the compiler chooses certain
/// functions to be inlined in their callsite by rewriting the call into a
......
......@@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::compiler::CompilerPass;
use crate::compiler::EPILOGUE_BLOCK_NAME;
use crate::vm::VM;
use ast::inst::*;
use ast::ir::*;
use ast::ptr::*;
use crate::compiler::CompilerPass;
use crate::compiler::EPILOGUE_BLOCK_NAME;
use std::any::Any;
use crate::vm::VM;
/// Mu IR the client gives us may contain several RET instructions. However,
/// internally we want a single exit point for a function. In this pass, we
......
......@@ -12,15 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::compiler::CompilerPass;
use crate::vm::VM;
use ast::inst::*;
use ast::ir::*;
use ast::op::CmpOp;
use ast::ptr::*;
use ast::types::*;
use crate::compiler::CompilerPass;
use std::any::Any;
use utils::LinkedHashSet;
use crate::vm::VM;
pub struct TraceGen {
name: &'static str
......
......@@ -14,15 +14,15 @@
#![allow(dead_code)]
use ast::ir::*;
use crate::compiler::CompilerPass;
use std::any::Any;
use crate::vm::VM;
use ast::ir::*;
use std::any::Any;
use crate::vm::uir_output::create_emit_directory;
use std::fs::File;
use std::io::prelude::*;
use std::path;
use crate::vm::uir_output::create_emit_directory;
pub const EMIT_MUIR: bool = true;
fn create_emit_file(name: String, vm: &VM) -> File {
......
......@@ -14,9 +14,9 @@
use crate::heap::*;
use crate::objectmodel::*;
use crate::MY_GC;
use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicUsize, Ordering};
use std::sync::{Arc, Condvar, Mutex, RwLock};
use crate::MY_GC;
use crossbeam::sync::chase_lev::*;
use std::mem::transmute;
......
......@@ -14,11 +14,11 @@
//extern crate time;
use ast::ir::MuName;
use crate::compiler::backend;
use crate::linkutils::*;
use crate::runtime;
use crate::vm::VM;
use ast::ir::MuName;
use std::path::PathBuf;
use std::process::Command;
......
......@@ -17,8 +17,8 @@
extern crate libloading as ll;
use ast::ir::*;
use crate::compiler::*;
use ast::ir::*;
// use std::sync::Arc;
use std::os::unix::process::ExitStatusExt;
......
......@@ -14,11 +14,11 @@
use crate::runtime::ValueLocation;
use crate::compiler::backend::RegGroup;
use ast::ir;
use ast::ir::*;
use ast::ptr::*;
use ast::types::*;
use crate::compiler::backend::RegGroup;
use std::sync::{Arc, RwLock};
pub type EntryFuncSig = MuFuncSig;
......
......@@ -14,8 +14,8 @@
use crate::compiler::backend::*;
use crate::compiler::machine_code::CompiledCallsite;
use log;
use crate::runtime::*;
use log;
use std::collections::HashMap;
use std::ops::Deref;
use utils::Address;
......
......@@ -29,10 +29,10 @@ pub extern "C" fn muentry_frem64(a: f64, b: f64) -> f64 {
}
extern crate num_traits;
use extprim::i128::i128;
use extprim::u128::u128;
use crate::runtime::math::num_traits::FromPrimitive;
use crate::runtime::math::num_traits::ToPrimitive;
use extprim::i128::i128;
use extprim::u128::u128;
/// unsigned division for int128
#[no_mangle]
......
......@@ -14,18 +14,18 @@
// expose the mu interface (GC)
use ast::ir::*;
use ast::ptr::*;
use ast::types::*;
use crate::compiler::backend::BackendType;
use crate::compiler::backend::RegGroup;
use crate::runtime::thread::MuThread;
use crate::runtime::ValueLocation;
use crate::vm::VM;
use ast::ir::*;
use ast::ptr::*;
use ast::types::*;
use utils::math;
use utils::ByteSize;
use utils::ObjectReference;
use utils::*;
use crate::vm::VM;
mod mm_mu;
pub use self::mm_mu::*;
......
......@@ -12,12 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use ast::ir::*;
use crate::compiler::backend::RegGroup;
use crate::vm::VM;
use ast::ir::*;
use utils;
use utils::Address;
use utils::Word;
use crate::vm::VM;
use libc::*;
use rodal;
......
......@@ -12,18 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use ast::ir::*;
use ast::ptr::*;
use ast::types::*;
use crate::compiler::backend::BackendType;
use crate::compiler::backend::RegGroup;
use crate::runtime::thread::MuThread;
use crate::runtime::ValueLocation;
use crate::vm::VM;
use ast::ir::*;
use ast::ptr::*;
use ast::types::*;
use utils::math;
use utils::ByteSize;
use utils::ObjectReference;
use utils::*;
use crate::vm::VM;
mod clock_posix;
mod clock_std;
......
......@@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use ast::ptr::*;
use ast::types::*;
use crate::runtime::mm;
use crate::runtime::ValueLocation;
use crate::vm::VM;
use ast::ptr::*;
use ast::types::*;
use utils::mem::memmap;
use utils::mem::memsec;
......@@ -392,7 +392,6 @@ extern "C" {
old_sp_loc: Address
);
pub fn muentry_thread_exit(old_sp: Address);
pub fn muentry_safecall_kill_stack(cur_stackref: Address);
pub fn muentry_throw_exception(obj: Address);
......@@ -430,7 +429,7 @@ extern "C" {
/// compiler emits calls to this for SetRetval instruction (internal use
/// only)
pub fn muentry_set_retval(val: u32);
pub fn alloc_mem(size: usize) -> *const c_char;
//pub fn resolve_symbol(sym: *const c_char) -> *const c_void;
pub fn call_mu_function(func_addr: i64, arg_addr: i64);
......