mirror of
https://github.com/postgres/postgres.git
synced 2025-10-21 02:52:47 +03:00
Add FIELDNO_* macro designating offset into structs required for JIT.
For any interesting JIT target, fields inside structs need to be
accessed. b96d550e
contains infrastructure for syncing the definition
of types between postgres C code and runtime code generation with
LLVM. But that doesn't sync the number or names of fields inside
structs, just the types (including padding etc).
One option would be to hardcode the offset numbers in the JIT code,
but that'd be hard to keep in sync. Instead add macros indicating the
field offset to the fields that need to be accessed. Not pretty, but
manageable.
Author: Andres Freund
Discussion: https://postgr.es/m/20170901064131.tazjxwus3k2w3ybh@alap3.anarazel.de
This commit is contained in:
@@ -64,6 +64,7 @@ typedef struct HeapTupleData
|
||||
uint32 t_len; /* length of *t_data */
|
||||
ItemPointerData t_self; /* SelfItemPointer */
|
||||
Oid t_tableOid; /* table the tuple came from */
|
||||
#define FIELDNO_HEAPTUPLEDATA_DATA 3
|
||||
HeapTupleHeader t_data; /* -> tuple header and data */
|
||||
} HeapTupleData;
|
||||
|
||||
|
@@ -157,14 +157,18 @@ struct HeapTupleHeaderData
|
||||
|
||||
/* Fields below here must match MinimalTupleData! */
|
||||
|
||||
#define FIELDNO_HEAPTUPLEHEADERDATA_INFOMASK2 2
|
||||
uint16 t_infomask2; /* number of attributes + various flags */
|
||||
|
||||
#define FIELDNO_HEAPTUPLEHEADERDATA_INFOMASK 3
|
||||
uint16 t_infomask; /* various flag bits, see below */
|
||||
|
||||
#define FIELDNO_HEAPTUPLEHEADERDATA_HOFF 4
|
||||
uint8 t_hoff; /* sizeof header incl. bitmap, padding */
|
||||
|
||||
/* ^ - 23 bytes - ^ */
|
||||
|
||||
#define FIELDNO_HEAPTUPLEHEADERDATA_BITS 5
|
||||
bits8 t_bits[FLEXIBLE_ARRAY_MEMBER]; /* bitmap of NULLs */
|
||||
|
||||
/* MORE DATA FOLLOWS AT END OF STRUCT */
|
||||
|
Reference in New Issue
Block a user