mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
remove Jump/Label from mono::Expr
This commit is contained in:
parent
958f3f9ad4
commit
39fb78b2d5
3 changed files with 10 additions and 9 deletions
|
@ -1075,10 +1075,15 @@ fn decide_to_branching<'a>(
|
||||||
use Choice::*;
|
use Choice::*;
|
||||||
use Decider::*;
|
use Decider::*;
|
||||||
|
|
||||||
let jump_count = *env.jump_counter;
|
|
||||||
|
|
||||||
match decider {
|
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),
|
Leaf(Inline(stores, expr)) => (stores, expr),
|
||||||
Chain {
|
Chain {
|
||||||
test_chain,
|
test_chain,
|
||||||
|
|
|
@ -201,9 +201,6 @@ pub enum Expr<'a> {
|
||||||
elems: &'a [Expr<'a>],
|
elems: &'a [Expr<'a>],
|
||||||
},
|
},
|
||||||
|
|
||||||
Label(u64, &'a Expr<'a>),
|
|
||||||
Jump(u64),
|
|
||||||
|
|
||||||
RuntimeError(&'a str),
|
RuntimeError(&'a str),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ mod test_opt {
|
||||||
) {
|
) {
|
||||||
match expr {
|
match expr {
|
||||||
Int(_) | Float(_) | Str(_) | Bool(_) | Byte(_) | Load(_) | FunctionPointer(_)
|
Int(_) | Float(_) | Str(_) | Bool(_) | Byte(_) | Load(_) | FunctionPointer(_)
|
||||||
| Jump(_) | RuntimeError(_) => (),
|
| RuntimeError(_) => (),
|
||||||
|
|
||||||
Store(paths, sub_expr) => {
|
Store(paths, sub_expr) => {
|
||||||
for (_, _, path_expr) in paths.iter() {
|
for (_, _, path_expr) in paths.iter() {
|
||||||
|
@ -160,8 +160,7 @@ mod test_opt {
|
||||||
field_layouts: _,
|
field_layouts: _,
|
||||||
expr: sub_expr,
|
expr: sub_expr,
|
||||||
is_unwrapped: _,
|
is_unwrapped: _,
|
||||||
}
|
} => {
|
||||||
| Label(_, sub_expr) => {
|
|
||||||
extract_named_calls_help(sub_expr, calls, unexpected_calls);
|
extract_named_calls_help(sub_expr, calls, unexpected_calls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue