mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
Merge remote-tracking branch 'origin/trunk' into tag-alignment
This commit is contained in:
commit
93c331e1aa
12 changed files with 324 additions and 144 deletions
|
@ -633,6 +633,23 @@ impl<'a> UnionLayout<'a> {
|
|||
round_up_to_alignment(data_width, data_align)
|
||||
}
|
||||
|
||||
pub fn tag_id_offset(&self, target_info: TargetInfo) -> Option<u32> {
|
||||
use UnionLayout::*;
|
||||
|
||||
if let NonNullableUnwrapped(_) | NullableUnwrapped { .. } = self {
|
||||
return None;
|
||||
}
|
||||
|
||||
let data_width = self.data_size_and_alignment_help_match(None, target_info).0;
|
||||
|
||||
// current, broken logic
|
||||
if data_width > 8 {
|
||||
Some(round_up_to_alignment(data_width, 8))
|
||||
} else {
|
||||
Some(data_width)
|
||||
}
|
||||
}
|
||||
|
||||
/// Very important to use this when doing a memcpy!
|
||||
fn stack_size_without_alignment(&self, target_info: TargetInfo) -> u32 {
|
||||
match self {
|
||||
|
@ -3055,7 +3072,9 @@ pub fn ext_var_is_empty_tag_union(subs: &Subs, ext_var: Variable) -> bool {
|
|||
// the ext_var is empty
|
||||
let mut ext_fields = std::vec::Vec::new();
|
||||
match roc_types::pretty_print::chase_ext_tag_union(subs, ext_var, &mut ext_fields) {
|
||||
Ok(()) | Err((_, Content::FlexVar(_) | Content::RigidVar(_))) => ext_fields.is_empty(),
|
||||
Ok(()) | Err((_, Content::FlexVar(_) | Content::RigidVar(_) | Content::Error)) => {
|
||||
ext_fields.is_empty()
|
||||
}
|
||||
Err(content) => panic!("invalid content in ext_var: {:?}", content),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue