Merge pull request #2071 from rtfeldman/refcount-mono-ir

Start generating refcounting code as mono IR
This commit is contained in:
Brian Carroll 2021-12-01 12:59:16 +00:00 committed by GitHub
commit a3827d6636
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 726 additions and 209 deletions

View file

@ -6038,6 +6038,10 @@ fn run_low_level<'a, 'ctx, 'env>(
| ListAny | ListAll | ListFindUnsafe | DictWalk => {
unreachable!("these are higher order, and are handled elsewhere")
}
RefCountGetPtr | RefCountInc | RefCountDec => {
unreachable!("LLVM backend does not use lowlevels for refcounting");
}
}
}

View file

@ -19,6 +19,8 @@ use roc_module::symbol::Interns;
use roc_module::symbol::Symbol;
use roc_mono::layout::{Builtin, Layout, LayoutIds, UnionLayout};
/// "Infinite" reference count, for static values
/// Ref counts are encoded as negative numbers where isize::MIN represents 1
pub const REFCOUNT_MAX: usize = 0_usize;
pub fn refcount_1(ctx: &Context, ptr_bytes: u32) -> IntValue<'_> {