Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit dcbbdb1

Browse files
committed
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.
1 parent d0f6ae6 commit dcbbdb1

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/include/storage/itemptr.h

+17-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: itemptr.h,v 1.17 2001/03/22 04:01:06 momjian Exp $
10+
* $Id: itemptr.h,v 1.18 2001/03/30 05:25:51 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -20,15 +20,29 @@
2020
/*
2121
* ItemPointer:
2222
*
23-
* this is a pointer to an item on another disk page in the same file.
23+
* This is a pointer to an item within a disk page of a known file
24+
* (for example, a cross-link from an index to its parent table).
2425
* blkid tells us which block, posid tells us which entry in the linp
2526
* (ItemIdData) array we want.
27+
*
28+
* Note: because there is an item pointer in each tuple header and index
29+
* tuple header on disk, it's very important not to waste space with
30+
* structure padding bytes. The struct is designed to be six bytes long
31+
* (it contains three int16 fields) but a few compilers will pad it to
32+
* eight bytes unless coerced. We apply appropriate persuasion where
33+
* possible, and to cope with unpersuadable compilers, we try to use
34+
* "SizeOfIptrData" rather than "sizeof(ItemPointerData)" when computing
35+
* on-disk sizes.
2636
*/
2737
typedef struct ItemPointerData
2838
{
2939
BlockIdData ip_blkid;
3040
OffsetNumber ip_posid;
31-
} ItemPointerData;
41+
}
42+
#ifdef __arm__
43+
__attribute__((packed)) /* Appropriate whack upside the head for ARM */
44+
#endif
45+
ItemPointerData;
3246

3347
#define SizeOfIptrData \
3448
(offsetof(ItemPointerData, ip_posid) + sizeof(OffsetNumber))

0 commit comments

Comments
 (0)