Commit 6efaae9b authored by qinsoon's avatar qinsoon

[wip] introduce entrypoints (mu code into runtime)

parent 8fd15ab3
......@@ -412,7 +412,7 @@ impl <'a> InstructionSelection {
}
Instruction_::ThreadExit => {
// do nothing for now
// emit a call to swap_back_to_native_stack(sp_loc: Address)
}
_ => unimplemented!()
......
use runtime;
use runtime::ValueLocation;
use ast::ir;
use ast::ir::*;
use ast::ptr::*;
use ast::types::MuFuncSig;
use compiler::backend::RegGroup;
use std::sync::RwLock;
pub type EntryFuncSig = MuFuncSig;
pub struct RuntimeEntrypoint {
sig: P<MuFuncSig>,
aot: ValueLocation,
jit: RwLock<Option<ValueLocation>>
}
lazy_static! {
pub static ref SWAP_BACK_TO_NATIVE_STACK : RuntimeEntrypoint = RuntimeEntrypoint {
sig: P(MuFuncSig{
hdr: MuEntityHeader::unnamed(ir::new_internal_id()),
ret_tys: vec![],
arg_tys: vec![runtime::ADDRESS_TYPE.clone()]
}),
aot: ValueLocation::Relocatable(RegGroup::GPR, String::from("swap_back_to_native_stack")),
jit: RwLock::new(None),
};
}
\ No newline at end of file
pub mod mm;
pub mod thread;
pub mod entrypoints;
pub use runtime::mm::common::Address;
pub use runtime::mm::common::ObjectReference;
use utils;
use ast::ir;
use ast::ptr::*;
use ast::types::MuType_;
use ast::types::MuType;
use ast::ir::*;
use compiler::backend::Word;
use compiler::backend::RegGroup;
......@@ -13,6 +18,12 @@ use std::os::raw::c_char;
use std::os::raw::c_void;
use std::ffi::CString;
lazy_static! {
pub static ref ADDRESS_TYPE : P<MuType> = P(
MuType::new(ir::new_internal_id(), MuType_::int(64))
);
}
#[link(name="dl")]
extern "C" {
fn dlopen(filename: *const c_char, flags: isize) -> *const c_void;
......
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