psyqo: align TexInfo and PageInfo to 32 bits - #2067
Open
nicolasnoble wants to merge 1 commit into
Open
Conversation
Both are four bytes but only two-byte aligned, since their members are two uint8_t followed by a 16-bit type. The size static_assert never caught it. Copying one is a whole-word move on paper, but the compiler cannot prove the alignment, so it splits into two lhu and two sh - four memory accesses where two would do, in the per-glyph path of every innerprint variant. Aligning them to uint32_t restores the single lw/sw. No layout change: both already sat at word-aligned offsets inside every primitive that carries them, and sizeof is unchanged. Adds the matching alignof assertions so this cannot regress silently. Signed-off-by: Nicolas 'Pixel' Noble <nicolas@nobis-crew.org>
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe change explicitly aligns ChangesPrimitive structure alignment
Estimated code review effort: 1 (Trivial) | ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Both are four bytes wide but only two-byte aligned - their
sizeofassert never checked that. So copying one splits intolhu/lhu/sh/shinstead oflw/sw, four memory accesses per glyph inFontBaseinstead of two.alignas(uint32_t)fixes it: 71 halfword loads down to 65 inlibpsyqo.a, all six in the glyph path, no newlwl/lwr,.text88 bytes smaller. Neither type moves - both already sat at word-aligned offsets in every primitive that embeds them.