diff --git a/crates/compiler/builtins/bitcode/src/utils.zig b/crates/compiler/builtins/bitcode/src/utils.zig index bda6ec69651..94e806d9740 100644 --- a/crates/compiler/builtins/bitcode/src/utils.zig +++ b/crates/compiler/builtins/bitcode/src/utils.zig @@ -267,9 +267,9 @@ pub fn freeDataPtrC( const masked_ptr = ptr & ~tag_mask; const isizes: [*]isize = @as([*]isize, @ptrFromInt(masked_ptr)); - const offset = @max(1, @divFloor(alignment, @sizeOf(usize))); - return freeRcPtrC(isizes - offset, alignment); + // we always store the refcount right before the data + return freeRcPtrC(isizes - 1, alignment); } pub fn freeRcPtrC( diff --git a/crates/compiler/gen_wasm/src/low_level.rs b/crates/compiler/gen_wasm/src/low_level.rs index 6d8e3f07e4c..63c42a64a2e 100644 --- a/crates/compiler/gen_wasm/src/low_level.rs +++ b/crates/compiler/gen_wasm/src/low_level.rs @@ -542,7 +542,7 @@ impl<'a> LowLevelCall<'a> { // Zig arguments Wasm types // (return pointer) i32 - // list: RocList i64, i32 + // list: RocList i32 // alignment: u32 i32 // element_width: usize i32 // update_mode: UpdateMode i32 @@ -564,7 +564,7 @@ impl<'a> LowLevelCall<'a> { backend.call_host_fn_after_loading_args( bitcode::LIST_RELEASE_EXCESS_CAPACITY, - 6, + 5, false, ); }