| ... | @@ -3458,12 +3458,21 @@ pub const Type = extern union { | ... | @@ -3458,12 +3458,21 @@ pub const Type = extern union { |
| 3458 | else => {}, | 3458 | else => {}, |
| 3459 | } | 3459 | } |
| 3460 | | 3460 | |
| | 3461 | const payload_size = switch (try child_type.abiSizeAdvanced(target, strat)) { |
| | 3462 | .scalar => |elem_size| elem_size, |
| | 3463 | .val => switch (strat) { |
| | 3464 | .sema_kit => unreachable, |
| | 3465 | .eager => unreachable, |
| | 3466 | .lazy => |arena| return AbiSizeAdvanced{ .val = try Value.Tag.lazy_size.create(arena, ty) }, |
| | 3467 | }, |
| | 3468 | }; |
| | 3469 | |
| 3461 | // Optional types are represented as a struct with the child type as the first | 3470 | // Optional types are represented as a struct with the child type as the first |
| 3462 | // field and a boolean as the second. Since the child type's abi alignment is | 3471 | // field and a boolean as the second. Since the child type's abi alignment is |
| 3463 | // guaranteed to be >= that of bool's (1 byte) the added size is exactly equal | 3472 | // guaranteed to be >= that of bool's (1 byte) the added size is exactly equal |
| 3464 | // to the child type's ABI alignment. | 3473 | // to the child type's ABI alignment. |
| 3465 | return AbiSizeAdvanced{ | 3474 | return AbiSizeAdvanced{ |
| 3466 | .scalar = child_type.abiAlignment(target) + child_type.abiSize(target), | 3475 | .scalar = child_type.abiAlignment(target) + payload_size, |
| 3467 | }; | 3476 | }; |
| 3468 | }, | 3477 | }, |
| 3469 | | 3478 | |
| ... | @@ -3478,7 +3487,14 @@ pub const Type = extern union { | ... | @@ -3478,7 +3487,14 @@ pub const Type = extern union { |
| 3478 | } | 3487 | } |
| 3479 | const code_align = abiAlignment(Type.anyerror, target); | 3488 | const code_align = abiAlignment(Type.anyerror, target); |
| 3480 | const payload_align = abiAlignment(data.payload, target); | 3489 | const payload_align = abiAlignment(data.payload, target); |
| 3481 | const payload_size = abiSize(data.payload, target); | 3490 | const payload_size = switch (try data.payload.abiSizeAdvanced(target, strat)) { |
| | 3491 | .scalar => |elem_size| elem_size, |
| | 3492 | .val => switch (strat) { |
| | 3493 | .sema_kit => unreachable, |
| | 3494 | .eager => unreachable, |
| | 3495 | .lazy => |arena| return AbiSizeAdvanced{ .val = try Value.Tag.lazy_size.create(arena, ty) }, |
| | 3496 | }, |
| | 3497 | }; |
| 3482 | | 3498 | |
| 3483 | var size: u64 = 0; | 3499 | var size: u64 = 0; |
| 3484 | if (code_align > payload_align) { | 3500 | if (code_align > payload_align) { |