Skip to content

Commit

Permalink
we no longer care where a tag layout stores the tag id
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertdev committed Jun 27, 2023
1 parent e95d093 commit 48e6ef7
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions crates/compiler/mono/src/reset_reuse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,6 @@ Struct to to check whether two reuse layouts are interchangeable.
*/
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
struct TokenLayout {
has_tag: bool,
size: u32,
alignment: u32,
}
Expand Down Expand Up @@ -1416,16 +1415,6 @@ fn get_reuse_layout_info<'a, 'i>(
union_layout: UnionLayout<'a>,
) -> TokenLayout {
let (size, alignment) = union_layout.data_size_and_alignment(layout_interner);
let has_tag = match union_layout {
UnionLayout::NonRecursive(_) => unreachable!("Non recursive unions should not be reused."),
// The memory for union layouts that has a tag_id can be reused for new allocations with tag_id.
UnionLayout::Recursive(_) | UnionLayout::NullableWrapped { .. } => true,
// The memory for union layouts that have no tag_id can be reused for new allocations without tag_id
UnionLayout::NonNullableUnwrapped(_) | UnionLayout::NullableUnwrapped { .. } => false,
};
TokenLayout {
has_tag,
size,
alignment,
}

TokenLayout { size, alignment }
}

0 comments on commit 48e6ef7

Please sign in to comment.