Unnecessary padding between tag union payload and discriminant #7171
Labels
enhancement
New feature or request
intermediate issue
Likely good for someone who has completed a few other issues
In a non-recursive tag union layout, the discriminant deliberately comes after the payload in memory. This is to allow it to be placed in what might otherwise become padding. According to
roc glue
, this optimization is not currently taking place. Given the following glue platform:The following shape is emitted by the glue platform for
mainForHost
:Ideally
discriminantOffset
should equal 3, as that byte is now unnecessarily used as padding. This bug does not break anything, but it is a missed optimization.The text was updated successfully, but these errors were encountered: