pub enum Value {
Known(usize),
Unknown,
}
Expand description
An abstract value is either a known constant, or an unknown (i.e. arbitrary value).
Variants§
Implementations§
source§impl Value
impl Value
sourcepub fn merge(self, other: Value) -> Value
pub fn merge(self, other: Value) -> Value
Examples found in repository?
src/cfa.rs (line 187)
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
fn merge(&mut self, other: Self) -> bool {
if self.is_bottom() {
if !other.is_bottom() {
*self = other;
return true;
}
} else if !other.is_bottom() {
if self.stack != other.stack {
let s_len = self.stack.as_ref().unwrap().len();
let o_len = other.stack.as_ref().unwrap().len();
// Determine height of new stack
let m = cmp::min(s_len,o_len);
// Construct a new stack
let mut nstack = Vec::new();
// Perform stack merge
for i in (0..m).rev() {
let l = self.peek(i);
let r = other.peek(i);
nstack.push(l.merge(r));
}
// Update me
*self = CfaState{stack:Some(nstack)}
}
}
//
false
}