Commit 1168f297 authored by qinsoon's avatar qinsoon

[wip] get handle from global, and create handle from int

parent 55aa2fe5
Pipeline #242 failed with stage
in 24 minutes and 15 seconds
use ir::*; use ir::*;
use ptr::*; use ptr::*;
use types::*; use types::*;
use utils::Address;
use std::collections::HashMap; use std::collections::HashMap;
...@@ -35,121 +34,4 @@ impl MuBundle { ...@@ -35,121 +34,4 @@ impl MuBundle {
// name_id_map: HashMap::new() // name_id_map: HashMap::new()
} }
} }
}
#[derive(Copy, Clone, Debug)]
pub struct APIHandleKey {
pub id: MuID,
pub v: APIHandleKeyKind
}
#[derive(Copy, Clone, Debug)]
pub enum APIHandleKeyKind {
Int,
Float,
Double,
UPtr,
UFP,
// SeqValue
Struct,
Array,
Vector,
// GenRef
Ref,
IRef,
TagRef64,
FuncRef,
ThreadRef,
StackRef,
FCRef, // frame cursor ref
// GenRef->IR
Bundle,
// GenRef->IR->Child
Type,
FuncSig,
FuncVer,
BB,
Inst,
// GenRef->IR->Child->Var->Global
Const,
Global,
Func,
ExpFunc,
// GenRef->IR->Child->Var->Local
NorParam,
ExcParam,
InstRes,
}
macro_rules! handle_constructor {
($fn_name: ident, $kind: ident) => {
pub fn $fn_name(id: MuID) -> APIHandleKey {
APIHandleKey{
id: id, v: APIHandleKeyKind::$kind
}
}
}
}
handle_constructor!(handle_int, Int);
handle_constructor!(handle_float, Float);
handle_constructor!(handle_double, Double);
handle_constructor!(handle_uptr, UPtr);
handle_constructor!(handle_ufp, UFP);
handle_constructor!(handle_struct, Struct);
handle_constructor!(handle_array, Array);
handle_constructor!(handle_vector, Vector);
handle_constructor!(handle_ref, Ref);
handle_constructor!(handle_iref, IRef);
handle_constructor!(handle_tagref64, TagRef64);
handle_constructor!(handle_funcref, FuncRef);
handle_constructor!(handle_threadref, ThreadRef);
handle_constructor!(handle_stackref, StackRef);
handle_constructor!(handle_fcref, FCRef);
handle_constructor!(handle_bundle, Bundle);
handle_constructor!(handle_type, Type);
handle_constructor!(handle_funcsig, FuncSig);
handle_constructor!(handle_funcver, FuncVer);
handle_constructor!(handle_bb, BB);
handle_constructor!(handle_inst, Inst);
handle_constructor!(handle_const, Const);
handle_constructor!(handle_global, Global);
handle_constructor!(handle_func, Func);
handle_constructor!(handle_expfunc, ExpFunc);
handle_constructor!(handle_norparam, NorParam);
handle_constructor!(handle_excparam, ExcParam);
handle_constructor!(handle_instres, InstRes);
#[derive(Clone)]
pub enum APIHandleValue {
Int(u64),
Float(f32),
Double(f64),
UPtr(Address),
UFP(Address),
Struct(Vec<APIHandleValue>),
Array(Vec<APIHandleValue>),
Vector(Vec<APIHandleValue>),
Ref(Address),
IRef(Address),
TagRef64(u64),
FuncRef(MuID),
ThreadRef,
StackRef,
FCRef,
IBRef
} }
\ No newline at end of file
...@@ -488,4 +488,4 @@ impl DestArg { ...@@ -488,4 +488,4 @@ impl DestArg {
&DestArg::Freshbound(n) => format!("${}", n) &DestArg::Freshbound(n) => format!("${}", n)
} }
} }
} }
\ No newline at end of file
...@@ -42,4 +42,4 @@ pub mod inst; ...@@ -42,4 +42,4 @@ pub mod inst;
pub mod types; pub mod types;
pub mod ir_semantics; pub mod ir_semantics;
pub mod ptr; pub mod ptr;
pub mod op; pub mod op;
\ No newline at end of file
...@@ -104,4 +104,4 @@ pub fn P<T>(value: T) -> P<T> { ...@@ -104,4 +104,4 @@ pub fn P<T>(value: T) -> P<T> {
// fn encode<S: Encoder> (&self, s: &mut S) -> Result<(), S::Error> { // fn encode<S: Encoder> (&self, s: &mut S) -> Result<(), S::Error> {
// s.emit_usize(self.id()) // s.emit_usize(self.id())
// } // }
//} //}
\ No newline at end of file
...@@ -2898,4 +2898,4 @@ pub fn spill_rewrite( ...@@ -2898,4 +2898,4 @@ pub fn spill_rewrite(
cf.mc().trace_mc(); cf.mc().trace_mc();
new_nodes new_nodes
} }
\ No newline at end of file
...@@ -184,4 +184,4 @@ pub trait CodeGenerator { ...@@ -184,4 +184,4 @@ pub trait CodeGenerator {
// fp conversion // fp conversion
fn emit_cvtsi2sd_f64_r (&mut self, dest: Reg, src: Reg); fn emit_cvtsi2sd_f64_r (&mut self, dest: Reg, src: Reg);
fn emit_cvtsd2si_r_f64 (&mut self, dest: Reg, src: Reg); fn emit_cvtsd2si_r_f64 (&mut self, dest: Reg, src: Reg);
} }
\ No newline at end of file
...@@ -518,4 +518,4 @@ pub fn estimate_insts_for_ir(inst: &Instruction) -> usize { ...@@ -518,4 +518,4 @@ pub fn estimate_insts_for_ir(inst: &Instruction) -> usize {
Move(_) => 0, Move(_) => 0,
ExnInstruction{ref inner, ..} => estimate_insts_for_ir(&inner) ExnInstruction{ref inner, ..} => estimate_insts_for_ir(&inner)
} }
} }
\ No newline at end of file
...@@ -306,4 +306,4 @@ impl RegGroup { ...@@ -306,4 +306,4 @@ impl RegGroup {
_ => unimplemented!() _ => unimplemented!()
} }
} }
} }
\ No newline at end of file
pub mod graph_coloring; pub mod graph_coloring;
pub use compiler::backend::reg_alloc::graph_coloring::RegisterAllocation; pub use compiler::backend::reg_alloc::graph_coloring::RegisterAllocation;
\ No newline at end of file
...@@ -127,4 +127,4 @@ impl FrameSlot { ...@@ -127,4 +127,4 @@ impl FrameSlot {
) )
}) })
} }
} }
\ No newline at end of file
...@@ -144,4 +144,4 @@ pub trait MachineCode { ...@@ -144,4 +144,4 @@ pub trait MachineCode {
pub trait MachineInst { pub trait MachineInst {
} }
\ No newline at end of file
...@@ -82,4 +82,4 @@ impl Default for CompilerPolicy { ...@@ -82,4 +82,4 @@ impl Default for CompilerPolicy {
CompilerPolicy{passes: passes} CompilerPolicy{passes: passes}
} }
} }
\ No newline at end of file
...@@ -272,4 +272,4 @@ fn process_dest(dest: Destination, blocks_to_insert: &mut Vec<IntermediateBlockI ...@@ -272,4 +272,4 @@ fn process_dest(dest: Destination, blocks_to_insert: &mut Vec<IntermediateBlockI
dest dest
} }
} }
\ No newline at end of file
...@@ -464,4 +464,4 @@ impl CompilerPass for Inlining { ...@@ -464,4 +464,4 @@ impl CompilerPass for Inlining {
debug!("after inlining: {:?}", func); debug!("after inlining: {:?}", func);
} }
} }
} }
\ No newline at end of file
...@@ -71,4 +71,4 @@ impl AddressBitmap { ...@@ -71,4 +71,4 @@ impl AddressBitmap {
pub fn print(&self) { pub fn print(&self) {
self.bitmap.print(); self.bitmap.print();
} }
} }
\ No newline at end of file
...@@ -41,4 +41,4 @@ impl <T> AddressMap<T> where T: Copy{ ...@@ -41,4 +41,4 @@ impl <T> AddressMap<T> where T: Copy{
let index = (addr.diff(self.start) >> LOG_POINTER_SIZE) as isize; let index = (addr.diff(self.start) >> LOG_POINTER_SIZE) as isize;
unsafe {*self.ptr.offset(index)} unsafe {*self.ptr.offset(index)}
} }
} }
\ No newline at end of file
...@@ -145,4 +145,4 @@ mod test { ...@@ -145,4 +145,4 @@ mod test {
assert_eq!(bitmap.length_until_next_bit(5), 1); assert_eq!(bitmap.length_until_next_bit(5), 1);
assert_eq!(bitmap.length_until_next_bit(6), 0); assert_eq!(bitmap.length_until_next_bit(6), 0);
} }
} }
\ No newline at end of file
...@@ -174,4 +174,4 @@ mod tests { ...@@ -174,4 +174,4 @@ mod tests {
assert_eq!(vec[1].gen_ref_offsets(), vec![0, 16, 32, 48, 64, 80, 96, 112, 128, 144]); assert_eq!(vec[1].gen_ref_offsets(), vec![0, 16, 32, 48, 64, 80, 96, 112, 128, 144]);
assert_eq!(vec[2].gen_ref_offsets(), (0..100).map(|x| x * 16).collect::<Vec<ByteSize>>()); assert_eq!(vec[2].gen_ref_offsets(), (0..100).map(|x| x * 16).collect::<Vec<ByteSize>>());
} }
} }
\ No newline at end of file
...@@ -4,4 +4,4 @@ mod address_map; ...@@ -4,4 +4,4 @@ mod address_map;
pub mod gctype; pub mod gctype;
pub use self::address_bitmap::AddressBitmap; pub use self::address_bitmap::AddressBitmap;
pub use self::address_map::AddressMap; pub use self::address_map::AddressMap;
\ No newline at end of file
...@@ -124,4 +124,4 @@ impl fmt::Display for FreeListNode { ...@@ -124,4 +124,4 @@ impl fmt::Display for FreeListNode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "FreeListNode#{}(start={:#X}, size={}, state={:?})", self.id, self.start, self.size, self.mark) write!(f, "FreeListNode#{}(start={:#X}, size={}, state={:?})", self.id, self.start, self.size, self.mark)
} }
} }
\ No newline at end of file
...@@ -22,4 +22,4 @@ pub fn alloc_large(size: usize, align: usize, mutator: &mut immix::ImmixMutatorL ...@@ -22,4 +22,4 @@ pub fn alloc_large(size: usize, align: usize, mutator: &mut immix::ImmixMutatorL
return ret_addr; return ret_addr;
} }
} }
} }
\ No newline at end of file
...@@ -362,4 +362,4 @@ mod tests { ...@@ -362,4 +362,4 @@ mod tests {
println!("Allocation{}: {}", i, ret); println!("Allocation{}: {}", i, ret);
} }
} }
} }
\ No newline at end of file
...@@ -567,4 +567,4 @@ pub fn steal_process_edge(base: Address, offset: usize, local_queue:&mut Vec<Obj ...@@ -567,4 +567,4 @@ pub fn steal_process_edge(base: Address, offset: usize, local_queue:&mut Vec<Obj
} }
} }
} }
} }
\ No newline at end of file
...@@ -344,4 +344,4 @@ impl fmt::Display for ImmixMutatorLocal { ...@@ -344,4 +344,4 @@ impl fmt::Display for ImmixMutatorLocal {
write!(f, "block = {}", self.block.as_ref().unwrap()) write!(f, "block = {}", self.block.as_ref().unwrap())
} }
} }
} }
\ No newline at end of file
...@@ -440,4 +440,4 @@ impl fmt::Debug for ImmixBlock { ...@@ -440,4 +440,4 @@ impl fmt::Debug for ImmixBlock {
} }
write!(f, "]") write!(f, "]")
} }
} }
\ No newline at end of file
...@@ -36,4 +36,4 @@ pub enum LineMark { ...@@ -36,4 +36,4 @@ pub enum LineMark {
pub enum BlockMark { pub enum BlockMark {
Usable, Usable,
Full Full
} }
\ No newline at end of file
...@@ -87,4 +87,4 @@ pub trait Space { ...@@ -87,4 +87,4 @@ pub trait Space {
pub fn fill_alignment_gap(start : Address, end : Address) -> () { pub fn fill_alignment_gap(start : Address, end : Address) -> () {
debug_assert!(end >= start); debug_assert!(end >= start);
start.memset(ALIGNMENT_VALUE, end.diff(start)); start.memset(ALIGNMENT_VALUE, end.diff(start));
} }
\ No newline at end of file
...@@ -208,4 +208,4 @@ pub extern fn muentry_alloc_large(mutator: *mut ImmixMutatorLocal, size: usize, ...@@ -208,4 +208,4 @@ pub extern fn muentry_alloc_large(mutator: *mut ImmixMutatorLocal, size: usize,
#[no_mangle] #[no_mangle]
pub extern fn force_gc() { pub extern fn force_gc() {
heap::gc::trigger_gc(); heap::gc::trigger_gc();
} }
\ No newline at end of file
...@@ -393,4 +393,4 @@ mod tests { ...@@ -393,4 +393,4 @@ mod tests {
assert_eq!(header_get_hybrid_length(encode), 10); assert_eq!(header_get_hybrid_length(encode), 10);
assert_eq!(header_get_gctype_id(encode), 2); assert_eq!(header_get_gctype_id(encode), 2);
} }
} }
\ No newline at end of file
...@@ -96,4 +96,4 @@ pub const SHORT_ENCODE_BIT : usize = 7; ...@@ -96,4 +96,4 @@ pub const SHORT_ENCODE_BIT : usize = 7;
#[inline(always)] #[inline(always)]
pub fn get_ref_byte(alloc_map:*mut u8, space_start: Address, obj: ObjectReference) -> u8 { pub fn get_ref_byte(alloc_map:*mut u8, space_start: Address, obj: ObjectReference) -> u8 {
unsafe {*alloc_map.offset((obj.to_address().diff(space_start) >> LOG_POINTER_SIZE) as isize)} unsafe {*alloc_map.offset((obj.to_address().diff(space_start) >> LOG_POINTER_SIZE) as isize)}
} }
\ No newline at end of file
mod test_gc_harness; mod test_gc_harness;
mod test_gcbench; mod test_gcbench;
mod test_gc_linked_list; mod test_gc_linked_list;
\ No newline at end of file
...@@ -275,4 +275,4 @@ fn test_alloc_trace() { ...@@ -275,4 +275,4 @@ fn test_alloc_trace() {
heap::gc::start_trace(&mut roots, shared_space, lo_space); heap::gc::start_trace(&mut roots, shared_space, lo_space);
mutator.destroy(); mutator.destroy();
} }
\ No newline at end of file
...@@ -210,4 +210,4 @@ fn linked_list_survive_gc() { ...@@ -210,4 +210,4 @@ fn linked_list_survive_gc() {
} }
mutator.destroy(); mutator.destroy();
} }
\ No newline at end of file
...@@ -205,4 +205,4 @@ fn start() { ...@@ -205,4 +205,4 @@ fn start() {
println!("Finished with {} collections", heap::gc::GC_COUNT.load(Ordering::SeqCst)); println!("Finished with {} collections", heap::gc::GC_COUNT.load(Ordering::SeqCst));
mutator.destroy(); mutator.destroy();
} }
\ No newline at end of file
...@@ -95,4 +95,4 @@ lazy_static! { ...@@ -95,4 +95,4 @@ lazy_static! {
aot: ValueLocation::Relocatable(RegGroup::GPR, String::from("muentry_frem")), aot: ValueLocation::Relocatable(RegGroup::GPR, String::from("muentry_frem")),
jit: RwLock::new(None) jit: RwLock::new(None)
}; };
} }
\ No newline at end of file
...@@ -208,4 +208,4 @@ fn find_func_for_address (cf: &RwLockReadGuard<HashMap<MuID, RwLock<CompiledFunc ...@@ -208,4 +208,4 @@ fn find_func_for_address (cf: &RwLockReadGuard<HashMap<MuID, RwLock<CompiledFunc
} }
panic!("cannot find compiled function for pc 0x{:x}", pc_addr); panic!("cannot find compiled function for pc 0x{:x}", pc_addr);
} }
\ No newline at end of file
...@@ -4,4 +4,4 @@ pub extern fn muentry_frem(a: f64, b: f64) -> f64 { ...@@ -4,4 +4,4 @@ pub extern fn muentry_frem(a: f64, b: f64) -> f64 {
use std::ops::Rem; use std::ops::Rem;
a.rem(b) a.rem(b)
} }
\ No newline at end of file
...@@ -28,4 +28,4 @@ pub fn allocate_value(value: P<Value>, vm: &VM) -> ValueLocation { ...@@ -28,4 +28,4 @@ pub fn allocate_value(value: P<Value>, vm: &VM) -> ValueLocation {
let addr = allocate(backend_ty.size, backend_ty.alignment).to_address(); let addr = allocate(backend_ty.size, backend_ty.alignment).to_address();
ValueLocation::Direct(RegGroup::GPR, addr) ValueLocation::Direct(RegGroup::GPR, addr)
} }
\ No newline at end of file
...@@ -203,4 +203,4 @@ pub extern fn mu_main(serialized_vm : *const c_char) { ...@@ -203,4 +203,4 @@ pub extern fn mu_main(serialized_vm : *const c_char) {
thread.join().unwrap(); thread.join().unwrap();
} }
} }
\ No newline at end of file
...@@ -171,4 +171,4 @@ pub fn link_dylib_with_extra_srcs(funcs: Vec<MuName>, srcs: Vec<String>, out: &s ...@@ -171,4 +171,4 @@ pub fn link_dylib_with_extra_srcs(funcs: Vec<MuName>, srcs: Vec<String>, out: &s
out_path.push(out); out_path.push(out);
link_dylib_internal(files, out_path) link_dylib_internal(files, out_path)
} }
\ No newline at end of file
...@@ -40,4 +40,4 @@ pub fn compile_run_c_test(test_file_path: &'static str) -> PathBuf { ...@@ -40,4 +40,4 @@ pub fn compile_run_c_test(test_file_path: &'static str) -> PathBuf {
let test_out = exec(test); let test_out = exec(test);
Path::new(&String::from_utf8(test_out.stdout).unwrap()).to_path_buf() Path::new(&String::from_utf8(test_out.stdout).unwrap()).to_path_buf()
} }
\ No newline at end of file
...@@ -99,4 +99,4 @@ pub fn compile_fncs<'a>(entry: &'static str, fnc_names: Vec<&'static str>, build ...@@ -99,4 +99,4 @@ pub fn compile_fncs<'a>(entry: &'static str, fnc_names: Vec<&'static str>, build
let libname = &get_dylib_name(entry); let libname = &get_dylib_name(entry);
let dylib = aot::link_dylib(fnc_names.iter().map(|x| Mu(x)).collect(), libname, &vm); let dylib = aot::link_dylib(fnc_names.iter().map(|x| Mu(x)).collect(), libname, &vm);
ll::Library::new(dylib.as_os_str()).unwrap() ll::Library::new(dylib.as_os_str()).unwrap()
} }
\ No newline at end of file
...@@ -196,4 +196,4 @@ impl fmt::Debug for ObjectReference { ...@@ -196,4 +196,4 @@ impl fmt::Debug for ObjectReference {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "0x{:X}", self.0) write!(f, "0x{:X}", self.0)
} }
} }
\ No newline at end of file
...@@ -43,4 +43,4 @@ mod tests { ...@@ -43,4 +43,4 @@ mod tests {
assert_eq!(set_nth_bit_u64(a, 2, 1), 0b100); assert_eq!(set_nth_bit_u64(a, 2, 1), 0b100);
assert_eq!(set_nth_bit_u64(b, 2, 0), 0b1011); assert_eq!(set_nth_bit_u64(b, 2, 0), 0b1011);
} }
} }
\ No newline at end of file
...@@ -4,4 +4,4 @@ use ast::ptr::*; ...@@ -4,4 +4,4 @@ use ast::ptr::*;
pub fn make_i32_const(id: MuID, val: i32) -> P<Value> { pub fn make_i32_const(id: MuID, val: i32) -> P<Value> {
unimplemented!() unimplemented!()
} }
\ No newline at end of file
extern crate byteorder; extern crate byteorder;
extern crate rustc_serialize; extern crate rustc_serialize;
pub type BitSize = usize;
pub type ByteOffset = isize; pub type ByteOffset = isize;
pub type ByteSize = usize; pub type ByteSize = usize;
pub type Word = usize; pub type Word = usize;
...@@ -46,4 +47,4 @@ pub use address::ObjectReference; ...@@ -46,4 +47,4 @@ pub use address::ObjectReference;
pub mod vec_utils; pub mod vec_utils;
pub mod bit_utils; pub mod bit_utils;
pub mod string_utils; pub mod string_utils;
\ No newline at end of file
...@@ -1128,4 +1128,4 @@ impl<K: Hash + Eq, V, S: BuildHasher> IntoIterator for LinkedHashMap<K, V, S> { ...@@ -1128,4 +1128,4 @@ impl<K: Hash + Eq, V, S: BuildHasher> IntoIterator for LinkedHashMap<K, V, S> {
marker: marker::PhantomData, marker: marker::PhantomData,
} }
} }
} }
\ No newline at end of file
...@@ -44,4 +44,4 @@ mod tests{ ...@@ -44,4 +44,4 @@ mod tests{
assert_eq!(raw, a); assert_eq!(raw, a);
} }
} }
\ No newline at end of file
...@@ -9,4 +9,4 @@ pub fn replace(s: &mut String, index: usize, replace: &String, replace_len: usiz ...@@ -9,4 +9,4 @@ pub fn replace(s: &mut String, index: usize, replace: &String, replace_len: usiz
vec[index + i] = ' ' as u8; vec[index + i] = ' ' as u8;
} }
} }
} }
\ No newline at end of file
...@@ -142,4 +142,4 @@ pub fn map<T, Q, F> (vec: &Vec<T>, map_func: F) -> Vec<Q> ...@@ -142,4 +142,4 @@ pub fn map<T, Q, F> (vec: &Vec<T>, map_func: F) -> Vec<Q>
} }
ret ret
} }
\ No newline at end of file
...@@ -19,7 +19,7 @@ mod deps { ...@@ -19,7 +19,7 @@ mod deps {
pub type MuName = String; pub type MuName = String;
pub type CName = MuName; pub type CName = MuName;
pub struct APIHandleKey { pub struct APIHandle {
// stub // stub
} }
......
This diff is collapsed.
...@@ -105,17 +105,17 @@ fn from_MuBool(cbool: CMuBool) -> bool { ...@@ -105,17 +105,17 @@ fn from_MuBool(cbool: CMuBool) -> bool {
cbool != 0 cbool != 0
} }
// APIHandleKey is immutable when used. // APIHandle is immutable when used.
#[inline(always)] #[inline(always)]
fn from_handle<'a>(cmuvalue: CMuValue) -> &'a APIHandleKey { fn from_handle<'a>(cmuvalue: CMuValue) -> &'a APIHandle {
debug_assert!(!cmuvalue.is_null()); debug_assert!(!cmuvalue.is_null());
unsafe { unsafe {
&*(cmuvalue as *const APIHandleKey) &*(cmuvalue as *const APIHandle)
} }
} }
#[inline(always)] #[inline(always)]
fn from_handle_optional<'a>(cmuvalue: CMuValue) -> Option<&'a APIHandleKey> { fn from_handle_optional<'a>(cmuvalue: CMuValue) -> Option<&'a APIHandle> {
if cmuvalue.is_null() { if cmuvalue.is_null() {
None None
} else { } else {
...@@ -157,11 +157,11 @@ fn from_MuFlag_array<'a>(ptr: *const CMuFlag, len: usize) -> &'a [CMuFlag] { ...@@ -157,11 +157,11 @@ fn from_MuFlag_array<'a>(ptr: *const CMuFlag, len: usize) -> &'a [CMuFlag] {
/// way as raw pointers. So this function will convert each element. This function is only called /// way as raw pointers. So this function will convert each element. This function is only called
/// by `new_thread_nor`. As always, thread creation dominates the time. /// by `new_thread_nor`. As always, thread creation dominates the time.
#[inline(always)] #[inline(always)]
fn from_handle_array<'a>(ptr: *const CMuValue, len: usize) -> Vec<&'a APIHandleKey> { fn from_handle_array<'a>(ptr: *const CMuValue, len: usize) -> Vec<&'a APIHandle> {
let slc = from_array_direct(ptr, len); let slc = from_array_direct(ptr, len);
slc.iter().map(|&e| { slc.iter().map(|&e| {
debug_assert!(!e.is_null()); debug_assert!(!e.is_null());
unsafe { &*(e as *const APIHandleKey) } unsafe { &*(e as *const APIHandle) }
}).collect::<Vec<_>>() }).collect::<Vec<_>>()
} }
...@@ -190,7 +190,7 @@ fn to_MuID(value: MuID) -> CMuID { ...@@ -190,7 +190,7 @@ fn to_MuID(value: MuID) -> CMuID {
} }
#[inline(always)] #[inline(always)]
fn to_handle(muvalue: *const APIHandleKey) -> CMuValue { fn to_handle(muvalue: *const APIHandle) -> CMuValue {
debug_assert!(!muvalue.is_null()); debug_assert!(!muvalue.is_null());
muvalue as CMuValue muvalue as CMuValue
} }
......
...@@ -45,5 +45,7 @@ mod common { ...@@ -45,5 +45,7 @@ mod common {
pub use ast::ir::*; pub use ast::ir::*;
pub use ast::ptr::*; pub use ast::ptr::*;
pub use ast::types::*; pub use ast::types::*;
pub use vm::handle::*;
} }
This diff is collapsed.
...@@ -151,4 +151,4 @@ pub extern fn mu_fastimpl_new_with_opts(opts: *const c_char) -> *mut CMuVM { ...@@ -151,4 +151,4 @@ pub extern fn mu_fastimpl_new_with_opts(opts: *const c_char) -> *mut CMuVM {
debug!("The C-visible CMuVM struct address: {:?}", c_mvm); debug!("The C-visible CMuVM struct address: {:?}", c_mvm);
c_mvm c_mvm
} }
\ No newline at end of file
...@@ -77,4 +77,4 @@ pub struct MuCtx { ...@@ -77,4 +77,4 @@ pub struct MuCtx {
// GENERATE_BEGIN: MuCtx // GENERATE_BEGIN: MuCtx