mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
round up alignment to ptr_bytes
This commit is contained in:
parent
fd026ee9d8
commit
e30893b66e
2 changed files with 3 additions and 3 deletions
|
@ -1067,7 +1067,7 @@ pub fn allocate_with_refcount_help<'a, 'ctx, 'env>(
|
||||||
let value_type = basic_type_from_layout(env.arena, ctx, layout, env.ptr_bytes);
|
let value_type = basic_type_from_layout(env.arena, ctx, layout, env.ptr_bytes);
|
||||||
let len_type = env.ptr_int();
|
let len_type = env.ptr_int();
|
||||||
|
|
||||||
let extra_bytes = layout.alignment_bytes(env.ptr_bytes);
|
let extra_bytes = layout.alignment_bytes(env.ptr_bytes).max(env.ptr_bytes);
|
||||||
|
|
||||||
let ptr = {
|
let ptr = {
|
||||||
// number of bytes we will allocated
|
// number of bytes we will allocated
|
||||||
|
@ -1097,7 +1097,7 @@ pub fn allocate_with_refcount_help<'a, 'ctx, 'env>(
|
||||||
let index = match extra_bytes {
|
let index = match extra_bytes {
|
||||||
n if n == env.ptr_bytes => 1,
|
n if n == env.ptr_bytes => 1,
|
||||||
n if n == 2 * env.ptr_bytes => 2,
|
n if n == 2 * env.ptr_bytes => 2,
|
||||||
_ => unreachable!("invalid extra_bytes"),
|
_ => unreachable!("invalid extra_bytes, {}", extra_bytes),
|
||||||
};
|
};
|
||||||
|
|
||||||
let index_intvalue = int_type.const_int(index, false);
|
let index_intvalue = int_type.const_int(index, false);
|
||||||
|
|
|
@ -133,7 +133,7 @@ impl<'ctx> PointerToRefcount<'ctx> {
|
||||||
let block = env.builder.get_insert_block().expect("to be in a function");
|
let block = env.builder.get_insert_block().expect("to be in a function");
|
||||||
let di_location = env.builder.get_current_debug_location().unwrap();
|
let di_location = env.builder.get_current_debug_location().unwrap();
|
||||||
|
|
||||||
let alignment = layout.alignment_bytes(env.ptr_bytes);
|
let alignment = layout.alignment_bytes(env.ptr_bytes).max(env.ptr_bytes);
|
||||||
|
|
||||||
let fn_name = &format!("decrement_refcounted_ptr_{}", alignment);
|
let fn_name = &format!("decrement_refcounted_ptr_{}", alignment);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue