Commit 11c31310 authored by qinsoon's avatar qinsoon

deleted some unused files

parent 8402546a
use vm::VM;
use ast::bundle::*;
use std::mem;
use std::collections::HashMap;
use std::sync::Arc;
use std::ffi::CStr;
use std::os::raw::c_int;
use std::os::raw::c_char;
use ast::ir::MuID;
pub type APIMuName = *const c_char;
macro_rules! unimplemented_api {
() => {
// cast fn to usize before transmute, see: https://github.com/rust-lang/rust/issues/19925
unsafe {mem::transmute(unimplemented_api as usize)}
}
}
macro_rules! api {
($func: expr) => {
mem::transmute($func as usize)
}
}
pub fn unimplemented_api() {
unimplemented!()
}
#[repr(C)]
pub struct MuVM {
// void* header
internal: Arc<VM>,
pub new_context: fn (mvm: *mut MuVM) -> *mut MuCtx,
id_of: fn (mvm: *const MuVM, name: APIMuName) -> MuID,
name_of : fn (mvm: *const MuVM, id: MuID) -> APIMuName,
// unimplemented api
set_trap_handler: fn () -> ()
}
impl MuVM {
pub fn new() -> *mut MuVM {
let vm = Box::new(MuVM {
internal: Arc::new(VM::new()),
new_context: unsafe{api!(MuVM::new_context)},
id_of: unsafe{api!(MuVM::id_of)},
name_of: unsafe{api!(MuVM::name_of)},
set_trap_handler: unimplemented_api!()
});
Box::into_raw(vm)
}
pub fn new_context(&mut self) -> *mut MuCtx {
unimplemented!()
}
pub fn id_of(&self, name: APIMuName) -> MuID {
let name = unsafe {CStr::from_ptr(name)}.to_str().unwrap();
self.internal.id_of(name)
}
pub fn name_of(&self, id: MuID) -> APIMuName {
self.internal.name_of(id).as_ptr() as *const c_char
}
}
#[repr(C)]
pub struct MuCtx {
// void* header
internal: Arc<VM>,
// GENERATE_BEGIN: MuCtx
// GENERATE_END: MuCtx
}
This diff is collapsed.
......@@ -12,18 +12,4 @@ mod deps {
pub use ast::ir::CName;
pub use vm::handle::APIHandle;
extern crate ast;
}
use runtime::thread;
use utils::Address;
#[no_mangle]
pub fn current_thread_as_mu_thread(threadlocal: Address, api_vm: *const api_c::CMuVM) {
unsafe {
let hdr = ((*api_vm).header) as *const api_impl::MuVM;
let vm = ((*hdr).vm).clone();
thread::MuThread::current_thread_as_mu_thread(threadlocal, vm);
}
}
}
\ No newline at end of file
......@@ -1008,7 +1008,7 @@ impl <'a> VM {
// we assume client will start with a function (instead of a stack)
if has_primordial_stack {
unimplemented!()
panic!("Zebu doesnt support creating primordial thread through a stack, name a entry function instead")
} else {
// extract func id
let func_id = primordial_func.unwrap().v.as_func();
......
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