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 1168f297 authored by qinsoon's avatar qinsoon
Browse files

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

parent 55aa2fe5
../api_c.rs
\ No newline at end of file
This diff is collapsed.
......@@ -111,7 +111,7 @@ pub struct MuVM {
pub struct MuCtx<'v> {
mvm: &'v mut MuVM,
c_struct: *mut CMuCtx,
handles: HashSet<*const APIHandleKey>,
handles: HashSet<*const APIHandle>,
}
pub struct MuIRBuilder<'c> {
......@@ -176,8 +176,8 @@ impl MuVM {
println!("Let's call the trap handler now.");
let ctx: *mut CMuCtx = ptr::null_mut();
let thread: CMuValue = Box::into_raw(Box::new(APIHandleKey{ty: 100, vb: ValueBox::BoxThread})) as CMuValue;
let stack: CMuValue = Box::into_raw(Box::new(APIHandleKey{ty: 200, vb: ValueBox::BoxStack})) as CMuValue;
let thread: CMuValue = Box::into_raw(Box::new(APIHandle{ty: 100, vb: ValueBox::BoxThread})) as CMuValue;
let stack: CMuValue = Box::into_raw(Box::new(APIHandle{ty: 200, vb: ValueBox::BoxStack})) as CMuValue;
let wpid: u32 = 99;
let mut result: CMuTrapHandlerResult = 0;
......@@ -194,8 +194,8 @@ impl MuVM {
userdata);
println!("Back to Rust! result = {}", result);
let new_stack_proper = new_stack as *const APIHandleKey;
let values_proper = values as *const *const APIHandleKey;
let new_stack_proper = new_stack as *const APIHandle;
let values_proper = values as *const *const APIHandle;
let values_slice = unsafe { slice::from_raw_parts(values_proper, nvalues) };
unsafe {
println!(" new_stack = {}, {:?}", (*new_stack_proper).ty, (*new_stack_proper).vb);
......@@ -213,8 +213,8 @@ impl MuVM {
// free memory
unsafe {
Box::from_raw(stack as *mut APIHandleKey);
Box::from_raw(thread as *mut APIHandleKey);
Box::from_raw(stack as *mut APIHandle);
Box::from_raw(thread as *mut APIHandle);
}
}
......@@ -258,7 +258,7 @@ impl<'v> MuCtx<'v> {
}
#[inline(always)]
fn expose_handle(&mut self, handle: APIHandleKey) -> *const APIHandleKey {
fn expose_handle(&mut self, handle: APIHandle) -> *const APIHandle {
let box_ptr = Box::into_raw(Box::new(handle));
self.handles.insert(box_ptr);
......@@ -266,208 +266,208 @@ impl<'v> MuCtx<'v> {
box_ptr
}
pub fn handle_from_sint8(&mut self, num: i8, len: c_int) -> *const APIHandleKey {
pub fn handle_from_sint8(&mut self, num: i8, len: c_int) -> *const APIHandle {
panic!("Not implemented")
}
pub fn handle_from_uint8(&mut self, num: u8, len: c_int) -> *const APIHandleKey {
pub fn handle_from_uint8(&mut self, num: u8, len: c_int) -> *const APIHandle {
panic!("Not implemented")
}
pub fn handle_from_sint16(&mut self, num: i16, len: c_int) -> *const APIHandleKey {
pub fn handle_from_sint16(&mut self, num: i16, len: c_int) -> *const APIHandle {
panic!("Not implemented")
}
pub fn handle_from_uint16(&mut self, num: u16, len: c_int) -> *const APIHandleKey {
pub fn handle_from_uint16(&mut self, num: u16, len: c_int) -> *const APIHandle {
panic!("Not implemented")
}
pub fn handle_from_sint32(&mut self, num: i32, len: c_int) -> *const APIHandleKey {
self.expose_handle(APIHandleKey {
pub fn handle_from_sint32(&mut self, num: i32, len: c_int) -> *const APIHandle {
self.expose_handle(APIHandle {
ty: 300,
vb: ValueBox::BoxInt(num as u64, len),
})
}
pub fn handle_from_uint32(&mut self, num: u32, len: c_int) -> *const APIHandleKey {
pub fn handle_from_uint32(&mut self, num: u32, len: c_int) -> *const APIHandle {
panic!("Not implemented")
}
pub fn handle_from_sint64(&mut self, num: i64, len: c_int) -> *const APIHandleKey {
pub fn handle_from_sint64(&mut self, num: i64, len: c_int) -> *const APIHandle {
panic!("Not implemented")
}
pub fn handle_from_uint64(&mut self, num: u64, len: c_int) -> *const APIHandleKey {
pub fn handle_from_uint64(&mut self, num: u64, len: c_int) -> *const APIHandle {
panic!("Not implemented")
}
pub fn handle_from_uint64s(&mut self, nums: &[u64], len: c_int) -> *const APIHandleKey {
pub fn handle_from_uint64s(&mut self, nums: &[u64], len: c_int) -> *const APIHandle {
panic!("Not implemented")
}
pub fn handle_from_float(&mut self, num: f32) -> *const APIHandleKey {
pub fn handle_from_float(&mut self, num: f32) -> *const APIHandle {
panic!("Not implemented")
}
pub fn handle_from_double(&mut self, num: f64) -> *const APIHandleKey {
pub fn handle_from_double(&mut self, num: f64) -> *const APIHandle {
panic!("Not implemented")
}
pub fn handle_from_ptr(&mut self, mu_type: MuID, ptr: CMuCPtr) -> *const APIHandleKey {
pub fn handle_from_ptr(&mut self, mu_type: MuID, ptr: CMuCPtr) -> *const APIHandle {
panic!("Not implemented")
}
pub fn handle_from_fp(&mut self, mu_type: MuID, fp: CMuCFP) -> *const APIHandleKey {
pub fn handle_from_fp(&mut self, mu_type: MuID, fp: CMuCFP) -> *const APIHandle {
panic!("Not implemented")
}
pub fn handle_to_sint8(&mut self, opnd: &APIHandleKey) -> i8 {
pub fn handle_to_sint8(&mut self, opnd: &APIHandle) -> i8 {
panic!("Not implemented")
}
pub fn handle_to_uint8(&mut self, opnd: &APIHandleKey) -> u8 {
pub fn handle_to_uint8(&mut self, opnd: &APIHandle) -> u8 {
panic!("Not implemented")
}
pub fn handle_to_sint16(&mut self, opnd: &APIHandleKey) -> i16 {
pub fn handle_to_sint16(&mut self, opnd: &APIHandle) -> i16 {
panic!("Not implemented")
}
pub fn handle_to_uint16(&mut self, opnd: &APIHandleKey) -> u16 {
pub fn handle_to_uint16(&mut self, opnd: &APIHandle) -> u16 {
panic!("Not implemented")
}
pub fn handle_to_sint32(&mut self, opnd: &APIHandleKey) -> i32 {
pub fn handle_to_sint32(&mut self, opnd: &APIHandle) -> i32 {
panic!("Not implemented")
}
pub fn handle_to_uint32(&mut self, opnd: &APIHandleKey) -> u32 {
pub fn handle_to_uint32(&mut self, opnd: &APIHandle) -> u32 {
panic!("Not implemented")
}
pub fn handle_to_sint64(&mut self, opnd: &APIHandleKey) -> i64 {
pub fn handle_to_sint64(&mut self, opnd: &APIHandle) -> i64 {
panic!("Not implemented")
}
pub fn handle_to_uint64(&mut self, opnd: &APIHandleKey) -> u64 {
pub fn handle_to_uint64(&mut self, opnd: &APIHandle) -> u64 {
panic!("Not implemented")
}
pub fn handle_to_float(&mut self, opnd: &APIHandleKey) -> f32 {
pub fn handle_to_float(&mut self, opnd: &APIHandle) -> f32 {
panic!("Not implemented")
}
pub fn handle_to_double(&mut self, opnd: &APIHandleKey) -> f64 {
pub fn handle_to_double(&mut self, opnd: &APIHandle) -> f64 {
panic!("Not implemented")
}
pub fn handle_to_ptr(&mut self, opnd: &APIHandleKey) -> CMuCPtr {
pub fn handle_to_ptr(&mut self, opnd: &APIHandle) -> CMuCPtr {
panic!("Not implemented")
}
pub fn handle_to_fp(&mut self, opnd: &APIHandleKey) -> CMuCFP {
pub fn handle_to_fp(&mut self, opnd: &APIHandle) -> CMuCFP {
panic!("Not implemented")
}
pub fn handle_from_const(&mut self, id: MuID) -> *const APIHandleKey {
pub fn handle_from_const(&mut self, id: MuID) -> *const APIHandle {
panic!("Not implemented")
}
pub fn handle_from_global(&mut self, id: MuID) -> *const APIHandleKey {
pub fn handle_from_global(&mut self, id: MuID) -> *const APIHandle {
panic!("Not implemented")
}
pub fn handle_from_func(&mut self, id: MuID) -> *const APIHandleKey {
pub fn handle_from_func(&mut self, id: MuID) -> *const APIHandle {
panic!("Not implemented")
}
pub fn handle_from_expose(&mut self, id: MuID) -> *const APIHandleKey {
pub fn handle_from_expose(&mut self, id: MuID) -> *const APIHandle {
panic!("Not implemented")
}
#[inline(always)]
fn dealloc_handle(ptr: *const APIHandleKey) {
fn dealloc_handle(ptr: *const APIHandle) {
unsafe {
println!("Deallocating handle {:?}", *ptr);
Box::from_raw(ptr as *mut APIHandleKey);
Box::from_raw(ptr as *mut APIHandle);
}
}
pub fn delete_value(&mut self, opnd: &APIHandleKey) {
let ptr = opnd as *const APIHandleKey;
pub fn delete_value(&mut self, opnd: &APIHandle) {
let ptr = opnd as *const APIHandle;
self.handles.remove(&ptr);
MuCtx::dealloc_handle(opnd);
}
pub fn ref_eq(&mut self, lhs: &APIHandleKey, rhs: &APIHandleKey) -> bool {
pub fn ref_eq(&mut self, lhs: &APIHandle, rhs: &APIHandle) -> bool {
panic!("Not implemented")
}
pub fn ref_ult(&mut self, lhs: &APIHandleKey, rhs: &APIHandleKey) -> bool {
pub fn ref_ult(&mut self, lhs: &APIHandle, rhs: &APIHandle) -> bool {
panic!("Not implemented")
}
pub fn extract_value(&mut self, str: &APIHandleKey, index: c_int) -> *const APIHandleKey {
pub fn extract_value(&mut self, str: &APIHandle, index: c_int) -> *const APIHandle {
panic!("Not implemented")
}
pub fn insert_value(&mut self, str: &APIHandleKey, index: c_int, newval: &APIHandleKey) -> *const APIHandleKey {
pub fn insert_value(&mut self, str: &APIHandle, index: c_int, newval: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn extract_element(&mut self, str: &APIHandleKey, index: &APIHandleKey) -> *const APIHandleKey {
pub fn extract_element(&mut self, str: &APIHandle, index: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn insert_element(&mut self, str: &APIHandleKey, index: &APIHandleKey, newval: &APIHandleKey) -> *const APIHandleKey {
pub fn insert_element(&mut self, str: &APIHandle, index: &APIHandle, newval: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn new_fixed(&mut self, mu_type: MuID) -> *const APIHandleKey {
pub fn new_fixed(&mut self, mu_type: MuID) -> *const APIHandle {
panic!("Not implemented")
}
pub fn new_hybrid(&mut self, mu_type: MuID, length: &APIHandleKey) -> *const APIHandleKey {
pub fn new_hybrid(&mut self, mu_type: MuID, length: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn refcast(&mut self, opnd: &APIHandleKey, new_type: MuID) -> *const APIHandleKey {
pub fn refcast(&mut self, opnd: &APIHandle, new_type: MuID) -> *const APIHandle {
panic!("Not implemented")
}
pub fn get_iref(&mut self, opnd: &APIHandleKey) -> *const APIHandleKey {
pub fn get_iref(&mut self, opnd: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn get_field_iref(&mut self, opnd: &APIHandleKey, field: c_int) -> *const APIHandleKey {
pub fn get_field_iref(&mut self, opnd: &APIHandle, field: c_int) -> *const APIHandle {
panic!("Not implemented")
}
pub fn get_elem_iref(&mut self, opnd: &APIHandleKey, index: &APIHandleKey) -> *const APIHandleKey {
pub fn get_elem_iref(&mut self, opnd: &APIHandle, index: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn shift_iref(&mut self, opnd: &APIHandleKey, offset: &APIHandleKey) -> *const APIHandleKey {
pub fn shift_iref(&mut self, opnd: &APIHandle, offset: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn get_var_part_iref(&mut self, opnd: &APIHandleKey) -> *const APIHandleKey {
pub fn get_var_part_iref(&mut self, opnd: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn load(&mut self, ord: CMuMemOrd, loc: &APIHandleKey) -> *const APIHandleKey {
pub fn load(&mut self, ord: CMuMemOrd, loc: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn store(&mut self, ord: CMuMemOrd, loc: &APIHandleKey, newval: &APIHandleKey) {
pub fn store(&mut self, ord: CMuMemOrd, loc: &APIHandle, newval: &APIHandle) {
panic!("Not implemented")
}
pub fn cmpxchg(&mut self, ord_succ: CMuMemOrd, ord_fail: CMuMemOrd, weak: bool, loc: &APIHandleKey, expected: &APIHandleKey, desired: &APIHandleKey, is_succ: *mut CMuBool) -> *const APIHandleKey {
pub fn cmpxchg(&mut self, ord_succ: CMuMemOrd, ord_fail: CMuMemOrd, weak: bool, loc: &APIHandle, expected: &APIHandle, desired: &APIHandle, is_succ: *mut CMuBool) -> *const APIHandle {
panic!("Not implemented")
}
pub fn atomicrmw(&mut self, ord: CMuMemOrd, op: CMuAtomicRMWOptr, loc: &APIHandleKey, opnd: &APIHandleKey) -> *const APIHandleKey {
pub fn atomicrmw(&mut self, ord: CMuMemOrd, op: CMuAtomicRMWOptr, loc: &APIHandle, opnd: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
......@@ -475,107 +475,107 @@ impl<'v> MuCtx<'v> {
panic!("Not implemented")
}
pub fn new_stack(&mut self, func: &APIHandleKey) -> *const APIHandleKey {
pub fn new_stack(&mut self, func: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn new_thread_nor(&mut self, stack: &APIHandleKey, threadlocal: Option<&APIHandleKey>, vals: Vec<&APIHandleKey>) -> *const APIHandleKey {
pub fn new_thread_nor(&mut self, stack: &APIHandle, threadlocal: Option<&APIHandle>, vals: Vec<&APIHandle>) -> *const APIHandle {
panic!("Not implemented")
}
pub fn new_thread_exc(&mut self, stack: &APIHandleKey, threadlocal: Option<&APIHandleKey>, exc: &APIHandleKey) -> *const APIHandleKey {
pub fn new_thread_exc(&mut self, stack: &APIHandle, threadlocal: Option<&APIHandle>, exc: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn kill_stack(&mut self, stack: &APIHandleKey) {
pub fn kill_stack(&mut self, stack: &APIHandle) {
panic!("Not implemented")
}
pub fn set_threadlocal(&mut self, thread: &APIHandleKey, threadlocal: &APIHandleKey) {
pub fn set_threadlocal(&mut self, thread: &APIHandle, threadlocal: &APIHandle) {
panic!("Not implemented")
}
pub fn get_threadlocal(&mut self, thread: &APIHandleKey) -> *const APIHandleKey {
pub fn get_threadlocal(&mut self, thread: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn new_cursor(&mut self, stack: &APIHandleKey) -> *const APIHandleKey {
pub fn new_cursor(&mut self, stack: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn next_frame(&mut self, cursor: &APIHandleKey) {
pub fn next_frame(&mut self, cursor: &APIHandle) {
panic!("Not implemented")
}
pub fn copy_cursor(&mut self, cursor: &APIHandleKey) -> *const APIHandleKey {
pub fn copy_cursor(&mut self, cursor: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn close_cursor(&mut self, cursor: &APIHandleKey) {
pub fn close_cursor(&mut self, cursor: &APIHandle) {
panic!("Not implemented")
}
pub fn cur_func(&mut self, cursor: &APIHandleKey) -> MuID {
pub fn cur_func(&mut self, cursor: &APIHandle) -> MuID {
panic!("Not implemented")
}
pub fn cur_func_ver(&mut self, cursor: &APIHandleKey) -> MuID {
pub fn cur_func_ver(&mut self, cursor: &APIHandle) -> MuID {
panic!("Not implemented")
}
pub fn cur_inst(&mut self, cursor: &APIHandleKey) -> MuID {
pub fn cur_inst(&mut self, cursor: &APIHandle) -> MuID {
panic!("Not implemented")
}
pub fn dump_keepalives(&mut self, cursor: &APIHandleKey, results: *mut CMuValue) {
pub fn dump_keepalives(&mut self, cursor: &APIHandle, results: *mut CMuValue) {
panic!("Not implemented")
}
pub fn pop_frames_to(&mut self, cursor: &APIHandleKey) {
pub fn pop_frames_to(&mut self, cursor: &APIHandle) {
panic!("Not implemented")
}
pub fn push_frame(&mut self, stack: &APIHandleKey, func: &APIHandleKey) {
pub fn push_frame(&mut self, stack: &APIHandle, func: &APIHandle) {
panic!("Not implemented")
}
pub fn tr64_is_fp(&mut self, value: &APIHandleKey) -> bool {
pub fn tr64_is_fp(&mut self, value: &APIHandle) -> bool {
panic!("Not implemented")
}
pub fn tr64_is_int(&mut self, value: &APIHandleKey) -> bool {
pub fn tr64_is_int(&mut self, value: &APIHandle) -> bool {
panic!("Not implemented")
}
pub fn tr64_is_ref(&mut self, value: &APIHandleKey) -> bool {
pub fn tr64_is_ref(&mut self, value: &APIHandle) -> bool {
panic!("Not implemented")
}
pub fn tr64_to_fp(&mut self, value: &APIHandleKey) -> *const APIHandleKey {
pub fn tr64_to_fp(&mut self, value: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn tr64_to_int(&mut self, value: &APIHandleKey) -> *const APIHandleKey {
pub fn tr64_to_int(&mut self, value: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn tr64_to_ref(&mut self, value: &APIHandleKey) -> *const APIHandleKey {
pub fn tr64_to_ref(&mut self, value: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn tr64_to_tag(&mut self, value: &APIHandleKey) -> *const APIHandleKey {
pub fn tr64_to_tag(&mut self, value: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn tr64_from_fp(&mut self, value: &APIHandleKey) -> *const APIHandleKey {
pub fn tr64_from_fp(&mut self, value: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn tr64_from_int(&mut self, value: &APIHandleKey) -> *const APIHandleKey {
pub fn tr64_from_int(&mut self, value: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn tr64_from_ref(&mut self, reff: &APIHandleKey, tag: &APIHandleKey) -> *const APIHandleKey {
pub fn tr64_from_ref(&mut self, reff: &APIHandle, tag: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
......@@ -587,23 +587,23 @@ impl<'v> MuCtx<'v> {
panic!("Not implemented")
}
pub fn pin(&mut self, loc: &APIHandleKey) -> *const APIHandleKey {
pub fn pin(&mut self, loc: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn unpin(&mut self, loc: &APIHandleKey) {
pub fn unpin(&mut self, loc: &APIHandle) {
panic!("Not implemented")
}
pub fn get_addr(&mut self, loc: &APIHandleKey) -> *const APIHandleKey {
pub fn get_addr(&mut self, loc: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn expose(&mut self, func: &APIHandleKey, call_conv: CMuCallConv, cookie: &APIHandleKey) -> *const APIHandleKey {
pub fn expose(&mut self, func: &APIHandle, call_conv: CMuCallConv, cookie: &APIHandle) -> *const APIHandle {
panic!("Not implemented")
}
pub fn unexpose(&mut self, call_conv: CMuCallConv, value: &APIHandleKey) {
pub fn unexpose(&mut self, call_conv: CMuCallConv, value: &APIHandle) {
panic!("Not implemented")
}
......@@ -611,7 +611,7 @@ impl<'v> MuCtx<'v> {
panic!("Not implemented")
}
pub fn make_boot_image(&mut self, whitelist: Vec<MuID>, primordial_func: Option<&APIHandleKey>, primordial_stack: Option<&APIHandleKey>, primordial_threadlocal: Option<&APIHandleKey>, sym_fields: Vec<&APIHandleKey>, sym_strings: Vec<String>, reloc_fields: Vec<&APIHandleKey>, reloc_strings: Vec<String>, output_file: String) {
pub fn make_boot_image(&mut self, whitelist: Vec<MuID>, primordial_func: Option<&APIHandle>, primordial_stack: Option<&APIHandle>, primordial_threadlocal: Option<&APIHandle>, sym_fields: Vec<&APIHandle>, sym_strings: Vec<String>, reloc_fields: Vec<&APIHandle>, reloc_strings: Vec<String>, output_file: String) {
panic!("Not implemented")
}
......
......@@ -23,7 +23,7 @@ mod deps {
}
#[derive(Debug)]
pub struct APIHandleKey {
pub struct APIHandle {
pub ty: MuID,
pub vb: ValueBox,
}
......
......@@ -10,7 +10,7 @@ mod deps {
pub use ast::ir::MuID;
pub use ast::ir::MuName;
pub use ast::ir::CName;
pub use ast::bundle::APIHandleKey;
pub use vm::handle::APIHandle;
extern crate ast;
}
......
use ast::ir::*;
use ast::inst::*;
use utils::BitSize;
use utils::Address;
use std::sync::Arc;
#[derive(Clone, Debug)]
pub struct APIHandle {
pub id: MuID,
pub v: APIHandleValue
}
#[derive(Clone, Debug)]
pub enum APIHandleValue {
Int(u64, BitSize),
Float(f32),
Double(f64),
UPtr(Address),
UFP(Address),
// SeqValue
Struct(Vec<APIHandleValue>),
Array (Vec<APIHandleValue>),
Vector(Vec<APIHandleValue>),
// GenRef
Ref(Address),
IRef(Address),
TagRef64(u64),
FuncRef,
ThreadRef,
StackRef,
FCRef, // frame cursor ref
// GenRef->IR
Bundle,
// GenRef->IR->Child
Type(MuID),
FuncSig(MuID),
FuncVer(MuID),
BB,
Inst,
// GenRef->IR->Child->Var->Global
Const,
Global(MuID),
Func,
ExpFunc,
// GenRef->IR->Child->Var->Local
NorParam,
ExcParam,
InstRes,
}
impl APIHandleValue {
pub fn as_iref(&self) -> Address {
match self {
&APIHandleValue::IRef(addr) => addr,
_ => panic!("expected IRef")
}
}
}
pub fn store(ord: MemoryOrder, loc: Arc<APIHandle>, val: Arc<APIHandle>) {
// FIXME: take memory order into consideration
// get address
let addr = loc.v.as_iref();