This commit is contained in:
Folkert 2021-09-11 13:56:06 +02:00
parent eeb3c26e16
commit cf5bb7ae6e
2 changed files with 3 additions and 31 deletions

View file

@ -2304,32 +2304,6 @@ fn list_literal<'a, 'ctx, 'env>(
}
}
fn decrement_with_size_check<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
parent: FunctionValue<'ctx>,
size: IntValue<'ctx>,
layout: Layout<'a>,
refcount_ptr: PointerToRefcount<'ctx>,
) {
let not_empty = env.context.append_basic_block(parent, "not_null");
let done = env.context.append_basic_block(parent, "done");
let is_empty =
env.builder
.build_int_compare(IntPredicate::EQ, size, size.get_type().const_zero(), "");
env.builder
.build_conditional_branch(is_empty, done, not_empty);
env.builder.position_at_end(not_empty);
refcount_ptr.decrement(env, &layout);
env.builder.build_unconditional_branch(done);
env.builder.position_at_end(done);
}
pub fn build_exp_stmt<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
layout_ids: &mut LayoutIds<'a>,

View file

@ -84,7 +84,7 @@ impl<'ctx> PointerToRefcount<'ctx> {
}
}
pub fn from_list_wrapper(env: &Env<'_, 'ctx, '_>, list_wrapper: StructValue<'ctx>) -> Self {
fn from_list_wrapper(env: &Env<'_, 'ctx, '_>, list_wrapper: StructValue<'ctx>) -> Self {
let data_ptr = env
.builder
.build_extract_value(list_wrapper, Builtin::WRAPPER_PTR, "read_list_ptr")
@ -1125,7 +1125,6 @@ fn build_rec_union_help<'a, 'ctx, 'env>(
fn_val: FunctionValue<'ctx>,
) {
let tags = union_layout_tags(env.arena, &union_layout);
let is_nullable = union_layout.is_nullable();
debug_assert!(!tags.is_empty());
let context = &env.context;
@ -1158,7 +1157,7 @@ fn build_rec_union_help<'a, 'ctx, 'env>(
let should_recurse_block = env.context.append_basic_block(parent, "should_recurse");
let ctx = env.context;
if is_nullable {
if union_layout.is_nullable() {
let is_null = env.builder.build_is_null(value_ptr, "is_null");
let then_block = ctx.append_basic_block(parent, "then");
@ -1466,7 +1465,6 @@ fn build_reuse_rec_union_help<'a, 'ctx, 'env>(
dec_function: FunctionValue<'ctx>,
) {
let tags = union_layout_tags(env.arena, &union_layout);
let is_nullable = union_layout.is_nullable();
debug_assert!(!tags.is_empty());
@ -1500,7 +1498,7 @@ fn build_reuse_rec_union_help<'a, 'ctx, 'env>(
let should_recurse_block = env.context.append_basic_block(parent, "should_recurse");
let ctx = env.context;
if is_nullable {
if union_layout.is_nullable() {
let is_null = env.builder.build_is_null(value_ptr, "is_null");
let then_block = ctx.append_basic_block(parent, "then");