Simplify Refcounting

Instead of -max_size to -1 for regular refcounts, use 1 to max_size.
0 still means constant refcount.
The highest bit is used to signify atomic refcounting required.
This does not turn on any sort of atomic refcounting.
This commit is contained in:
Brendan Hansknecht 2024-12-31 17:35:46 -08:00
parent 8001de5468
commit 4b8693537a
No known key found for this signature in database
GPG key ID: 0EA784685083E75B
15 changed files with 57 additions and 84 deletions

View file

@ -77,12 +77,8 @@ impl<'ctx> PointerToRefcount<'ctx> {
pub fn is_1<'a, 'env>(&self, env: &Env<'a, 'ctx, 'env>) -> IntValue<'ctx> {
let current = self.get_refcount(env);
let one = match env.target.ptr_width() {
roc_target::PtrWidth::Bytes4 => {
env.context.i32_type().const_int(i32::MIN as u64, false)
}
roc_target::PtrWidth::Bytes8 => {
env.context.i64_type().const_int(i64::MIN as u64, false)
}
roc_target::PtrWidth::Bytes4 => env.context.i32_type().const_int(1_u64, false),
roc_target::PtrWidth::Bytes8 => env.context.i64_type().const_int(1_u64, false),
};
env.builder