From: Tom Lane Date: Fri, 30 Mar 2001 05:25:51 +0000 (+0000) Subject: Add appropriately ifdef'd hack to make ARM compiler allocate ItemPointerData X-Git-Url: http://waps.l3s.uni-hannover.de/gitweb/?a=commitdiff_plain;h=a0574b55bc77c2bd9fc97bdb232cdbd3d1bd73b4;p=users%2Fbernd%2Fpostgres.git Add appropriately ifdef'd hack to make ARM compiler allocate ItemPointerData as six bytes not eight. This fixes a regression test failure but more importantly avoids wasting four bytes of pad space in every tuple header. Also add some commentary about what's going on. --- diff --git a/src/include/storage/itemptr.h b/src/include/storage/itemptr.h index 5df9a95f70..c46ea071b0 100644 --- a/src/include/storage/itemptr.h +++ b/src/include/storage/itemptr.h @@ -20,15 +20,29 @@ /* * ItemPointer: * - * this is a pointer to an item on another disk page in the same file. + * This is a pointer to an item within a disk page of a known file + * (for example, a cross-link from an index to its parent table). * blkid tells us which block, posid tells us which entry in the linp * (ItemIdData) array we want. + * + * Note: because there is an item pointer in each tuple header and index + * tuple header on disk, it's very important not to waste space with + * structure padding bytes. The struct is designed to be six bytes long + * (it contains three int16 fields) but a few compilers will pad it to + * eight bytes unless coerced. We apply appropriate persuasion where + * possible, and to cope with unpersuadable compilers, we try to use + * "SizeOfIptrData" rather than "sizeof(ItemPointerData)" when computing + * on-disk sizes. */ typedef struct ItemPointerData { BlockIdData ip_blkid; OffsetNumber ip_posid; -} ItemPointerData; +} +#ifdef __arm__ +__attribute__((packed)) /* Appropriate whack upside the head for ARM */ +#endif + ItemPointerData; #define SizeOfIptrData \ (offsetof(ItemPointerData, ip_posid) + sizeof(OffsetNumber))