14 #ifndef VEIL_DATATYPES 18 #define VEIL_DATATYPES 1 36 #define DBG_CANARY 0xca96ca96 41 #define DBG_CANARY_ENTRY int32 canary; 47 #define DBG_ELEMS_ENTRY int32 dbgelems; 53 #define DBG_SET_ELEMS(x,y) (x).dbgelems = y 58 #define DBG_SET_CANARY(x) (x).canary = DBG_CANARY 63 #define DBG_TEST_CANARY(x) if ((x).canary != DBG_CANARY) {\ 64 elog(ERROR, "canary fault"); } 76 #define DBG_SET_TRAILER(x, y) (x).y[(x).dbgelems] = DBG_CANARY; 80 #define DBG_SET_TRAILERP(x, y) (x).y[(x).dbgelems] = (void *) DBG_CANARY; 85 #define DBG_TEST_TRAILER(x, y) \ 86 if ((uintptr_t) (x).y[(x).dbgelems] != DBG_CANARY) { \ 87 elog(ERROR, "trailing canary fault"); } 92 #define DBG_CHECK_INDEX(x,i) if (i >= (x).dbgelems) {\ 93 elog(ERROR, "Element index out of range %d", i); } 96 #define DBG_CANARY_ENTRY 97 #define DBG_ELEMS_ENTRY 98 #define DBG_SET_ELEMS(x,y) 99 #define DBG_SET_CANARY(x) 100 #define DBG_TEST_CANARY(x) 102 #define DBG_SET_TRAILER(x,Y) 103 #define DBG_TEST_TRAILER(x,Y) 104 #define DBG_CHECK_INDEX(x,i) 107 #include "utils/hsearch.h" 108 #include "storage/lwlock.h" 130 #define HASH_KEYLEN 60 167 size_t total_allocated[2];
172 TransactionId xid[2];
207 #if (SIZEOF_VOID_P == 8) 227 #define BITZERO(x) (x & 0xffffffffffffffc0) 229 #define BITZERO(x) (x & 0xffffffe0) 241 #define BITMAX(x) (x | 0x3f) 243 #define BITMAX(x) (x | 0x1f) 255 #define BITSET_ELEM(x) (x >> 6) 257 #define BITSET_ELEM(x) (x >> 5) 268 #define BITSET_BIT(x) (x & 0x3f) 270 #define BITSET_BIT(x) (x & 0x1f) 283 #define ARRAYELEMS(min,max) (((max - BITZERO(min)) >> 6) + 1) 285 #define ARRAYELEMS(min,max) (((max - BITZERO(min)) >> 5) + 1) 298 #define MIN(a,b) ((a < b)? a: b) 301 typedef uint64 bm_int;
303 typedef uint32 bm_int;
struct ShmemCtl ShmemCtl
The ShmemCtl structure is the first object allocated from the first chunk of shared memory in context...
struct Int4Array Int4Array
Subtype of Object for storing arrays of integers.
TransactionId xid
The xid for which this variable is valid.
Subtype of Object for storing arrays of integers.
Subtype of Object for storing bitmap refs.
struct MemChunk MemChunk
Chunks provide a linked list of dynamically allocated shared memory segments, with the most recently ...
Subtype of Object for storing bitmaps.
int32 value
the integer value of the variable
int32 bitzero
The index of the lowest bit each bitmap can store.
Bitmap * bitmap
Pointer to the referenced bitmap.
int32 bitmax
The index of the highest bit each bitmap can store.
Subtype of Object for storing simple int4 values.
ObjType type
This must have the value OBJ_BITMAP.
Describes a veil shared or session variable.
bool shared
Whether this is a shared variable (as opposed to a session variable)
Chunks provide a linked list of dynamically allocated shared memory segments, with the most recently ...
bool switching
Whether a context-switch is in progress.
bool initialised
Set to true once struct is setup.
ObjType type
This must have the value OBJ_BITMAP_ARRAY.
char * name
The name of the variable.
struct Bitmap Bitmap
Subtype of Object for storing bitmaps.
int current_context
Index of the current context (0 or 1)
ObjType type
This must have the value OBJ_RANGE.
int32 bitmax
The index of the highest bit the bitmap can store.
void * memory[0]
The rest of the chunk, from which memory is allocated.
ObjType type
This must have the value OBJ_INT4_ARRAY.
size_t limit
Offset, of 1st byte beyond chunk.
#define HASH_KEYLEN
The key length for veil hash types.
struct veil_variable_t veil_variable_t
Describes a veil shared or session variable.
int32 arrayzero
The index of array element zero: the index of the lowest numbered bitmap in the array.
int32 arraymax
The index of the lowest numbered bitmap in the array.
#define DBG_ELEMS_ENTRY
Field to record the size of an array so that its canary element can be found.
struct BitmapHash BitmapHash
Subtype of Object for storing bitmap hashes.
bool shared
Whether this is a shared variable.
General purpose object-type.
#define DBG_CANARY_ENTRY
Defines a canary element in a data structure.
struct Object Object
General purpose object-type.
int32 bitzero
The index of the lowest bit the bitmap can store.
struct BitmapArray BitmapArray
Subtype of Object for storing bitmap arrays.
Subtype of Object for storing bitmap hashes.
char * type
The type of the variable (eg "Bitmap")
ObjType
Describes the type of an Object record or one of its subtypes.
#define EMPTY
Base size for an array containing a canary.
HTAB * hash
Pointer to the (Postgresql dynahash) hash table.
struct Range Range
Subtype of Object for storing range values.
size_t next
Offset, within this chunk, of 1st free byte.
ObjType type
This must have the value OBJ_BITMAP_REF.
int32 arrayzero
The index of array element zero: the index of the lowest numbered bitmap in the array.
Subtype of Object for storing range values.
int32 max
Upper limit for range.
ObjType type
This must have the value OBJ_SHMEMCTL.
int32 bitzero
The index of the lowest bit each bitmap can store.
ObjType type
Identifies the type of the object.
LWLockId veil_lwlock
dynamically allocated LWLock
int32 bitmax
The index of the highest bit each bitmap can store.
struct MemChunk * next_chunk
Pointer to next allocated chunk.
int32 arraymax
The index of the lowest numbered bitmap in the array.
struct Int4Var Int4Var
Subtype of Object for storing simple int4 values.
ObjType type
This must have the value OBJ_BITMAP_HASH.
Object * obj
Pointer to the contents of the variable.
Subtype of Object for storing bitmap arrays.
The ShmemCtl structure is the first object allocated from the first chunk of shared memory in context...
ObjType type
This must have the value OBJ_INT4.
int32 min
Lower limit for range.
bool isnull
if true, the value is null
struct VarEntry VarEntry
A Veil variable.
struct BitmapRef BitmapRef
Subtype of Object for storing bitmap refs.