WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit ac147763 authored by qinsoon's avatar qinsoon
Browse files

[wip] removed 'slowpath'. No need for that.

parent 81ccdf53
......@@ -13,7 +13,6 @@ use runtime::entrypoints;
use runtime::entrypoints::RuntimeEntrypoint;
use compiler::CompilerPass;
use compiler::PassExecutionResult;
use compiler::backend;
use compiler::backend::x86_64;
use compiler::backend::x86_64::CodeGenerator;
......@@ -26,7 +25,6 @@ use std::collections::HashMap;
pub struct InstructionSelection {
name: &'static str,
backend: Box<CodeGenerator>,
is_fastpath: bool,
current_callsite_id: usize,
current_frame: Option<Frame>,
......@@ -39,11 +37,10 @@ pub struct InstructionSelection {
}
impl <'a> InstructionSelection {
pub fn new(is_fastpath: bool) -> InstructionSelection {
pub fn new() -> InstructionSelection {
InstructionSelection{
name: "Instruction Selection (x64)",
backend: Box::new(ASMCodeGen::new()),
is_fastpath: is_fastpath,
current_callsite_id: 0,
current_frame: None,
......@@ -1283,22 +1280,6 @@ impl CompilerPass for InstructionSelection {
self.name
}
fn execute(&mut self, vm: &VM, func: &mut MuFunctionVersion) -> PassExecutionResult {
debug!("---CompilerPass {} for {}---", self.name(), func);
if !self.is_fastpath {
unimplemented!()
}
self.start_function(vm, func);
self.visit_function(vm, func);
self.finish_function(vm, func);
debug!("---finish---");
PassExecutionResult::ProceedToNext
}
#[allow(unused_variables)]
fn start_function(&mut self, vm: &VM, func_ver: &mut MuFunctionVersion) {
debug!("{}", self.name());
......
......@@ -563,7 +563,7 @@ impl GraphColoring {
trace!("Color {} as {}", self.node_info(n), first_available_color);
if !backend::is_callee_saved(first_available_color) {
return Err(RegAllocFailure::FailedForUsingCallerSaved);
warn!("Use caller saved register {}", first_available_color);
}
self.colored_nodes.push(n);
......
......@@ -12,19 +12,16 @@ mod graph_coloring;
pub enum RegAllocFailure {
FailedForSpilling,
FailedForUsingCallerSaved
}
pub struct RegisterAllocation {
name: &'static str,
is_fastpath: bool
}
impl RegisterAllocation {
pub fn new(is_fastpath: bool) -> RegisterAllocation {
pub fn new() -> RegisterAllocation {
RegisterAllocation {
name: "Register Allcoation",
is_fastpath: is_fastpath
}
}
......@@ -52,7 +49,9 @@ impl RegisterAllocation {
let spills = coloring.spills();
if !spills.is_empty() {
return Err(RegAllocFailure::FailedForSpilling);
unimplemented!();
// return Err(RegAllocFailure::FailedForSpilling);
}
// replace regs
......@@ -87,20 +86,13 @@ impl CompilerPass for RegisterAllocation {
fn execute(&mut self, vm: &VM, func: &mut MuFunctionVersion) -> PassExecutionResult {
debug!("---CompilerPass {} for {}---", self.name(), func);
if !self.is_fastpath {
unimplemented!()
}
match self.coloring(vm, func) {
// skip slow path
Ok(_) => PassExecutionResult::ProceedTo(compiler::PASS_PEEPHOLE),
// go back to instruction selection for spilled operands
Err(RegAllocFailure::FailedForSpilling) => PassExecutionResult::GoBackTo(compiler::PASS_FAST_INST_SEL),
// proceed to slow path
Err(RegAllocFailure::FailedForUsingCallerSaved) => PassExecutionResult::ProceedToNext
Err(RegAllocFailure::FailedForSpilling) => PassExecutionResult::GoBackTo(compiler::PASS_INST_SEL),
}
}
}
......@@ -18,10 +18,8 @@ pub use compiler::passes::PASS_DEF_USE;
pub use compiler::passes::PASS_TREE_GEN;
pub use compiler::passes::PASS_CFA;
pub use compiler::passes::PASS_TRACE_GEN;
pub use compiler::passes::PASS_FAST_INST_SEL;
pub use compiler::passes::PASS_FAST_REG_ALLOC;
pub use compiler::passes::PASS_SLOW_INST_SEL;
pub use compiler::passes::PASS_SLOW_REG_ALLOC;
pub use compiler::passes::PASS_INST_SEL;
pub use compiler::passes::PASS_REG_ALLOC;
pub use compiler::passes::PASS_PEEPHOLE;
pub use compiler::passes::PASS_CODE_EMIT;
......@@ -86,12 +84,9 @@ impl Default for CompilerPolicy {
passes.push(Box::new(passes::ControlFlowAnalysis::new()));
passes.push(Box::new(passes::TraceGen::new()));
// fast path compilation - use callee saved registers only
passes.push(Box::new(backend::inst_sel::InstructionSelection::new(true)));
passes.push(Box::new(backend::reg_alloc::RegisterAllocation::new(true)));
// slow path compilation - use all registers
passes.push(Box::new(backend::inst_sel::InstructionSelection::new(false)));
passes.push(Box::new(backend::reg_alloc::RegisterAllocation::new(false)));
// compilation
passes.push(Box::new(backend::inst_sel::InstructionSelection::new()));
passes.push(Box::new(backend::reg_alloc::RegisterAllocation::new()));
// machine code level passes
passes.push(Box::new(backend::peephole_opt::PeepholeOptimization::new()));
......
......@@ -15,17 +15,16 @@ pub use compiler::passes::tree_gen::TreeGen;
pub use compiler::passes::control_flow::ControlFlowAnalysis;
pub use compiler::passes::trace_gen::TraceGen;
// make sure the pass IDs are sequential
pub const PASS_IR_CHECK : PassID = PassID(0);
pub const PASS_DEF_USE : PassID = PassID(1);
pub const PASS_TREE_GEN : PassID = PassID(2);
pub const PASS_CFA : PassID = PassID(3);
pub const PASS_TRACE_GEN : PassID = PassID(4);
pub const PASS_FAST_INST_SEL : PassID = PassID(5);
pub const PASS_FAST_REG_ALLOC : PassID = PassID(6);
pub const PASS_SLOW_INST_SEL : PassID = PassID(7);
pub const PASS_SLOW_REG_ALLOC : PassID = PassID(8);
pub const PASS_PEEPHOLE : PassID = PassID(9);
pub const PASS_CODE_EMIT : PassID = PassID(10);
pub const PASS_INST_SEL : PassID = PassID(5);
pub const PASS_REG_ALLOC : PassID = PassID(6);
pub const PASS_PEEPHOLE : PassID = PassID(7);
pub const PASS_CODE_EMIT : PassID = PassID(8);
pub enum PassExecutionResult {
ProceedToNext,
......
......@@ -18,7 +18,7 @@ fn test_instsel_fac() {
Box::new(passes::TreeGen::new()),
Box::new(passes::ControlFlowAnalysis::new()),
Box::new(passes::TraceGen::new()),
Box::new(backend::inst_sel::InstructionSelection::new(true))
Box::new(backend::inst_sel::InstructionSelection::new())
]), vm.clone());
let func_id = vm.id_of("fac");
......
......@@ -27,7 +27,7 @@ fn test_ir_liveness_fac() {
Box::new(passes::TreeGen::new()),
Box::new(passes::ControlFlowAnalysis::new()),
Box::new(passes::TraceGen::new()),
Box::new(backend::inst_sel::InstructionSelection::new(true)),
Box::new(backend::inst_sel::InstructionSelection::new()),
]), vm.clone());
let func_id = vm.id_of("fac");
......
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