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",
|
||||
);
|
||||
|
||||
// the refcount of a new list is initially 1
|
||||
// we assume that the list is indeed used (dead variables are eliminated)
|
||||
let ref_count_one = ctx
|
||||
.i64_type()
|
||||
.const_int(crate::llvm::refcounting::REFCOUNT_1 as _, false);
|
||||
let ref_count_one = match inplace {
|
||||
InPlace::InPlace => length,
|
||||
InPlace::Clone => {
|
||||
// the refcount of a new list is initially 1
|
||||
// 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);
|
||||
|
||||
list_element_ptr
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue