mono: delete is_rc_implemented_yet, because everything is implemented!

This commit is contained in:
Brian Carroll 2023-01-24 22:22:19 +00:00 committed by Folkert
parent 212dfdf842
commit 7228502965
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 0 additions and 50 deletions

View file

@ -125,16 +125,6 @@ impl<'a> CodeGenHelp<'a> {
modify: &ModifyRc,
following: &'a Stmt<'a>,
) -> (&'a Stmt<'a>, Vec<'a, (Symbol, ProcLayout<'a>)>) {
if !refcount::is_rc_implemented_yet(layout_interner, layout) {
// Just a warning, so we can decouple backend development from refcounting development.
// When we are closer to completion, we can change it to a panic.
println!(
"WARNING! MEMORY LEAK! Refcounting not yet implemented for Layout {:?}",
layout
);
return (following, Vec::new_in(self.arena));
}
let op = match modify {
ModifyRc::Inc(..) => HelperOp::Inc,
ModifyRc::Dec(_) => HelperOp::Dec,

View file

@ -127,8 +127,6 @@ pub fn refcount_generic<'a>(
layout: InLayout<'a>,
structure: Symbol,
) -> Stmt<'a> {
debug_assert!(is_rc_implemented_yet(layout_interner, layout));
match layout_interner.get(layout) {
Layout::Builtin(Builtin::Int(_) | Builtin::Float(_) | Builtin::Bool | Builtin::Decimal) => {
// Generate a dummy function that immediately returns Unit
@ -416,44 +414,6 @@ pub fn refcount_reset_proc_body<'a>(
rc_ptr_stmt
}
// Check if refcounting is implemented yet. In the long term, this will be deleted.
// In the short term, it helps us to skip refcounting and let it leak, so we can make
// progress incrementally. Kept in sync with generate_procs using assertions.
pub fn is_rc_implemented_yet<'a, I>(interner: &I, layout: InLayout<'a>) -> bool
where
I: LayoutInterner<'a>,
{
use UnionLayout::*;
match interner.get(layout) {
Layout::Builtin(Builtin::List(elem_layout)) => is_rc_implemented_yet(interner, elem_layout),
Layout::Builtin(_) => true,
Layout::Struct { field_layouts, .. } => field_layouts
.iter()
.all(|l| is_rc_implemented_yet(interner, *l)),
Layout::Union(union_layout) => match union_layout {
NonRecursive(tags) => tags
.iter()
.all(|fields| fields.iter().all(|l| is_rc_implemented_yet(interner, *l))),
Recursive(tags) => tags
.iter()
.all(|fields| fields.iter().all(|l| is_rc_implemented_yet(interner, *l))),
NonNullableUnwrapped(fields) => {
fields.iter().all(|l| is_rc_implemented_yet(interner, *l))
}
NullableWrapped { other_tags, .. } => other_tags
.iter()
.all(|fields| fields.iter().all(|l| is_rc_implemented_yet(interner, *l))),
NullableUnwrapped { other_fields, .. } => other_fields
.iter()
.all(|l| is_rc_implemented_yet(interner, *l)),
},
Layout::LambdaSet(lambda_set) => is_rc_implemented_yet(interner, lambda_set.representation),
Layout::RecursivePointer(_) => true,
Layout::Boxed(_) => true,
}
}
fn rc_return_stmt<'a>(
root: &CodeGenHelp<'a>,
ident_ids: &mut IdentIds,