mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
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:
parent
8001de5468
commit
4b8693537a
15 changed files with 57 additions and 84 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue