postgresql/src/backend/storage
Tom Lane d4b538ea36 Improve packing/alignment annotation for ItemPointerData.
We want this struct to be exactly a series of 3 int16 words, no more
and no less.  Historically, at least, some ARM compilers preferred to
pad it to 8 bytes unless coerced.  Our old way of doing that was just
to use __attribute__((packed)), but as pointed out by Piotr Stefaniak,
that does too much: it also licenses the compiler to give the struct
only byte-alignment.  We don't want that because it adds access overhead,
possibly quite significant overhead.  According to the GCC manual, what
we want requires also specifying __attribute__((align(2))).  It's not
entirely 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 a
static assertion that should fire if the compiler padded the struct.

Since the combination of these pragmas should define exactly what we
want on any compiler that accepts them, let's try using them wherever
we think they exist, not only for __arm__.  (This is likely to expose
that the conditional definitions in c.h are inadequate, but finding
that out would be a good thing.)

The immediate motivation for this is that the current definition of
ExecRowMark allows its curCtid field to be misaligned.  It is not clear
whether there are any other uses of ItemPointerData with a similar hazard.
We could change the definition of ExecRowMark if this doesn't work, but
it would be far better to have a future-proof fix.

Piotr Stefaniak, some further hacking by me
2015-05-21 17:21:46 -04:00
..
buffer Fix more typos in comments. 2015-05-20 19:45:43 +03:00
file Fix error message in pre_sync_fname. 2015-05-18 12:53:54 -04:00
freespace Update copyright for 2015 2015-01-06 11:43:47 -05:00
ipc Fix more typos in comments. 2015-05-20 19:45:43 +03:00
large_object Use FLEXIBLE_ARRAY_MEMBER in struct varlena. 2015-02-20 16:51:53 -05:00
lmgr Collection of typo fixes. 2015-05-20 16:56:22 +03:00
page Improve packing/alignment annotation for ItemPointerData. 2015-05-21 17:21:46 -04:00
smgr Update copyright for 2015 2015-01-06 11:43:47 -05:00
Makefile Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00