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.

Commit 932edcd4 authored by qinsoon's avatar qinsoon
Browse files

during inlining, when copying insturciton, every instruction gets a new

MuID
parent c5c2ceff
......@@ -68,6 +68,13 @@ impl Clone for Instruction {
}
impl Instruction {
pub fn clone_with_id(&self, new_id: MuID) -> Instruction {
let mut clone = self.clone();
clone.hdr = self.hdr.clone_with_id(new_id);
clone
}
pub fn has_exception_clause(&self) -> bool {
ir_semantics::is_potentially_excepting_instruction(&self.v)
}
......
......@@ -1185,6 +1185,13 @@ impl MuEntityHeader {
None => None
}
}
pub fn clone_with_id(&self, new_id: MuID) -> MuEntityHeader {
let mut clone = self.clone();
clone.id = new_id;
clone
}
}
impl PartialEq for MuEntityHeader {
......
......@@ -331,13 +331,21 @@ fn copy_inline_blocks(caller: &mut Vec<Block>, ret_block: MuID, callee: &Functio
{
let block_content = block.content.as_mut().unwrap();
let last_inst = block_content.body.pop().unwrap();
let last_inst_clone = last_inst.clone();
// every inst should have a unique ID
let inst_new_id = vm.next_id();
let last_inst_clone = match last_inst.v {
TreeNode_::Instruction(ref inst) => {
TreeNode::new_boxed_inst(inst.clone_with_id(inst_new_id))
}
_ => panic!("expect instruction as block body")
};
match last_inst.v {
TreeNode_::Instruction(inst) => {
trace!("last instruction: {}", inst);
let hdr = inst.hdr;
let hdr = inst.hdr.clone_with_id(inst_new_id);
let value = inst.value;
let ops = inst.ops;
let v = inst.v;
......
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