From 5be79e8658ac1a3c3eb7e3896b80624a72a74ed5 Mon Sep 17 00:00:00 2001 From: Kunshan Wang Date: Tue, 8 Nov 2016 16:23:36 +1100 Subject: [PATCH] IRBuilder: const extern, ExptCCall --- src/vm/api/api_impl/muirbuilder.rs | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/vm/api/api_impl/muirbuilder.rs b/src/vm/api/api_impl/muirbuilder.rs index 8a106db4..b7dae756 100644 --- a/src/vm/api/api_impl/muirbuilder.rs +++ b/src/vm/api/api_impl/muirbuilder.rs @@ -1031,26 +1031,31 @@ impl<'lb, 'lvm> BundleLoader<'lb, 'lvm> { let hdr = self.make_mu_entity_header(id); let (impl_con, impl_ty) = match **con { - NodeConst::ConstInt { id: _, ty: ty, value: value } => { + NodeConst::ConstInt { id: _, ty, value } => { let t = self.ensure_type_rec(ty); let c = Constant::Int(value); (c, t) }, - NodeConst::ConstFloat { id: _, ty: ty, value: value } => { + NodeConst::ConstFloat { id: _, ty, value } => { let t = self.ensure_type_rec(ty); let c = Constant::Float(value); (c, t) }, - NodeConst::ConstDouble { id: _, ty: ty, value: value } => { + NodeConst::ConstDouble { id: _, ty, value } => { let t = self.ensure_type_rec(ty); let c = Constant::Double(value); (c, t) }, - NodeConst::ConstNull { id: _, ty: ty } => { + NodeConst::ConstNull { id: _, ty } => { let t = self.ensure_type_rec(ty); let c = Constant::NullRef; (c, t) }, + NodeConst::ConstExtern { id: _, ty, ref symbol } => { + let t = self.ensure_type_rec(ty); + let c = Constant::ExternSym(symbol.clone()); + (c, t) + }, ref c => panic!("{:?} not implemented", c), }; @@ -1766,16 +1771,20 @@ impl<'lb, 'lvm> BundleLoader<'lb, 'lvm> { } } else { // non-terminating inst - if is_ccall { - warn!("Using ExprCall for non-terminating C call") - } Instruction { hdr: hdr, value: Some(rvs), ops: RwLock::new(ops), - v: Instruction_::ExprCall { - data: call_data, - is_abort: false, + v: if is_ccall { + Instruction_::ExprCCall { + data: call_data, + is_abort: false, + } + } else { + Instruction_::ExprCall { + data: call_data, + is_abort: false, + } }, } } -- 2.21.0