remove Jump/Label from mono::Expr

This commit is contained in:
Folkert 2020-03-24 00:11:02 +01:00
parent 958f3f9ad4
commit 39fb78b2d5
3 changed files with 10 additions and 9 deletions

View file

@ -1075,10 +1075,15 @@ fn decide_to_branching<'a>(
use Choice::*;
use Decider::*;
let jump_count = *env.jump_counter;
match decider {
Leaf(Jump(label)) => (&[], Expr::Jump(label + jump_count)),
Leaf(Jump(label)) => {
// we currently inline the jumps: does fewer jumps but produces a larger artifact
let (_, stores, expr) = jumps
.iter()
.find(|(l, _, _)| l == &label)
.expect("jump not in list of jumps");
(stores, expr.clone())
}
Leaf(Inline(stores, expr)) => (stores, expr),
Chain {
test_chain,

View file

@ -201,9 +201,6 @@ pub enum Expr<'a> {
elems: &'a [Expr<'a>],
},
Label(u64, &'a Expr<'a>),
Jump(u64),
RuntimeError(&'a str),
}

View file

@ -78,7 +78,7 @@ mod test_opt {
) {
match expr {
Int(_) | Float(_) | Str(_) | Bool(_) | Byte(_) | Load(_) | FunctionPointer(_)
| Jump(_) | RuntimeError(_) => (),
| RuntimeError(_) => (),
Store(paths, sub_expr) => {
for (_, _, path_expr) in paths.iter() {
@ -160,8 +160,7 @@ mod test_opt {
field_layouts: _,
expr: sub_expr,
is_unwrapped: _,
}
| Label(_, sub_expr) => {
} => {
extract_named_calls_help(sub_expr, calls, unexpected_calls);
}