Store capacity in unique list

This commit is contained in:
Chad Stearns 2020-09-13 14:56:01 -04:00
parent 4e7aecc434
commit 9351746952

View file

@ -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