mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
make dbg transparent to refcounting
This commit is contained in:
parent
1286878d39
commit
f76df8a356
10 changed files with 215 additions and 28 deletions
|
@ -191,6 +191,27 @@ fn function_s<'a, 'i>(
|
|||
}
|
||||
}
|
||||
|
||||
Dbg {
|
||||
symbol,
|
||||
variable,
|
||||
remainder,
|
||||
} => {
|
||||
let continuation: &Stmt = remainder;
|
||||
let new_continuation = function_s(env, w, c, continuation);
|
||||
|
||||
if std::ptr::eq(continuation, new_continuation) || continuation == new_continuation {
|
||||
stmt
|
||||
} else {
|
||||
let new_refcounting = Dbg {
|
||||
symbol: *symbol,
|
||||
variable: *variable,
|
||||
remainder: new_continuation,
|
||||
};
|
||||
|
||||
arena.alloc(new_refcounting)
|
||||
}
|
||||
}
|
||||
|
||||
Expect {
|
||||
condition,
|
||||
region,
|
||||
|
@ -438,6 +459,34 @@ fn function_d_main<'a, 'i>(
|
|||
}
|
||||
}
|
||||
|
||||
Dbg {
|
||||
symbol,
|
||||
variable,
|
||||
remainder,
|
||||
} => {
|
||||
let (b, found) = function_d_main(env, x, c, remainder);
|
||||
|
||||
if found || *symbol != x {
|
||||
let refcounting = Dbg {
|
||||
symbol: *symbol,
|
||||
variable: *variable,
|
||||
remainder: b,
|
||||
};
|
||||
|
||||
(arena.alloc(refcounting), found)
|
||||
} else {
|
||||
let b = try_function_s(env, x, c, b);
|
||||
|
||||
let refcounting = Dbg {
|
||||
symbol: *symbol,
|
||||
variable: *variable,
|
||||
remainder: b,
|
||||
};
|
||||
|
||||
(arena.alloc(refcounting), found)
|
||||
}
|
||||
}
|
||||
|
||||
Expect {
|
||||
condition,
|
||||
region,
|
||||
|
@ -656,6 +705,22 @@ fn function_r<'a, 'i>(env: &mut Env<'a, 'i>, stmt: &'a Stmt<'a>) -> &'a Stmt<'a>
|
|||
arena.alloc(Refcounting(*modify_rc, b))
|
||||
}
|
||||
|
||||
Dbg {
|
||||
symbol,
|
||||
variable,
|
||||
remainder,
|
||||
} => {
|
||||
let b = function_r(env, remainder);
|
||||
|
||||
let expect = Dbg {
|
||||
symbol: *symbol,
|
||||
variable: *variable,
|
||||
remainder: b,
|
||||
};
|
||||
|
||||
arena.alloc(expect)
|
||||
}
|
||||
|
||||
Expect {
|
||||
condition,
|
||||
region,
|
||||
|
@ -726,6 +791,9 @@ fn has_live_var<'a>(jp_live_vars: &JPLiveVarMap, stmt: &'a Stmt<'a>, needle: Sym
|
|||
Refcounting(modify_rc, cont) => {
|
||||
modify_rc.get_symbol() == needle || has_live_var(jp_live_vars, cont, needle)
|
||||
}
|
||||
Dbg {
|
||||
symbol, remainder, ..
|
||||
} => *symbol == needle || has_live_var(jp_live_vars, remainder, needle),
|
||||
Expect {
|
||||
condition,
|
||||
remainder,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue