mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
Store capacity in unique list
This commit is contained in:
parent
4e7aecc434
commit
9351746952
1 changed files with 10 additions and 5 deletions
|
@ -1701,11 +1701,16 @@ pub fn allocate_list<'a, 'ctx, 'env>(
|
||||||
"make ptr",
|
"make ptr",
|
||||||
);
|
);
|
||||||
|
|
||||||
// the refcount of a new list is initially 1
|
let ref_count_one = match inplace {
|
||||||
// we assume that the list is indeed used (dead variables are eliminated)
|
InPlace::InPlace => length,
|
||||||
let ref_count_one = ctx
|
InPlace::Clone => {
|
||||||
.i64_type()
|
// the refcount of a new list is initially 1
|
||||||
.const_int(crate::llvm::refcounting::REFCOUNT_1 as _, false);
|
// we assume that the list is indeed used (dead variables are eliminated)
|
||||||
|
ctx.i64_type()
|
||||||
|
.const_int(crate::llvm::refcounting::REFCOUNT_1 as _, false)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
builder.build_store(refcount_ptr, ref_count_one);
|
builder.build_store(refcount_ptr, ref_count_one);
|
||||||
|
|
||||||
list_element_ptr
|
list_element_ptr
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue