forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd4b538e
committed
Improve packing/alignment annotation for ItemPointerData.
We want this struct to be exactly a series of 3 int16 words, no moreand no less. Historically, at least, some ARM compilers preferred topad it to 8 bytes unless coerced. Our old way of doing that was justto use __attribute__((packed)), but as pointed out by Piotr Stefaniak,that does too much: it also licenses the compiler to give the structonly byte-alignment. We don't want that because it adds access overhead,possibly quite significant overhead. According to the GCC manual, whatwe want requires also specifying __attribute__((align(2))). It's notentirely clear if all the relevant compilers accept this pragma as well,but we can hope the buildfarm will tell us if not. We can also add astatic assertion that should fire if the compiler padded the struct.Since the combination of these pragmas should define exactly what wewant on any compiler that accepts them, let's try using them whereverwe think they exist, not only for __arm__. (This is likely to exposethat the conditional definitions in c.h are inadequate, but findingthat out would be a good thing.)The immediate motivation for this is that the current definition ofExecRowMark allows its curCtid field to be misaligned. It is not clearwhether there are any other uses of ItemPointerData with a similar hazard.We could change the definition of ExecRowMark if this doesn't work, butit would be far better to have a future-proof fix.Piotr Stefaniak, some further hacking by me1 parent160a9aa commitd4b538e
2 files changed
+11
-3
lines changedLines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
28 | 28 |
| |
29 | 29 |
| |
30 | 30 |
| |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
31 | 38 |
| |
32 | 39 |
| |
33 | 40 |
| |
|
Lines changed: 4 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
39 | 39 |
| |
40 | 40 |
| |
41 | 41 |
| |
42 |
| - | |
43 |
| - | |
44 |
| - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
45 | 46 |
| |
46 | 47 |
| |
47 | 48 |
| |
|
0 commit comments
Comments
(0)