mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-18 20:15:05 +00:00
correct pointer alignment on decref
This commit is contained in:
parent
d4b86a745b
commit
4e8f916204
1 changed files with 5 additions and 1 deletions
|
@ -337,7 +337,7 @@ inline fn free_ptr_to_refcount(
|
|||
|
||||
inline fn decref_ptr_to_refcount(
|
||||
refcount_ptr: [*]isize,
|
||||
alignment: u32,
|
||||
element_alignment: u32,
|
||||
elements_refcounted: bool,
|
||||
) void {
|
||||
if (RC_TYPE == Refcount.none) return;
|
||||
|
@ -346,6 +346,10 @@ inline fn decref_ptr_to_refcount(
|
|||
std.debug.print("| decrement {*}: ", .{refcount_ptr});
|
||||
}
|
||||
|
||||
// Due to RC alignmen tmust take into acount pointer size.
|
||||
const ptr_width = @sizeOf(usize);
|
||||
const alignment = @max(ptr_width, element_alignment);
|
||||
|
||||
// Ensure that the refcount is not whole program lifetime.
|
||||
const refcount: isize = refcount_ptr[0];
|
||||
if (refcount != REFCOUNT_MAX_ISIZE) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue