From e0b5247f3ebb88a8e589ea335d23c97018a7d8b0 Mon Sep 17 00:00:00 2001 From: Brian Carroll Date: Wed, 25 Jan 2023 08:53:24 +0000 Subject: [PATCH] mono code_gen_help: decref should use element alignment, not List alignment --- crates/compiler/mono/src/code_gen_help/refcount.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/compiler/mono/src/code_gen_help/refcount.rs b/crates/compiler/mono/src/code_gen_help/refcount.rs index 8e01ea2f3e..b9f5b10030 100644 --- a/crates/compiler/mono/src/code_gen_help/refcount.rs +++ b/crates/compiler/mono/src/code_gen_help/refcount.rs @@ -74,7 +74,7 @@ pub fn refcount_stmt<'a>( ModifyRc::DecRef(structure) => { match layout_interner.get(layout) { - // Str has no children, so we might as well do what we normally do and call the helper. + // Str has no children, so Dec is the same as DecRef. Layout::Builtin(Builtin::Str) => { ctx.op = HelperOp::Dec; refcount_stmt( @@ -139,7 +139,6 @@ pub fn refcount_generic<'a>( ident_ids, ctx, layout_interner, - layout, elem_layout, structure, ), @@ -725,7 +724,6 @@ fn refcount_list<'a>( ident_ids: &mut IdentIds, ctx: &mut Context<'a>, layout_interner: &mut STLayoutInterner<'a>, - layout: InLayout, elem_layout: InLayout<'a>, structure: Symbol, ) -> Stmt<'a> { @@ -774,7 +772,7 @@ fn refcount_list<'a>( // let rc_ptr = root.create_symbol(ident_ids, "rc_ptr"); - let alignment = layout_interner.alignment_bytes(layout); + let elem_alignment = layout_interner.alignment_bytes(elem_layout); let ret_stmt = rc_return_stmt(root, ident_ids, ctx); let modify_list = modify_refcount( @@ -782,7 +780,7 @@ fn refcount_list<'a>( ident_ids, ctx, rc_ptr, - alignment, + elem_alignment, arena.alloc(ret_stmt), );