Commit f092e7f3 authored by qinsoon's avatar qinsoon

renaming APIMuValue to APIHandleKey

parent f3a7b9af
......@@ -37,13 +37,13 @@ impl MuBundle {
}
#[derive(Copy, Clone, Debug)]
pub struct APIMuValue {
pub struct APIHandleKey {
pub id: MuID,
pub v: APIMuValueKind
pub v: APIHandleKeyKind
}
#[derive(Copy, Clone, Debug)]
pub enum APIMuValueKind {
pub enum APIHandleKeyKind {
Int,
Float,
Double,
......@@ -88,9 +88,9 @@ pub enum APIMuValueKind {
macro_rules! handle_constructor {
($fn_name: ident, $kind: ident) => {
pub fn $fn_name(id: MuID) -> APIMuValue {
APIMuValue{
id: id, v: APIMuValueKind::$kind
pub fn $fn_name(id: MuID) -> APIHandleKey {
APIHandleKey{
id: id, v: APIHandleKeyKind::$kind
}
}
}
......
......@@ -19,7 +19,7 @@ mod deps {
pub type MuName = String;
pub type CName = MuName;
pub struct APIMuValue {
pub struct APIHandleKey {
// stub
}
......
This diff is collapsed.
......@@ -105,17 +105,17 @@ fn from_MuBool(cbool: CMuBool) -> bool {
cbool != 0
}
// APIMuValue is immutable when used.
// APIHandleKey is immutable when used.
#[inline(always)]
fn from_handle<'a>(cmuvalue: CMuValue) -> &'a APIMuValue {
fn from_handle<'a>(cmuvalue: CMuValue) -> &'a APIHandleKey {
debug_assert!(!cmuvalue.is_null());
unsafe {
&*(cmuvalue as *const APIMuValue)
&*(cmuvalue as *const APIHandleKey)
}
}
#[inline(always)]
fn from_handle_optional<'a>(cmuvalue: CMuValue) -> Option<&'a APIMuValue> {
fn from_handle_optional<'a>(cmuvalue: CMuValue) -> Option<&'a APIHandleKey> {
if cmuvalue.is_null() {
None
} else {
......@@ -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
/// by `new_thread_nor`. As always, thread creation dominates the time.
#[inline(always)]
fn from_handle_array<'a>(ptr: *const CMuValue, len: usize) -> Vec<&'a APIMuValue> {
fn from_handle_array<'a>(ptr: *const CMuValue, len: usize) -> Vec<&'a APIHandleKey> {
let slc = from_array_direct(ptr, len);
slc.iter().map(|&e| {
debug_assert!(!e.is_null());
unsafe { &*(e as *const APIMuValue) }
unsafe { &*(e as *const APIHandleKey) }
}).collect::<Vec<_>>()
}
......@@ -190,7 +190,7 @@ fn to_MuID(value: MuID) -> CMuID {
}
#[inline(always)]
fn to_handle(muvalue: *const APIMuValue) -> CMuValue {
fn to_handle(muvalue: *const APIHandleKey) -> CMuValue {
debug_assert!(!muvalue.is_null());
muvalue as CMuValue
}
......
This diff is collapsed.
......@@ -73,23 +73,23 @@ impl MuVM {
pub type MuArraySize = usize;
pub type MuIntValue = APIMuValue;
pub type MuIntValue = APIHandleKey;
pub type MuBundleNode = APIMuValue;
pub type MuChildNode = APIMuValue;
pub type MuTypeNode = APIMuValue;
pub type MuFuncSigNode= APIMuValue;
pub type MuConstNode = APIMuValue;
pub type MuGlobalNode = APIMuValue;
pub type MuFuncNode = APIMuValue;
pub type MuFuncVerNode= APIMuValue;
pub type MuBBNode = APIMuValue;
pub type MuNorParamNode = APIMuValue;
pub type MuExcParamNode = APIMuValue;
pub type MuInstNode = APIMuValue;
pub type MuInstResNode = APIMuValue;
pub type MuLocalVarNode = APIMuValue;
pub type MuVarNode = APIMuValue;
pub type MuBundleNode = APIHandleKey;
pub type MuChildNode = APIHandleKey;
pub type MuTypeNode = APIHandleKey;
pub type MuFuncSigNode= APIHandleKey;
pub type MuConstNode = APIHandleKey;
pub type MuGlobalNode = APIHandleKey;
pub type MuFuncNode = APIHandleKey;
pub type MuFuncVerNode= APIHandleKey;
pub type MuBBNode = APIHandleKey;
pub type MuNorParamNode = APIHandleKey;
pub type MuExcParamNode = APIHandleKey;
pub type MuInstNode = APIHandleKey;
pub type MuInstResNode = APIHandleKey;
pub type MuLocalVarNode = APIHandleKey;
pub type MuVarNode = APIHandleKey;
pub type MuFlag = usize;
pub type MuDestKind = MuFlag;
......
This diff is collapsed.
......@@ -23,7 +23,7 @@ mod deps {
}
#[derive(Debug)]
pub struct APIMuValue {
pub struct APIHandleKey {
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::APIMuValue;
pub use ast::bundle::APIHandleKey;
extern crate ast;
}
......
......@@ -169,7 +169,7 @@ def to_high_level_ret_ty(cty, rty):
if cty in _cty_to_high_level_ret_ty:
hlt = _cty_to_high_level_ret_ty[cty]
elif cty_is_handle(cty):
hlt = "*const APIMuValue"
hlt = "*const APIHandleKey"
elif cty_is_node(cty):
hlt = "MuID"
else:
......@@ -262,7 +262,7 @@ def generate_forwarder_and_stub(st, meth) -> Tuple[str, str]:
if cty_is_handle(c_base_ty):
converter = "from_handle_array({}, {})".format(
rpn, sz_rpn)
stub_rty = "Vec<&APIMuValue>"
stub_rty = "Vec<&APIHandleKey>"
elif cty_is_node(c_base_ty) or c_base_ty == "MuID":
converter = "from_MuID_array({}, {})".format(
rpn, sz_rpn)
......@@ -279,7 +279,7 @@ def generate_forwarder_and_stub(st, meth) -> Tuple[str, str]:
if cty_is_handle(cty):
converter = "from_handle_optional({})".format(rpn)
stub_rty = "Option<&APIMuValue>"
stub_rty = "Option<&APIHandleKey>"
elif cty_is_node(cty):
converter = "from_MuID_optional({})".format(rpn)
stub_rty = "Option<MuID>"
......@@ -296,7 +296,7 @@ def generate_forwarder_and_stub(st, meth) -> Tuple[str, str]:
stub_rty = to_rust_type(c_base_ty)
elif cty_is_handle(cty):
converter = "from_handle({})".format(rpn)
stub_rty = "&APIMuValue"
stub_rty = "&APIHandleKey"
elif cty_is_node(cty):
converter = "from_MuID({})".format(rpn)
stub_rty = "MuID"
......
......@@ -777,7 +777,6 @@ fn coalesce_branch2_moves() -> VM {
ssa! ((vm, coalesce_branch2_moves_v1) <int64> arg4);
ssa! ((vm, coalesce_branch2_moves_v1) <int64> arg5);
block! ((vm, coalesce_branch2_moves_v1) blk1);
ssa! ((vm, coalesce_branch2_moves_v1) <int1> cond);
inst! ((vm, coalesce_branch2_moves_v1) blk_entry_cmp:
cond = CMPOP (CmpOp::EQ) arg4 arg5
......
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