mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-22 19:42:31 +00:00
use Box instead of a tag to read the refcount
This commit is contained in:
parent
ca7ba45955
commit
a61e7a696d
2 changed files with 86 additions and 30 deletions
|
@ -41,6 +41,10 @@ impl HelperOp {
|
|||
fn is_decref(&self) -> bool {
|
||||
matches!(self, Self::DecRef(_))
|
||||
}
|
||||
|
||||
fn is_dec(&self) -> bool {
|
||||
matches!(self, Self::Dec)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -81,7 +85,6 @@ pub struct CodeGenHelp<'a> {
|
|||
home: ModuleId,
|
||||
target_info: TargetInfo,
|
||||
layout_isize: InLayout<'a>,
|
||||
union_refcount: UnionLayout<'a>,
|
||||
specializations: Vec<'a, Specialization<'a>>,
|
||||
debug_recursion_depth: usize,
|
||||
}
|
||||
|
@ -90,15 +93,11 @@ impl<'a> CodeGenHelp<'a> {
|
|||
pub fn new(arena: &'a Bump, target_info: TargetInfo, home: ModuleId) -> Self {
|
||||
let layout_isize = Layout::isize(target_info);
|
||||
|
||||
// Refcount is a boxed isize. TODO: use the new Box layout when dev backends support it
|
||||
let union_refcount = UnionLayout::NonNullableUnwrapped(arena.alloc([layout_isize]));
|
||||
|
||||
CodeGenHelp {
|
||||
arena,
|
||||
home,
|
||||
target_info,
|
||||
layout_isize,
|
||||
union_refcount,
|
||||
specializations: Vec::with_capacity_in(16, arena),
|
||||
debug_recursion_depth: 0,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue