use Box instead of a tag to read the refcount

This commit is contained in:
Folkert 2023-04-27 20:42:09 +02:00
parent ca7ba45955
commit a61e7a696d
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 86 additions and 30 deletions

View file

@ -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,
}