mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
higher alignment requirement on rocstr/roclist
This commit is contained in:
parent
6beff62ece
commit
1d17a21d1f
3 changed files with 12 additions and 8 deletions
|
@ -1151,10 +1151,13 @@ impl<'a> Builtin<'a> {
|
|||
Float64 => align_of::<f64>() as u32,
|
||||
Float32 => align_of::<f32>() as u32,
|
||||
Float16 => align_of::<i16>() as u32,
|
||||
Str | EmptyStr => pointer_size,
|
||||
Dict(_, _) | EmptyDict => pointer_size,
|
||||
Set(_) | EmptySet => pointer_size,
|
||||
List(_) | EmptyList => pointer_size,
|
||||
// we often treat these as i128 (64-bit systems)
|
||||
// or i64 (32-bit systems). For that to be safe
|
||||
// they must be aligned to allow such access
|
||||
List(_) | EmptyList => 2 * pointer_size,
|
||||
Str | EmptyStr => 2 * pointer_size,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1240,9 +1243,10 @@ impl<'a> Builtin<'a> {
|
|||
Builtin::Str => pointer_size,
|
||||
Builtin::Dict(k, v) => k
|
||||
.alignment_bytes(pointer_size)
|
||||
.max(v.alignment_bytes(pointer_size)),
|
||||
Builtin::Set(k) => k.alignment_bytes(pointer_size),
|
||||
Builtin::List(e) => e.alignment_bytes(pointer_size),
|
||||
.max(v.alignment_bytes(pointer_size))
|
||||
.max(pointer_size),
|
||||
Builtin::Set(k) => k.alignment_bytes(pointer_size).max(pointer_size),
|
||||
Builtin::List(e) => e.alignment_bytes(pointer_size).max(pointer_size),
|
||||
Builtin::EmptyStr | Builtin::EmptyList | Builtin::EmptyDict | Builtin::EmptySet => {
|
||||
unreachable!("not heap-allocated")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue