mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
refactor
This commit is contained in:
parent
1d8a475ac6
commit
ac75badbe4
1 changed files with 23 additions and 12 deletions
|
@ -220,25 +220,36 @@ impl<'ctx> PointerToRefcount<'ctx> {
|
||||||
|
|
||||||
debug_info_init!(env, parent);
|
debug_info_init!(env, parent);
|
||||||
|
|
||||||
let alignment = env.context.i32_type().const_int(alignment as _, false);
|
decref_pointer(
|
||||||
|
|
||||||
call_void_bitcode_fn(
|
|
||||||
env,
|
env,
|
||||||
&[
|
parent.get_nth_param(0).unwrap().into_pointer_value(),
|
||||||
env.builder.build_bitcast(
|
alignment,
|
||||||
parent.get_nth_param(0).unwrap(),
|
|
||||||
env.ptr_int().ptr_type(AddressSpace::Generic),
|
|
||||||
"foo",
|
|
||||||
),
|
|
||||||
alignment.into(),
|
|
||||||
],
|
|
||||||
roc_builtins::bitcode::UTILS_DECREF,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
builder.build_return(None);
|
builder.build_return(None);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn decref_pointer<'a, 'ctx, 'env>(
|
||||||
|
env: &Env<'a, 'ctx, 'env>,
|
||||||
|
pointer: PointerValue<'ctx>,
|
||||||
|
alignment: u32,
|
||||||
|
) {
|
||||||
|
let alignment = env.context.i32_type().const_int(alignment as _, false);
|
||||||
|
call_void_bitcode_fn(
|
||||||
|
env,
|
||||||
|
&[
|
||||||
|
env.builder.build_bitcast(
|
||||||
|
pointer,
|
||||||
|
env.ptr_int().ptr_type(AddressSpace::Generic),
|
||||||
|
"to_isize_ptr",
|
||||||
|
),
|
||||||
|
alignment.into(),
|
||||||
|
],
|
||||||
|
roc_builtins::bitcode::UTILS_DECREF,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
fn modify_refcount_struct<'a, 'ctx, 'env>(
|
fn modify_refcount_struct<'a, 'ctx, 'env>(
|
||||||
env: &Env<'a, 'ctx, 'env>,
|
env: &Env<'a, 'ctx, 'env>,
|
||||||
layout_ids: &mut LayoutIds<'a>,
|
layout_ids: &mut LayoutIds<'a>,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue