From 8b42ed8764e4146c770b2015fbce89947d7670a0 Mon Sep 17 00:00:00 2001 From: Russel Arbore <russel.jma@gmail.com> Date: Tue, 29 Oct 2024 18:14:55 -0500 Subject: [PATCH] Get rid of force abort mechanism --- hercules_opt/src/editor.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/hercules_opt/src/editor.rs b/hercules_opt/src/editor.rs index 9f71991d..6b26e493 100644 --- a/hercules_opt/src/editor.rs +++ b/hercules_opt/src/editor.rs @@ -69,9 +69,6 @@ pub struct FunctionEdit<'a: 'b, 'b> { added_and_updated: BTreeMap<NodeID, Node>, // Compute a def-use map entries iteratively. updated_def_use: BTreeMap<NodeID, HashSet<NodeID>>, - // Technically client edit functions don't have to early exit, so explicitly - // keep track of if this edit should be aborted. - abort: bool, } impl<'a: 'b, 'b> FunctionEditor<'a> { @@ -106,7 +103,6 @@ impl<'a: 'b, 'b> FunctionEditor<'a> { added: HashSet::new(), added_and_updated: BTreeMap::new(), updated_def_use: BTreeMap::new(), - abort: false, }; if let Ok(populated_edit) = edit(edit_obj) { @@ -118,12 +114,7 @@ impl<'a: 'b, 'b> FunctionEditor<'a> { added, added_and_updated, updated_def_use, - abort, } = populated_edit; - if abort { - return false; - } - // Step 1: update the mutable def use map. for (u, new_users) in updated_def_use { // Go through new def-use entries in order. These are either @@ -185,6 +176,10 @@ impl<'a: 'b, 'b> FunctionEditor<'a> { self.mut_def_use[id.idx()].iter().map(|x| *x) } + pub fn is_mutable(&self, id: NodeID) -> bool { + self.mutable_nodes[id.idx()] + } + pub fn edits(self) -> Vec<Edit> { self.edits } @@ -239,7 +234,6 @@ impl<'a, 'b> FunctionEdit<'a, 'b> { self.deleted.insert(id); Ok(self) } else { - self.abort = true; Err(self) } } @@ -274,7 +268,6 @@ impl<'a, 'b> FunctionEdit<'a, 'b> { Ok(self) } else { - self.abort = true; Err(self) } } -- GitLab