mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 06:05:58 -06:00
[GH-ISSUE #278] HeapImp.h: static_assert may fail with regard to BlkPrefix and DLink sizes #86
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/ultimatepp#86
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @barracuda156 on GitHub (Jun 6, 2025).
Original GitHub issue: https://github.com/ultimatepp/ultimatepp/issues/278
Could someone say if exact sizes of these structs are critical or not?
For the first look it does not seem that anything actually requires them to be exactly 64 and 16. But if it is important, I will try to find a way to fit sizes to what is expected.
@mirek-fidler commented on GitHub (Jun 10, 2025):
They are critical.
U++ heap is designed around enconding one critical bit into heap block address (it is basically a bit that tells MemoryFree whether the block is "small" or "large"). Those sizeofs are required to maintain correct alignement for all that to work.
@barracuda156 commented on GitHub (Jun 10, 2025):
There are perhaps two typical reasons for sizes to differ: either some struct uses bool, assuming it must be 1 byte, while it is not on ppc (32-bit ABI has 4-byte bool), or assumptions on type alignments are wrong (this might be remedied with a flag, to switch from “natural” to “power” alignment, for example). Or maybe rearrange some members inside those.
I can try a possible fix, if any idea comes to mind.
@mirek-fidler commented on GitHub (Jun 10, 2025):
Hey, admittedly, puting bool there is a mistake. I think byte will work
just as well, without changing anything in the code.
That said, this is what the assert was for - and it worked.
If you can test bool / byte, I will be glag to replace it.
(BTW, what exotic architecture are you playing with? :)
On Tue, Jun 10, 2025 at 2:21 PM Sergey Fedorov @.***>
wrote:
@barracuda156 commented on GitHub (Jun 10, 2025):
powerpc-apple-darwin :)
I think Apple made size of bool 4 bytes in 32-bit ABI to retain compatibility with old code inherited from m68k. In ppc64 ABI bool is the standard 1 byte (but there are other pains with ppc64).
I will try if replacement with byte works.