PostgreSQL Source Code  git master
radixtree.h File Reference
#include "postgres.h"
#include "nodes/bitmapset.h"
#include "port/pg_bitutils.h"
#include "port/simd.h"
#include "utils/dsa.h"
#include "utils/memutils.h"
Include dependency graph for radixtree.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  RT_NODE
 
union  RT_CHILD_PTR
 
struct  RT_NODE_4
 
struct  RT_NODE_16
 
struct  RT_NODE_48
 
struct  RT_NODE_256
 
struct  RT_SIZE_CLASS_ELEM
 
struct  RT_RADIX_TREE_CONTROL
 
struct  RT_RADIX_TREE
 
struct  RT_NODE_ITER
 
struct  RT_ITER
 

Macros

#define RT_MAKE_PREFIX(a)   CppConcat(a,_)
 
#define RT_MAKE_NAME(name)   RT_MAKE_NAME_(RT_MAKE_PREFIX(RT_PREFIX),name)
 
#define RT_MAKE_NAME_(a, b)   CppConcat(a,b)
 
#define RT_STR(s)   RT_STR_(s)
 
#define RT_STR_(s)   #s
 
#define RT_CREATE   RT_MAKE_NAME(create)
 
#define RT_FREE   RT_MAKE_NAME(free)
 
#define RT_FIND   RT_MAKE_NAME(find)
 
#define RT_SET   RT_MAKE_NAME(set)
 
#define RT_BEGIN_ITERATE   RT_MAKE_NAME(begin_iterate)
 
#define RT_ITERATE_NEXT   RT_MAKE_NAME(iterate_next)
 
#define RT_END_ITERATE   RT_MAKE_NAME(end_iterate)
 
#define RT_MEMORY_USAGE   RT_MAKE_NAME(memory_usage)
 
#define RT_DUMP_NODE   RT_MAKE_NAME(dump_node)
 
#define RT_STATS   RT_MAKE_NAME(stats)
 
#define RT_CHILDPTR_IS_VALUE   RT_MAKE_NAME(childptr_is_value)
 
#define RT_VALUE_IS_EMBEDDABLE   RT_MAKE_NAME(value_is_embeddable)
 
#define RT_GET_SLOT_RECURSIVE   RT_MAKE_NAME(get_slot_recursive)
 
#define RT_DELETE_RECURSIVE   RT_MAKE_NAME(delete_recursive)
 
#define RT_ALLOC_NODE   RT_MAKE_NAME(alloc_node)
 
#define RT_ALLOC_LEAF   RT_MAKE_NAME(alloc_leaf)
 
#define RT_FREE_NODE   RT_MAKE_NAME(free_node)
 
#define RT_FREE_LEAF   RT_MAKE_NAME(free_leaf)
 
#define RT_FREE_RECURSE   RT_MAKE_NAME(free_recurse)
 
#define RT_EXTEND_UP   RT_MAKE_NAME(extend_up)
 
#define RT_EXTEND_DOWN   RT_MAKE_NAME(extend_down)
 
#define RT_COPY_COMMON   RT_MAKE_NAME(copy_common)
 
#define RT_PTR_SET_LOCAL   RT_MAKE_NAME(ptr_set_local)
 
#define RT_NODE_16_SEARCH_EQ   RT_MAKE_NAME(node_16_search_eq)
 
#define RT_NODE_4_GET_INSERTPOS   RT_MAKE_NAME(node_4_get_insertpos)
 
#define RT_NODE_16_GET_INSERTPOS   RT_MAKE_NAME(node_16_get_insertpos)
 
#define RT_SHIFT_ARRAYS_FOR_INSERT   RT_MAKE_NAME(shift_arrays_for_insert)
 
#define RT_SHIFT_ARRAYS_AND_DELETE   RT_MAKE_NAME(shift_arrays_and_delete)
 
#define RT_COPY_ARRAYS_FOR_INSERT   RT_MAKE_NAME(copy_arrays_for_insert)
 
#define RT_COPY_ARRAYS_AND_DELETE   RT_MAKE_NAME(copy_arrays_and_delete)
 
#define RT_NODE_48_IS_CHUNK_USED   RT_MAKE_NAME(node_48_is_chunk_used)
 
#define RT_NODE_48_GET_CHILD   RT_MAKE_NAME(node_48_get_child)
 
#define RT_NODE_256_IS_CHUNK_USED   RT_MAKE_NAME(node_256_is_chunk_used)
 
#define RT_NODE_256_GET_CHILD   RT_MAKE_NAME(node_256_get_child)
 
#define RT_KEY_GET_SHIFT   RT_MAKE_NAME(key_get_shift)
 
#define RT_SHIFT_GET_MAX_VAL   RT_MAKE_NAME(shift_get_max_val)
 
#define RT_NODE_SEARCH   RT_MAKE_NAME(node_search)
 
#define RT_NODE_DELETE   RT_MAKE_NAME(node_delete)
 
#define RT_NODE_INSERT   RT_MAKE_NAME(node_insert)
 
#define RT_ADD_CHILD_4   RT_MAKE_NAME(add_child_4)
 
#define RT_ADD_CHILD_16   RT_MAKE_NAME(add_child_16)
 
#define RT_ADD_CHILD_48   RT_MAKE_NAME(add_child_48)
 
#define RT_ADD_CHILD_256   RT_MAKE_NAME(add_child_256)
 
#define RT_GROW_NODE_4   RT_MAKE_NAME(grow_node_4)
 
#define RT_GROW_NODE_16   RT_MAKE_NAME(grow_node_16)
 
#define RT_GROW_NODE_48   RT_MAKE_NAME(grow_node_48)
 
#define RT_REMOVE_CHILD_4   RT_MAKE_NAME(remove_child_4)
 
#define RT_REMOVE_CHILD_16   RT_MAKE_NAME(remove_child_16)
 
#define RT_REMOVE_CHILD_48   RT_MAKE_NAME(remove_child_48)
 
#define RT_REMOVE_CHILD_256   RT_MAKE_NAME(remove_child_256)
 
#define RT_SHRINK_NODE_16   RT_MAKE_NAME(shrink_child_16)
 
#define RT_SHRINK_NODE_48   RT_MAKE_NAME(shrink_child_48)
 
#define RT_SHRINK_NODE_256   RT_MAKE_NAME(shrink_child_256)
 
#define RT_NODE_ITERATE_NEXT   RT_MAKE_NAME(node_iterate_next)
 
#define RT_VERIFY_NODE   RT_MAKE_NAME(verify_node)
 
#define RT_RADIX_TREE   RT_MAKE_NAME(radix_tree)
 
#define RT_RADIX_TREE_CONTROL   RT_MAKE_NAME(radix_tree_control)
 
#define RT_ITER   RT_MAKE_NAME(iter)
 
#define RT_NODE   RT_MAKE_NAME(node)
 
#define RT_CHILD_PTR   RT_MAKE_NAME(child_ptr)
 
#define RT_NODE_ITER   RT_MAKE_NAME(node_iter)
 
#define RT_NODE_4   RT_MAKE_NAME(node_4)
 
#define RT_NODE_16   RT_MAKE_NAME(node_16)
 
#define RT_NODE_48   RT_MAKE_NAME(node_48)
 
#define RT_NODE_256   RT_MAKE_NAME(node_256)
 
#define RT_SIZE_CLASS   RT_MAKE_NAME(size_class)
 
#define RT_SIZE_CLASS_ELEM   RT_MAKE_NAME(size_class_elem)
 
#define RT_SIZE_CLASS_INFO   RT_MAKE_NAME(size_class_info)
 
#define RT_CLASS_4   RT_MAKE_NAME(class_4)
 
#define RT_CLASS_16_LO   RT_MAKE_NAME(class_32_min)
 
#define RT_CLASS_16_HI   RT_MAKE_NAME(class_32_max)
 
#define RT_CLASS_48   RT_MAKE_NAME(class_48)
 
#define RT_CLASS_256   RT_MAKE_NAME(class_256)
 
#define RT_SPAN   BITS_PER_BYTE
 
#define RT_NODE_MAX_SLOTS   (1 << RT_SPAN)
 
#define RT_CHUNK_MASK   ((1 << RT_SPAN) - 1)
 
#define RT_MAX_SHIFT   RT_KEY_GET_SHIFT(UINT64_MAX)
 
#define RT_MAX_LEVEL   ((sizeof(uint64) * BITS_PER_BYTE) / RT_SPAN)
 
#define RT_GET_KEY_CHUNK(key, shift)   ((uint8) (((key) >> (shift)) & RT_CHUNK_MASK))
 
#define RT_BM_IDX(x)   ((x) / BITS_PER_BITMAPWORD)
 
#define RT_BM_BIT(x)   ((x) % BITS_PER_BITMAPWORD)
 
#define RT_NODE_KIND_4   0x00
 
#define RT_NODE_KIND_16   0x01
 
#define RT_NODE_KIND_48   0x02
 
#define RT_NODE_KIND_256   0x03
 
#define RT_NODE_KIND_COUNT   4
 
#define RT_SLAB_BLOCK_SIZE(size)    Max(SLAB_DEFAULT_BLOCK_SIZE, pg_nextpower2_32(size * 32))
 
#define RT_PTR_ALLOC   RT_NODE *
 
#define RT_INVALID_PTR_ALLOC   NULL
 
#define RT_PTR_ALLOC_IS_VALID(ptr)   PointerIsValid(ptr)
 
#define RT_GET_VALUE_SIZE(v)   RT_VARLEN_VALUE_SIZE(v)
 
#define RT_FANOUT_4_MAX   (8 - sizeof(RT_NODE))
 
#define RT_FANOUT_16_MAX   32
 
#define RT_FANOUT_48_MAX   64
 
#define RT_FANOUT_256   RT_NODE_MAX_SLOTS
 
#define RT_INVALID_SLOT_IDX   0xFF
 
#define RT_FANOUT_16_LO   16
 
#define RT_FANOUT_16_HI   RT_FANOUT_16_MAX
 
#define RT_FANOUT_48   RT_FANOUT_48_MAX
 
#define RT_FANOUT_4   4
 
#define RT_NUM_SIZE_CLASSES   lengthof(RT_SIZE_CLASS_INFO)
 
#define RT_NODE_MUST_GROW(node)    ((node)->count == (node)->fanout)
 

Typedefs

typedef struct RT_RADIX_TREE RT_RADIX_TREE
 
typedef struct RT_ITER RT_ITER
 
typedef struct RT_NODE RT_NODE
 
typedef union RT_CHILD_PTR RT_CHILD_PTR
 
typedef struct RT_NODE_4 RT_NODE_4
 
typedef struct RT_NODE_16 RT_NODE_16
 
typedef struct RT_NODE_48 RT_NODE_48
 
typedef struct RT_NODE_256 RT_NODE_256
 
typedef enum RT_SIZE_CLASS RT_SIZE_CLASS
 
typedef struct RT_SIZE_CLASS_ELEM RT_SIZE_CLASS_ELEM
 
typedef struct RT_RADIX_TREE_CONTROL RT_RADIX_TREE_CONTROL
 
typedef struct RT_NODE_ITER RT_NODE_ITER
 

Enumerations

enum  RT_SIZE_CLASS {
  RT_CLASS_4 = 0 , RT_CLASS_16_LO , RT_CLASS_16_HI , RT_CLASS_48 ,
  RT_CLASS_256
}
 

Functions

RT_SCOPE RT_RADIX_TREERT_CREATE (MemoryContext ctx)
 
RT_SCOPE void RT_FREE (RT_RADIX_TREE *tree)
 
RT_SCOPE RT_VALUE_TYPERT_FIND (RT_RADIX_TREE *tree, uint64 key)
 
RT_SCOPE bool RT_SET (RT_RADIX_TREE *tree, uint64 key, RT_VALUE_TYPE *value_p)
 
RT_SCOPE RT_ITERRT_BEGIN_ITERATE (RT_RADIX_TREE *tree)
 
RT_SCOPE RT_VALUE_TYPERT_ITERATE_NEXT (RT_ITER *iter, uint64 *key_p)
 
RT_SCOPE void RT_END_ITERATE (RT_ITER *iter)
 
RT_SCOPE uint64 RT_MEMORY_USAGE (RT_RADIX_TREE *tree)
 
static bool RT_VALUE_IS_EMBEDDABLE (RT_VALUE_TYPE *value_p)
 
static bool RT_CHILDPTR_IS_VALUE (RT_PTR_ALLOC child)
 
 StaticAssertDecl (RT_FANOUT_4<=RT_FANOUT_4_MAX, "watch struct padding")
 
 StaticAssertDecl (RT_FANOUT_16_LO< RT_FANOUT_16_HI, "LO subclass bigger than HI")
 
 StaticAssertDecl (RT_FANOUT_48<=RT_FANOUT_48_MAX, "more slots than isset bits")
 
static void RT_VERIFY_NODE (RT_NODE *node)
 
static void RT_PTR_SET_LOCAL (RT_RADIX_TREE *tree, RT_CHILD_PTR *node)
 
static bool RT_NODE_48_IS_CHUNK_USED (RT_NODE_48 *node, uint8 chunk)
 
static RT_PTR_ALLOCRT_NODE_48_GET_CHILD (RT_NODE_48 *node, uint8 chunk)
 
static bool RT_NODE_256_IS_CHUNK_USED (RT_NODE_256 *node, uint8 chunk)
 
static RT_PTR_ALLOCRT_NODE_256_GET_CHILD (RT_NODE_256 *node, uint8 chunk)
 
static int RT_KEY_GET_SHIFT (uint64 key)
 
static uint64 RT_SHIFT_GET_MAX_VAL (int shift)
 
static RT_CHILD_PTR RT_ALLOC_NODE (RT_RADIX_TREE *tree, const uint8 kind, const RT_SIZE_CLASS size_class)
 
static RT_CHILD_PTR RT_ALLOC_LEAF (RT_RADIX_TREE *tree, size_t allocsize)
 
static void RT_COPY_COMMON (RT_CHILD_PTR newnode, RT_CHILD_PTR oldnode)
 
static void RT_FREE_NODE (RT_RADIX_TREE *tree, RT_CHILD_PTR node)
 
static void RT_FREE_LEAF (RT_RADIX_TREE *tree, RT_PTR_ALLOC leaf)
 
static RT_PTR_ALLOCRT_NODE_16_SEARCH_EQ (RT_NODE_16 *node, uint8 chunk)
 
static RT_PTR_ALLOCRT_NODE_SEARCH (RT_NODE *node, uint8 chunk)
 
static int RT_NODE_4_GET_INSERTPOS (RT_NODE_4 *node, uint8 chunk, int count)
 
static int RT_NODE_16_GET_INSERTPOS (RT_NODE_16 *node, uint8 chunk)
 
static void RT_SHIFT_ARRAYS_FOR_INSERT (uint8 *chunks, RT_PTR_ALLOC *children, int count, int insertpos)
 
static void RT_COPY_ARRAYS_FOR_INSERT (uint8 *dst_chunks, RT_PTR_ALLOC *dst_children, uint8 *src_chunks, RT_PTR_ALLOC *src_children, int count, int insertpos)
 
static RT_PTR_ALLOCRT_ADD_CHILD_256 (RT_RADIX_TREE *tree, RT_CHILD_PTR node, uint8 chunk)
 
static pg_noinline RT_PTR_ALLOCRT_GROW_NODE_48 (RT_RADIX_TREE *tree, RT_PTR_ALLOC *parent_slot, RT_CHILD_PTR node, uint8 chunk)
 
static RT_PTR_ALLOCRT_ADD_CHILD_48 (RT_RADIX_TREE *tree, RT_CHILD_PTR node, uint8 chunk)
 
static pg_noinline RT_PTR_ALLOCRT_GROW_NODE_16 (RT_RADIX_TREE *tree, RT_PTR_ALLOC *parent_slot, RT_CHILD_PTR node, uint8 chunk)
 
static RT_PTR_ALLOCRT_ADD_CHILD_16 (RT_RADIX_TREE *tree, RT_CHILD_PTR node, uint8 chunk)
 
static pg_noinline RT_PTR_ALLOCRT_GROW_NODE_4 (RT_RADIX_TREE *tree, RT_PTR_ALLOC *parent_slot, RT_CHILD_PTR node, uint8 chunk)
 
static RT_PTR_ALLOCRT_ADD_CHILD_4 (RT_RADIX_TREE *tree, RT_CHILD_PTR node, uint8 chunk)
 
static RT_PTR_ALLOCRT_NODE_INSERT (RT_RADIX_TREE *tree, RT_PTR_ALLOC *parent_slot, RT_CHILD_PTR node, uint8 chunk)
 
static pg_noinline void RT_EXTEND_UP (RT_RADIX_TREE *tree, uint64 key)
 
static pg_noinline RT_PTR_ALLOCRT_EXTEND_DOWN (RT_RADIX_TREE *tree, RT_PTR_ALLOC *parent_slot, uint64 key, int shift)
 
static RT_PTR_ALLOCRT_GET_SLOT_RECURSIVE (RT_RADIX_TREE *tree, RT_PTR_ALLOC *parent_slot, uint64 key, int shift, bool *found)
 
 for (int i=0;i< RT_NUM_SIZE_CLASSES;i++)
 
 MemoryContextSwitchTo (old_ctx)
 
static RT_PTR_ALLOCRT_NODE_ITERATE_NEXT (RT_ITER *iter, int level)
 

Variables

static const RT_SIZE_CLASS_ELEM RT_SIZE_CLASS_INFO []
 
RT_SCOPE RT_RADIX_TREE *MemoryContext old_ctx
 
RT_CHILD_PTR rootnode = RT_ALLOC_NODE(tree, RT_NODE_KIND_4, RT_CLASS_4)
 
 tree = (RT_RADIX_TREE *) palloc0(sizeof(RT_RADIX_TREE))
 
tree context = ctx
 
tree iter_context
 
tree ctl = (RT_RADIX_TREE_CONTROL *) palloc0(sizeof(RT_RADIX_TREE_CONTROL))
 
tree leaf_context = tree->context
 
tree ctl root = rootnode.alloc
 
tree ctl start_shift = 0
 
tree ctl max_val = RT_SHIFT_GET_MAX_VAL(0)
 

Macro Definition Documentation

◆ RT_ADD_CHILD_16

#define RT_ADD_CHILD_16   RT_MAKE_NAME(add_child_16)

Definition at line 226 of file radixtree.h.

◆ RT_ADD_CHILD_256

#define RT_ADD_CHILD_256   RT_MAKE_NAME(add_child_256)

Definition at line 228 of file radixtree.h.

◆ RT_ADD_CHILD_4

#define RT_ADD_CHILD_4   RT_MAKE_NAME(add_child_4)

Definition at line 225 of file radixtree.h.

◆ RT_ADD_CHILD_48

#define RT_ADD_CHILD_48   RT_MAKE_NAME(add_child_48)

Definition at line 227 of file radixtree.h.

◆ RT_ALLOC_LEAF

#define RT_ALLOC_LEAF   RT_MAKE_NAME(alloc_leaf)

Definition at line 201 of file radixtree.h.

◆ RT_ALLOC_NODE

#define RT_ALLOC_NODE   RT_MAKE_NAME(alloc_node)

Definition at line 200 of file radixtree.h.

◆ RT_BEGIN_ITERATE

#define RT_BEGIN_ITERATE   RT_MAKE_NAME(begin_iterate)

Definition at line 185 of file radixtree.h.

◆ RT_BM_BIT

#define RT_BM_BIT (   x)    ((x) % BITS_PER_BITMAPWORD)

Definition at line 334 of file radixtree.h.

◆ RT_BM_IDX

#define RT_BM_IDX (   x)    ((x) / BITS_PER_BITMAPWORD)

Definition at line 333 of file radixtree.h.

◆ RT_CHILD_PTR

#define RT_CHILD_PTR   RT_MAKE_NAME(child_ptr)

Definition at line 250 of file radixtree.h.

◆ RT_CHILDPTR_IS_VALUE

#define RT_CHILDPTR_IS_VALUE   RT_MAKE_NAME(childptr_is_value)

Definition at line 196 of file radixtree.h.

◆ RT_CHUNK_MASK

#define RT_CHUNK_MASK   ((1 << RT_SPAN) - 1)

Definition at line 321 of file radixtree.h.

◆ RT_CLASS_16_HI

#define RT_CLASS_16_HI   RT_MAKE_NAME(class_32_max)

Definition at line 261 of file radixtree.h.

◆ RT_CLASS_16_LO

#define RT_CLASS_16_LO   RT_MAKE_NAME(class_32_min)

Definition at line 260 of file radixtree.h.

◆ RT_CLASS_256

#define RT_CLASS_256   RT_MAKE_NAME(class_256)

Definition at line 263 of file radixtree.h.

◆ RT_CLASS_4

#define RT_CLASS_4   RT_MAKE_NAME(class_4)

Definition at line 259 of file radixtree.h.

◆ RT_CLASS_48

#define RT_CLASS_48   RT_MAKE_NAME(class_48)

Definition at line 262 of file radixtree.h.

◆ RT_COPY_ARRAYS_AND_DELETE

#define RT_COPY_ARRAYS_AND_DELETE   RT_MAKE_NAME(copy_arrays_and_delete)

Definition at line 215 of file radixtree.h.

◆ RT_COPY_ARRAYS_FOR_INSERT

#define RT_COPY_ARRAYS_FOR_INSERT   RT_MAKE_NAME(copy_arrays_for_insert)

Definition at line 214 of file radixtree.h.

◆ RT_COPY_COMMON

#define RT_COPY_COMMON   RT_MAKE_NAME(copy_common)

Definition at line 207 of file radixtree.h.

◆ RT_CREATE

#define RT_CREATE   RT_MAKE_NAME(create)

Definition at line 173 of file radixtree.h.

◆ RT_DELETE_RECURSIVE

#define RT_DELETE_RECURSIVE   RT_MAKE_NAME(delete_recursive)

Definition at line 199 of file radixtree.h.

◆ RT_DUMP_NODE

#define RT_DUMP_NODE   RT_MAKE_NAME(dump_node)

Definition at line 192 of file radixtree.h.

◆ RT_END_ITERATE

#define RT_END_ITERATE   RT_MAKE_NAME(end_iterate)

Definition at line 187 of file radixtree.h.

◆ RT_EXTEND_DOWN

#define RT_EXTEND_DOWN   RT_MAKE_NAME(extend_down)

Definition at line 206 of file radixtree.h.

◆ RT_EXTEND_UP

#define RT_EXTEND_UP   RT_MAKE_NAME(extend_up)

Definition at line 205 of file radixtree.h.

◆ RT_FANOUT_16_HI

#define RT_FANOUT_16_HI   RT_FANOUT_16_MAX

Definition at line 600 of file radixtree.h.

◆ RT_FANOUT_16_LO

#define RT_FANOUT_16_LO   16

Definition at line 598 of file radixtree.h.

◆ RT_FANOUT_16_MAX

#define RT_FANOUT_16_MAX   32

Definition at line 492 of file radixtree.h.

◆ RT_FANOUT_256

#define RT_FANOUT_256   RT_NODE_MAX_SLOTS

Definition at line 504 of file radixtree.h.

◆ RT_FANOUT_4

#define RT_FANOUT_4   4

Definition at line 611 of file radixtree.h.

◆ RT_FANOUT_48

#define RT_FANOUT_48   RT_FANOUT_48_MAX

Definition at line 601 of file radixtree.h.

◆ RT_FANOUT_48_MAX

#define RT_FANOUT_48_MAX   64

Definition at line 502 of file radixtree.h.

◆ RT_FANOUT_4_MAX

#define RT_FANOUT_4_MAX   (8 - sizeof(RT_NODE))

Definition at line 489 of file radixtree.h.

◆ RT_FIND

#define RT_FIND   RT_MAKE_NAME(find)

Definition at line 175 of file radixtree.h.

◆ RT_FREE

#define RT_FREE   RT_MAKE_NAME(free)

Definition at line 174 of file radixtree.h.

◆ RT_FREE_LEAF

#define RT_FREE_LEAF   RT_MAKE_NAME(free_leaf)

Definition at line 203 of file radixtree.h.

◆ RT_FREE_NODE

#define RT_FREE_NODE   RT_MAKE_NAME(free_node)

Definition at line 202 of file radixtree.h.

◆ RT_FREE_RECURSE

#define RT_FREE_RECURSE   RT_MAKE_NAME(free_recurse)

Definition at line 204 of file radixtree.h.

◆ RT_GET_KEY_CHUNK

#define RT_GET_KEY_CHUNK (   key,
  shift 
)    ((uint8) (((key) >> (shift)) & RT_CHUNK_MASK))

Definition at line 330 of file radixtree.h.

◆ RT_GET_SLOT_RECURSIVE

#define RT_GET_SLOT_RECURSIVE   RT_MAKE_NAME(get_slot_recursive)

Definition at line 198 of file radixtree.h.

◆ RT_GET_VALUE_SIZE

#define RT_GET_VALUE_SIZE (   v)    RT_VARLEN_VALUE_SIZE(v)

Definition at line 431 of file radixtree.h.

◆ RT_GROW_NODE_16

#define RT_GROW_NODE_16   RT_MAKE_NAME(grow_node_16)

Definition at line 230 of file radixtree.h.

◆ RT_GROW_NODE_4

#define RT_GROW_NODE_4   RT_MAKE_NAME(grow_node_4)

Definition at line 229 of file radixtree.h.

◆ RT_GROW_NODE_48

#define RT_GROW_NODE_48   RT_MAKE_NAME(grow_node_48)

Definition at line 231 of file radixtree.h.

◆ RT_INVALID_PTR_ALLOC

#define RT_INVALID_PTR_ALLOC   NULL

Definition at line 403 of file radixtree.h.

◆ RT_INVALID_SLOT_IDX

#define RT_INVALID_SLOT_IDX   0xFF

Definition at line 555 of file radixtree.h.

◆ RT_ITER

#define RT_ITER   RT_MAKE_NAME(iter)

Definition at line 245 of file radixtree.h.

◆ RT_ITERATE_NEXT

#define RT_ITERATE_NEXT   RT_MAKE_NAME(iterate_next)

Definition at line 186 of file radixtree.h.

◆ RT_KEY_GET_SHIFT

#define RT_KEY_GET_SHIFT   RT_MAKE_NAME(key_get_shift)

Definition at line 220 of file radixtree.h.

◆ RT_MAKE_NAME

#define RT_MAKE_NAME (   name)    RT_MAKE_NAME_(RT_MAKE_PREFIX(RT_PREFIX),name)

Definition at line 164 of file radixtree.h.

◆ RT_MAKE_NAME_

#define RT_MAKE_NAME_ (   a,
  b 
)    CppConcat(a,b)

Definition at line 165 of file radixtree.h.

◆ RT_MAKE_PREFIX

#define RT_MAKE_PREFIX (   a)    CppConcat(a,_)

Definition at line 163 of file radixtree.h.

◆ RT_MAX_LEVEL

#define RT_MAX_LEVEL   ((sizeof(uint64) * BITS_PER_BYTE) / RT_SPAN)

Definition at line 327 of file radixtree.h.

◆ RT_MAX_SHIFT

#define RT_MAX_SHIFT   RT_KEY_GET_SHIFT(UINT64_MAX)

Definition at line 324 of file radixtree.h.

◆ RT_MEMORY_USAGE

#define RT_MEMORY_USAGE   RT_MAKE_NAME(memory_usage)

Definition at line 191 of file radixtree.h.

◆ RT_NODE

#define RT_NODE   RT_MAKE_NAME(node)

Definition at line 249 of file radixtree.h.

◆ RT_NODE_16

#define RT_NODE_16   RT_MAKE_NAME(node_16)

Definition at line 253 of file radixtree.h.

◆ RT_NODE_16_GET_INSERTPOS

#define RT_NODE_16_GET_INSERTPOS   RT_MAKE_NAME(node_16_get_insertpos)

Definition at line 211 of file radixtree.h.

◆ RT_NODE_16_SEARCH_EQ

#define RT_NODE_16_SEARCH_EQ   RT_MAKE_NAME(node_16_search_eq)

Definition at line 209 of file radixtree.h.

◆ RT_NODE_256

#define RT_NODE_256   RT_MAKE_NAME(node_256)

Definition at line 255 of file radixtree.h.

◆ RT_NODE_256_GET_CHILD

#define RT_NODE_256_GET_CHILD   RT_MAKE_NAME(node_256_get_child)

Definition at line 219 of file radixtree.h.

◆ RT_NODE_256_IS_CHUNK_USED

#define RT_NODE_256_IS_CHUNK_USED   RT_MAKE_NAME(node_256_is_chunk_used)

Definition at line 218 of file radixtree.h.

◆ RT_NODE_4

#define RT_NODE_4   RT_MAKE_NAME(node_4)

Definition at line 252 of file radixtree.h.

◆ RT_NODE_48

#define RT_NODE_48   RT_MAKE_NAME(node_48)

Definition at line 254 of file radixtree.h.

◆ RT_NODE_48_GET_CHILD

#define RT_NODE_48_GET_CHILD   RT_MAKE_NAME(node_48_get_child)

Definition at line 217 of file radixtree.h.

◆ RT_NODE_48_IS_CHUNK_USED

#define RT_NODE_48_IS_CHUNK_USED   RT_MAKE_NAME(node_48_is_chunk_used)

Definition at line 216 of file radixtree.h.

◆ RT_NODE_4_GET_INSERTPOS

#define RT_NODE_4_GET_INSERTPOS   RT_MAKE_NAME(node_4_get_insertpos)

Definition at line 210 of file radixtree.h.

◆ RT_NODE_DELETE

#define RT_NODE_DELETE   RT_MAKE_NAME(node_delete)

Definition at line 223 of file radixtree.h.

◆ RT_NODE_INSERT

#define RT_NODE_INSERT   RT_MAKE_NAME(node_insert)

Definition at line 224 of file radixtree.h.

◆ RT_NODE_ITER

#define RT_NODE_ITER   RT_MAKE_NAME(node_iter)

Definition at line 251 of file radixtree.h.

◆ RT_NODE_ITERATE_NEXT

#define RT_NODE_ITERATE_NEXT   RT_MAKE_NAME(node_iterate_next)

Definition at line 239 of file radixtree.h.

◆ RT_NODE_KIND_16

#define RT_NODE_KIND_16   0x01

Definition at line 359 of file radixtree.h.

◆ RT_NODE_KIND_256

#define RT_NODE_KIND_256   0x03

Definition at line 361 of file radixtree.h.

◆ RT_NODE_KIND_4

#define RT_NODE_KIND_4   0x00

Definition at line 358 of file radixtree.h.

◆ RT_NODE_KIND_48

#define RT_NODE_KIND_48   0x02

Definition at line 360 of file radixtree.h.

◆ RT_NODE_KIND_COUNT

#define RT_NODE_KIND_COUNT   4

Definition at line 362 of file radixtree.h.

◆ RT_NODE_MAX_SLOTS

#define RT_NODE_MAX_SLOTS   (1 << RT_SPAN)

Definition at line 318 of file radixtree.h.

◆ RT_NODE_MUST_GROW

#define RT_NODE_MUST_GROW (   node)     ((node)->count == (node)->fanout)

Definition at line 1132 of file radixtree.h.

◆ RT_NODE_SEARCH

#define RT_NODE_SEARCH   RT_MAKE_NAME(node_search)

Definition at line 222 of file radixtree.h.

◆ RT_NUM_SIZE_CLASSES

#define RT_NUM_SIZE_CLASSES   lengthof(RT_SIZE_CLASS_INFO)

Definition at line 676 of file radixtree.h.

◆ RT_PTR_ALLOC

#define RT_PTR_ALLOC   RT_NODE *

Definition at line 402 of file radixtree.h.

◆ RT_PTR_ALLOC_IS_VALID

#define RT_PTR_ALLOC_IS_VALID (   ptr)    PointerIsValid(ptr)

Definition at line 404 of file radixtree.h.

◆ RT_PTR_SET_LOCAL

#define RT_PTR_SET_LOCAL   RT_MAKE_NAME(ptr_set_local)

Definition at line 208 of file radixtree.h.

◆ RT_RADIX_TREE

#define RT_RADIX_TREE   RT_MAKE_NAME(radix_tree)

Definition at line 243 of file radixtree.h.

◆ RT_RADIX_TREE_CONTROL

#define RT_RADIX_TREE_CONTROL   RT_MAKE_NAME(radix_tree_control)

Definition at line 244 of file radixtree.h.

◆ RT_REMOVE_CHILD_16

#define RT_REMOVE_CHILD_16   RT_MAKE_NAME(remove_child_16)

Definition at line 233 of file radixtree.h.

◆ RT_REMOVE_CHILD_256

#define RT_REMOVE_CHILD_256   RT_MAKE_NAME(remove_child_256)

Definition at line 235 of file radixtree.h.

◆ RT_REMOVE_CHILD_4

#define RT_REMOVE_CHILD_4   RT_MAKE_NAME(remove_child_4)

Definition at line 232 of file radixtree.h.

◆ RT_REMOVE_CHILD_48

#define RT_REMOVE_CHILD_48   RT_MAKE_NAME(remove_child_48)

Definition at line 234 of file radixtree.h.

◆ RT_SET

#define RT_SET   RT_MAKE_NAME(set)

Definition at line 184 of file radixtree.h.

◆ RT_SHIFT_ARRAYS_AND_DELETE

#define RT_SHIFT_ARRAYS_AND_DELETE   RT_MAKE_NAME(shift_arrays_and_delete)

Definition at line 213 of file radixtree.h.

◆ RT_SHIFT_ARRAYS_FOR_INSERT

#define RT_SHIFT_ARRAYS_FOR_INSERT   RT_MAKE_NAME(shift_arrays_for_insert)

Definition at line 212 of file radixtree.h.

◆ RT_SHIFT_GET_MAX_VAL

#define RT_SHIFT_GET_MAX_VAL   RT_MAKE_NAME(shift_get_max_val)

Definition at line 221 of file radixtree.h.

◆ RT_SHRINK_NODE_16

#define RT_SHRINK_NODE_16   RT_MAKE_NAME(shrink_child_16)

Definition at line 236 of file radixtree.h.

◆ RT_SHRINK_NODE_256

#define RT_SHRINK_NODE_256   RT_MAKE_NAME(shrink_child_256)

Definition at line 238 of file radixtree.h.

◆ RT_SHRINK_NODE_48

#define RT_SHRINK_NODE_48   RT_MAKE_NAME(shrink_child_48)

Definition at line 237 of file radixtree.h.

◆ RT_SIZE_CLASS

#define RT_SIZE_CLASS   RT_MAKE_NAME(size_class)

Definition at line 256 of file radixtree.h.

◆ RT_SIZE_CLASS_ELEM

#define RT_SIZE_CLASS_ELEM   RT_MAKE_NAME(size_class_elem)

Definition at line 257 of file radixtree.h.

◆ RT_SIZE_CLASS_INFO

#define RT_SIZE_CLASS_INFO   RT_MAKE_NAME(size_class_info)

Definition at line 258 of file radixtree.h.

◆ RT_SLAB_BLOCK_SIZE

#define RT_SLAB_BLOCK_SIZE (   size)     Max(SLAB_DEFAULT_BLOCK_SIZE, pg_nextpower2_32(size * 32))

Definition at line 368 of file radixtree.h.

◆ RT_SPAN

#define RT_SPAN   BITS_PER_BYTE

Definition at line 312 of file radixtree.h.

◆ RT_STATS

#define RT_STATS   RT_MAKE_NAME(stats)

Definition at line 193 of file radixtree.h.

◆ RT_STR

#define RT_STR (   s)    RT_STR_(s)

Definition at line 169 of file radixtree.h.

◆ RT_STR_

#define RT_STR_ (   s)    #s

Definition at line 170 of file radixtree.h.

◆ RT_VALUE_IS_EMBEDDABLE

#define RT_VALUE_IS_EMBEDDABLE   RT_MAKE_NAME(value_is_embeddable)

Definition at line 197 of file radixtree.h.

◆ RT_VERIFY_NODE

#define RT_VERIFY_NODE   RT_MAKE_NAME(verify_node)

Definition at line 240 of file radixtree.h.

Typedef Documentation

◆ RT_CHILD_PTR

typedef union RT_CHILD_PTR RT_CHILD_PTR

◆ RT_ITER

typedef struct RT_ITER RT_ITER

Definition at line 1 of file radixtree.h.

◆ RT_NODE

typedef struct RT_NODE RT_NODE

◆ RT_NODE_16

typedef struct RT_NODE_16 RT_NODE_16

◆ RT_NODE_256

typedef struct RT_NODE_256 RT_NODE_256

◆ RT_NODE_4

typedef struct RT_NODE_4 RT_NODE_4

◆ RT_NODE_48

typedef struct RT_NODE_48 RT_NODE_48

◆ RT_NODE_ITER

typedef struct RT_NODE_ITER RT_NODE_ITER

◆ RT_RADIX_TREE

typedef struct RT_RADIX_TREE RT_RADIX_TREE

Definition at line 1 of file radixtree.h.

◆ RT_RADIX_TREE_CONTROL

◆ RT_SIZE_CLASS

◆ RT_SIZE_CLASS_ELEM

Enumeration Type Documentation

◆ RT_SIZE_CLASS

Enumerator
RT_CLASS_4 
RT_CLASS_16_LO 
RT_CLASS_16_HI 
RT_CLASS_48 
RT_CLASS_256 

Definition at line 630 of file radixtree.h.

631 {
632  RT_CLASS_4 = 0,
635  RT_CLASS_48,
637 } RT_SIZE_CLASS;
#define RT_SIZE_CLASS
Definition: radixtree.h:256
#define RT_CLASS_16_LO
Definition: radixtree.h:260
#define RT_CLASS_256
Definition: radixtree.h:263
#define RT_CLASS_16_HI
Definition: radixtree.h:261
#define RT_CLASS_48
Definition: radixtree.h:262
#define RT_CLASS_4
Definition: radixtree.h:259

Function Documentation

◆ for()

for ( )

Definition at line 1856 of file radixtree.h.

1857  {
1858  RT_SIZE_CLASS_ELEM size_class = RT_SIZE_CLASS_INFO[i];
1859  size_t inner_blocksize = RT_SLAB_BLOCK_SIZE(size_class.allocsize);
1860 
1861  tree->node_slabs[i] = SlabContextCreate(ctx,
1862  size_class.name,
1863  inner_blocksize,
1864  size_class.allocsize);
1865  }
int i
Definition: isn.c:73
tree
Definition: radixtree.h:1834
#define RT_SLAB_BLOCK_SIZE(size)
Definition: radixtree.h:368
#define RT_SIZE_CLASS_INFO
Definition: radixtree.h:258
MemoryContext SlabContextCreate(MemoryContext parent, const char *name, Size blockSize, Size chunkSize)
Definition: slab.c:322
const char * name
Definition: radixtree.h:642

References RT_SIZE_CLASS_ELEM::allocsize, i, RT_SIZE_CLASS_ELEM::name, RT_SIZE_CLASS_INFO, RT_SLAB_BLOCK_SIZE, SlabContextCreate(), and tree.

Referenced by RT_ADD_CHILD_48().

◆ MemoryContextSwitchTo()

MemoryContextSwitchTo ( old_ctx  )

Referenced by _brin_parallel_merge(), _bt_preprocess_array_keys(), _SPI_commit(), _SPI_execmem(), _SPI_make_plan_non_temp(), _SPI_procmem(), _SPI_rollback(), _SPI_save_plan(), AbortOutOfAnyTransaction(), accumArrayResult(), accumArrayResultArr(), aclexplode(), add_child_join_rel_equivalences(), add_reloption(), advance_transition_function(), advance_windowaggregate(), advance_windowaggregate_base(), afterTriggerCopyBitmap(), allocate_reloption(), AllocateRelationDesc(), AllocateSnapshotBuilder(), analyze_row_processor(), AppendIncrementalManifestData(), apply_handle_delete(), apply_handle_insert(), apply_handle_tuple_routing(), apply_handle_update(), apply_handle_update_internal(), apply_spooled_messages(), ApplyLauncherMain(), array_agg_array_combine(), array_agg_combine(), array_set_element_expanded(), array_unnest(), assign_record_type_typmod(), assign_simple_var(), Async_Notify(), AtAbort_Memory(), AtCleanup_Memory(), AtCommit_Memory(), ATRewriteTable(), AtStart_Memory(), AtSubAbort_Memory(), AtSubCleanup_Memory(), AtSubCommit_Memory(), AtSubStart_Memory(), AttachPartitionEnsureIndexes(), AttachSession(), BackendInitialize(), BackendMain(), BackgroundWriterMain(), BaseBackupAddTarget(), begin_heap_rewrite(), begin_replication_step(), BeginCopyFrom(), BeginCopyTo(), blinsert(), BlockRefTableMarkBlockModified(), bloomBuildCallback(), bpchar_sortsupport(), brin_build_desc(), brin_build_empty_tuple(), brin_deform_tuple(), brin_minmax_multi_add_value(), brin_minmax_multi_union(), brin_revmap_data(), bringetbitmap(), brininsert(), brtuple_disk_tupdesc(), bt_check_level_from_leftmost(), bt_multi_page_stats(), bt_page_items_bytea(), bt_page_items_internal(), btbpchar_pattern_sortsupport(), btnamesortsupport(), btree_redo(), bttext_pattern_sortsupport(), bttextsortsupport(), btvacuumpage(), BuildCachedPlan(), BuildEventTriggerCache(), BuildHardcodedDescriptor(), BuildParamLogString(), BuildRelationExtStatistics(), buildSubPlanHash(), BuildTupleHashTableExt(), bytea_sortsupport(), cache_lookup(), cache_store_tuple(), cached_scansel(), cachedNamespacePath(), CatalogCacheCreateEntry(), CatalogCacheInitializeCache(), check_default_partition_contents(), check_domain_for_new_field(), check_domain_for_new_tuple(), CheckpointerMain(), CloneRowTriggersToPartition(), compactify_ranges(), compile_plperl_function(), compile_pltcl_function(), CompleteCachedPlan(), compute_array_stats(), compute_distinct_stats(), compute_expr_stats(), compute_index_stats(), compute_range_stats(), compute_scalar_stats(), compute_tsvector_stats(), ComputeExtStatisticsRows(), connectby(), connectby_text(), connectby_text_serial(), convert_prep_stmt_params(), convert_value_to_string(), CopyCachedPlan(), CopyFrom(), CopyMultiInsertBufferFlush(), CopyOneRowTo(), create_cursor(), create_join_clause(), create_unique_path(), CreateCachedPlan(), CreateDecodingContext(), CreateExecutorState(), CreateExprContextInternal(), CreateIncrementalBackupInfo(), CreateInitDecodingContext(), CreateParallelContext(), CreatePartitionDirectory(), createTrgmNFA(), CreateTriggerFiringOn(), crosstab(), crosstab_hash(), daitch_mokotoff(), dblink_get_pkey(), deconstruct_expanded_array(), DiscreteKnapsack(), do_analyze_rel(), do_autovacuum(), do_cast_value(), do_compile(), do_numeric_accum(), do_numeric_discard(), do_start_worker(), domain_check_input(), DoPortalRewind(), dsnowball_lexize(), each_object_field_end(), each_worker_jsonb(), elements_array_element_end(), elements_worker_jsonb(), EmitErrorReport(), ensure_free_space_in_buffer(), errbacktrace(), errcontext_msg(), errdetail(), errdetail_internal(), errdetail_log(), errdetail_log_plural(), errdetail_plural(), errfinish(), errhint(), errhint_plural(), errmsg(), errmsg_internal(), errmsg_plural(), eval_windowaggregates(), eval_windowfunction(), EvalOrderByExpressions(), EvalPlanQualEnd(), EvalPlanQualNext(), EvalPlanQualSlot(), EvalPlanQualStart(), evaluate_expr(), EventTriggerAlterTableEnd(), EventTriggerAlterTableStart(), EventTriggerCollectAlterDefPrivs(), EventTriggerCollectAlterOpFam(), EventTriggerCollectAlterTableSubcmd(), EventTriggerCollectAlterTSConfig(), EventTriggerCollectCreateOpClass(), EventTriggerCollectGrant(), EventTriggerCollectSimpleCommand(), EventTriggerInvoke(), EventTriggerSQLDropAddObject(), exec_assign_c_string(), exec_bind_message(), exec_describe_portal_message(), exec_describe_statement_message(), exec_eval_datum(), exec_eval_simple_expr(), exec_eval_using_params(), exec_init_tuple_store(), Exec_ListenCommit(), exec_move_row_from_datum(), exec_parse_message(), exec_replication_command(), exec_simple_check_plan(), exec_simple_query(), exec_stmt_block(), exec_stmt_close(), exec_stmt_fetch(), exec_stmt_forc(), exec_stmt_foreach_a(), exec_stmt_getdiag(), exec_stmt_open(), exec_stmt_raise(), exec_stmt_return_next(), exec_stmt_return_query(), ExecAggCopyTransValue(), ExecAggInitGroup(), ExecAggPlainTransByRef(), ExecAggPlainTransByVal(), ExecCallTriggerFunc(), ExecComputeStoredGenerated(), ExecCrossPartitionUpdate(), ExecEvalConvertRowtype(), ExecEvalExprSwitchContext(), ExecEvalHashedScalarArrayOp(), ExecEvalPreOrderedDistinctSingle(), ExecEvalWholeRowVar(), ExecFindMatchingSubPlans(), ExecFindPartition(), ExecForceStoreHeapTuple(), ExecGetAllUpdatedCols(), ExecGetReturningSlot(), ExecGetRootToChildMap(), ExecGetTriggerNewSlot(), ExecGetTriggerOldSlot(), ExecGetTriggerResultRel(), ExecHashGetHashValue(), ExecHashIncreaseNumBatches(), ExecHashJoinSaveTuple(), ExecHashTableCreate(), ExecHashTableReset(), ExecIndexEvalArrayKeys(), ExecIndexEvalRuntimeKeys(), ExecInitPartitionDispatchInfo(), ExecInitPartitionInfo(), ExecInitRoutingInfo(), ExecInitStoredGenerated(), ExecInsert(), ExecInterpExpr(), ExecMakeFunctionResultSet(), ExecMakeTableFunctionResult(), ExecParallelHashEnsureBatchAccessors(), ExecParallelHashJoinSetUpBatches(), ExecParallelRetrieveInstrumentation(), ExecPartitionCheck(), ExecPrepareCheck(), ExecPrepareExpr(), ExecPrepareExprList(), ExecPrepareQual(), ExecPrepareTuplestoreResult(), ExecProjectSRF(), ExecRelCheck(), ExecScanSubPlan(), ExecSetParamPlan(), execTuplesUnequal(), execute_sql_string(), executeDateTimeMethod(), ExecutorRewind(), ExecVacuum(), expand_array(), expand_vacuum_rel(), expanded_record_set_field_internal(), expanded_record_set_fields(), expanded_record_set_tuple(), explain_ExecutorEnd(), explain_ExecutorStart(), ExplainExecuteQuery(), ExportSnapshot(), fetch_array_arg_replace_nulls(), fetch_more_data(), FetchTableStates(), file_acquire_sample_rows(), fileIterateForeignScan(), fill_hba_view(), fill_ident_view(), finalize_aggregate(), finalize_partialaggregate(), finalize_windowaggregate(), FinalizeIncrementalManifest(), find_plan(), FindTupleHashEntry(), fmgr_security_definer(), fmgr_sql(), ForeignNext(), format_elog_string(), format_expr_params(), format_preparedparamsdata(), generate_partition_qual(), generate_series_step_int4(), generate_series_step_int8(), generate_series_step_numeric(), generate_series_timestamp(), generate_series_timestamptz_internal(), generate_subscripts(), geqo_eval(), get_actual_variable_endpoint(), get_actual_variable_range(), get_all_vacuum_rels(), get_cast_hashentry(), get_database_list(), get_eclass_for_sort_expr(), get_qual_for_range(), get_record_type_from_query(), get_rel_sync_entry(), get_subscription_list(), get_tables_to_cluster(), get_tables_to_cluster_partitioned(), GetAfterTriggersStoreSlot(), GetAfterTriggersTableData(), GetCachedExpression(), GetConnection(), GetCurrentFDWTuplestore(), getmissingattr(), GetNamedDSMSegment(), GetSearchPathMatcher(), GetSessionDsmHandle(), GetWALRecordsInfo(), GetXLogSummaryStats(), gin_leafpage_items(), gin_redo(), ginbuild(), ginBuildCallback(), ginHeapTupleBulkInsert(), gininsert(), ginInsertCleanup(), ginPlaceToPage(), ginVacuumPostingTreeLeaves(), gist_indexsortbuild_levelstate_flush(), gist_redo(), gistbeginscan(), gistbuild(), gistBuildCallback(), gistEmptyAllBuffers(), gistFetchTuple(), gistGetNodeBuffer(), gistgettuple(), gistinsert(), gistPushItupToNodeBuffer(), gistrescan(), gistScanPage(), gistSortedBuildCallback(), gistvacuumscan(), HandleParallelApplyMessages(), HandleParallelMessages(), hash_array(), hash_page_items(), heap_page_items(), hypothetical_dense_rank_final(), index_getprocinfo(), index_register(), init_sexpr(), init_sql_fcache(), init_tuple_slot(), InitCatCache(), InitDeadLockChecking(), initGISTstate(), initialize_aggregate(), initialize_brin_insertstate(), initialize_target_list(), initialize_windowaggregate(), InitializeLogRepWorker(), InitializeParallelDSM(), InitializeSearchPath(), InitMaterializedSRF(), initTrie(), injection_points_attach(), injection_points_detach(), inline_function(), inline_set_returning_function(), innerrel_is_unique(), int8_avg_combine(), json_agg_transfn_worker(), json_object_agg_transfn_worker(), json_object_keys(), json_unique_builder_get_throwawaybuf(), jsonb_agg_transfn_worker(), jsonb_object_agg_transfn_worker(), jsonb_object_keys(), jsonb_path_query_internal(), JsonTablePlanScanNextRow(), JsonTableResetRowPattern(), keyGetItem(), LaunchParallelWorkers(), libpqrcv_processTuples(), llvm_compile_module(), llvm_session_initialize(), load_categories_hash(), load_domaintype_info(), load_enum_cache_data(), load_hba(), load_ident(), load_tzoffsets(), LogicalParallelApplyLoop(), logicalrep_launcher_attach_dshmem(), logicalrep_partition_open(), logicalrep_rel_open(), logicalrep_relmap_update(), LogicalRepApplyLoop(), LogicalRepWorkersWakeupAtCommit(), lookup_ts_dictionary_cache(), LookupTupleHashEntry(), LookupTupleHashEntry_internal(), LookupTupleHashEntryHash(), lowerstr_ctx(), macaddr_sortsupport(), make_callstmt_target(), make_canonical_pathkey(), make_datum_param(), make_expanded_record_from_datum(), make_expanded_record_from_exprecord(), make_expanded_record_from_tupdesc(), make_tuple_from_result_row(), make_tuple_indirect(), makeArrayResultArr(), makeIntervalAggState(), makeMdArrayResult(), makeNumericAggState(), makeStringAggState(), MakeTransitionCaptureState(), mark_dummy_rel(), MarkGUCPrefixReserved(), materializeResult(), maybe_reread_subscription(), MemoizeHash_equal(), MemoizeHash_hash(), MJCompare(), MJEvalInnerValues(), MJEvalOuterValues(), moveSplitTableRows(), multirange_unnest(), network_sortsupport(), next_field_expand(), normal_rand(), numeric_avg_combine(), numeric_combine(), numeric_poly_combine(), numeric_sortsupport(), operator_predicate_proof(), ordered_set_startup(), pa_launch_parallel_worker(), pa_start_subtrans(), perform_work_item(), PerformCursorOpen(), PersistHoldablePortal(), pg_backup_start(), pg_buffercache_pages(), pg_check_frozen(), pg_check_visible(), pg_decode_change(), pg_decode_truncate(), pg_get_catalog_foreign_keys(), pg_get_keywords(), pg_get_multixact_members(), pg_get_publication_tables(), pg_get_wal_block_info(), pg_lock_status(), pg_logical_slot_get_changes_guts(), pg_partition_ancestors(), pg_partition_tree(), pg_prepared_xact(), pg_stats_ext_mcvlist_items(), pg_timezone_abbrevs(), pg_visibility_map_rel(), pg_visibility_rel(), pgarch_archiveXlog(), pgoutput_change(), pgoutput_row_filter_init(), pgoutput_truncate(), pgp_armor_headers(), pgss_ExecutorStart(), pgstat_attach_shmem(), plperl_return_next(), plperl_return_next_internal(), plperl_spi_commit(), plperl_spi_exec(), plperl_spi_exec_prepared(), plperl_spi_fetchrow(), plperl_spi_prepare(), plperl_spi_query(), plperl_spi_query_prepared(), plperl_spi_rollback(), plperl_util_elog(), plpgsql_compile_inline(), plpgsql_create_econtext(), plpgsql_exec_function(), plpgsql_fulfill_promise(), plpgsql_parse_cwordrowtype(), plpgsql_parse_cwordtype(), pltcl_commit(), pltcl_elog(), pltcl_func_handler(), pltcl_init_tuple_store(), pltcl_rollback(), pltcl_SPI_prepare(), pltcl_subtrans_abort(), pltcl_subtrans_begin(), pltcl_subtrans_commit(), pltcl_subtransaction(), PLy_abort_open_subtransactions(), PLy_commit(), PLy_input_convert(), PLy_input_from_tuple(), PLy_output(), PLy_procedure_create(), PLy_rollback(), PLy_spi_execute_fetch_result(), PLy_spi_prepare(), PLy_spi_subtransaction_abort(), PLy_spi_subtransaction_begin(), PLy_spi_subtransaction_commit(), PLy_subtransaction_enter(), PLy_subtransaction_exit(), PopTransaction(), populate_recordset_worker(), populate_typ_list(), PortalCreateHoldStore(), PortalDrop(), PortalRun(), PortalRunFetch(), PortalRunUtility(), PortalStart(), PostgresMain(), postmaster_child_launch(), PostmasterMain(), postquel_get_single_result(), prep_domain_constraints(), prepare_probe_slot(), PrepareClientEncoding(), PrepareForIncrementalBackup(), printtup(), process_ordered_aggregate_single(), ProcessStartupPacket(), prs_setup_firstcall(), pub_collist_to_bitmapset(), publicationListToArray(), queue_listen(), RE_compile_and_cache(), rebuild_database_list(), recomputeNamespacePath(), regexp_matches(), regexp_split_to_table(), register_label_provider(), register_on_commit_action(), ReindexMultipleTables(), ReindexPartitions(), ReindexRelationConcurrently(), RelationBuildDesc(), RelationBuildLocalRelation(), RelationBuildPartitionDesc(), RelationBuildPartitionKey(), RelationBuildPublicationDesc(), RelationBuildRowSecurity(), RelationBuildRuleLock(), RelationBuildTriggers(), RelationBuildTupleDesc(), RelationCacheInitializePhase2(), RelationCacheInitializePhase3(), RelationGetExclusionInfo(), RelationGetFKeyList(), RelationGetIdentityKeyBitmap(), RelationGetIndexAttOptions(), RelationGetIndexAttrBitmap(), RelationGetIndexExpressions(), RelationGetIndexList(), RelationGetIndexPredicate(), RelationGetStatExtList(), RelationInitIndexAccessInfo(), ReleaseCurrentSubTransaction(), RememberSyncRequest(), RememberToFreeTupleDescAtEOX(), ReorderBufferAddInvalidations(), ReorderBufferProcessTXN(), ReorderBufferQueueMessage(), ReorderBufferToastReplace(), reorderqueue_push(), reparameterize_path_by_child(), resetSpGistScanOpaque(), ResetUnloggedRelations(), RestoreReindexState(), ReThrowError(), RevalidateCachedQuery(), rewrite_heap_tuple(), roles_is_member_of(), RunFromStore(), scanPendingInsert(), SearchCatCacheList(), send_feedback(), sepgsql_avc_compute(), sepgsql_fmgr_hook(), sepgsql_set_client_label(), serializeAnalyzeReceive(), set_schema_sent_in_streamed_txn(), setup_background_workers(), setup_firstcall(), SharedRecordTypmodRegistryAttach(), SharedRecordTypmodRegistryInit(), shdepReassignOwned(), show_all_settings(), ShutdownExprContext(), SnapBuildSerialize(), spg_box_quad_inner_consistent(), spg_kd_inner_consistent(), spg_quad_inner_consistent(), spg_range_quad_inner_consistent(), spg_redo(), spgInnerTest(), spginsert(), spgistBuildCallback(), spgLeafTest(), SPI_connect_ext(), SPI_copytuple(), SPI_cursor_open_internal(), SPI_datumTransfer(), spi_dest_startup(), SPI_finish(), SPI_modifytuple(), spi_printtup(), SPI_returntuple(), spool_tuples(), ssl_extension_info(), standard_ExecutorEnd(), standard_ExecutorFinish(), standard_ExecutorRun(), standard_ExecutorStart(), standard_ExplainOneQuery(), startScanKey(), StartTransactionCommand(), StartupDecodingContext(), statext_dependencies_build(), store_flush_position(), storeRow(), stream_open_file(), stream_start_internal(), string_agg_combine(), strlist_to_textarray(), sts_parallel_scan_next(), sts_puttuple(), subxact_info_add(), subxact_info_read(), test_create(), test_pattern(), test_regex(), tfuncFetchRows(), tfuncLoadRows(), ThrowErrorData(), tokenize_auth_file(), tokenize_expand_file(), TriggerEnabled(), ts_setup_firstcall(), tsquery_rewrite_query(), tstoreReceiveSlot_detoast(), tsvector_unnest(), tt_setup_firstcall(), tts_buffer_heap_copyslot(), tts_buffer_heap_materialize(), tts_heap_copyslot(), tts_heap_materialize(), tts_minimal_copyslot(), tts_minimal_materialize(), TupleHashTableHash(), tuplesort_begin_batch(), tuplesort_begin_cluster(), tuplesort_begin_common(), tuplesort_begin_datum(), tuplesort_begin_heap(), tuplesort_begin_index_btree(), tuplesort_begin_index_gist(), tuplesort_begin_index_hash(), tuplesort_free(), tuplesort_getbrintuple(), tuplesort_getdatum(), tuplesort_getheaptuple(), tuplesort_getindextuple(), tuplesort_gettupleslot(), tuplesort_markpos(), tuplesort_performsort(), tuplesort_putbrintuple(), tuplesort_putdatum(), tuplesort_putheaptuple(), tuplesort_puttuple_common(), tuplesort_puttupleslot(), tuplesort_rescan(), tuplesort_restorepos(), tuplesort_skiptuples(), tuplestore_puttuple(), tuplestore_puttuple_common(), tuplestore_puttupleslot(), tuplestore_putvalues(), union_tuples(), update_cached_tupdesc(), update_frameheadpos(), update_frametailpos(), update_grouptailpos(), uuid_sortsupport(), vacuum(), validateForeignKeyConstraint(), ValuesNext(), WalSummarizerMain(), WalWriterMain(), window_gettupleslot(), and XLogInsertRecord().

◆ RT_ADD_CHILD_16()

static RT_PTR_ALLOC* RT_ADD_CHILD_16 ( RT_RADIX_TREE tree,
RT_CHILD_PTR  node,
uint8  chunk 
)
inlinestatic

Definition at line 1458 of file radixtree.h.

1459 {
1460  RT_NODE_16 *n16 = (RT_NODE_16 *) node.local;
1461  int insertpos = RT_NODE_16_GET_INSERTPOS(n16, chunk);
1462 
1463  /* shift chunks and children */
1465  n16->base.count, insertpos);
1466 
1467  /* insert new chunk into place */
1468  n16->chunks[insertpos] = chunk;
1469 
1470  n16->base.count++;
1471  RT_VERIFY_NODE((RT_NODE *) n16);
1472 
1473  return &n16->children[insertpos];
1474 }
uint64 chunk
#define RT_NODE_16_GET_INSERTPOS
Definition: radixtree.h:211
#define RT_VERIFY_NODE
Definition: radixtree.h:240
#define RT_SHIFT_ARRAYS_FOR_INSERT
Definition: radixtree.h:212
RT_NODE base
Definition: radixtree.h:528
RT_PTR_ALLOC children[FLEXIBLE_ARRAY_MEMBER]
Definition: radixtree.h:533
uint8 chunks[RT_FANOUT_16_MAX]
Definition: radixtree.h:530
uint8 count
Definition: radixtree.h:392
RT_NODE * local
Definition: radixtree.h:419

References RT_NODE_16::base, RT_NODE_16::children, chunk, RT_NODE_16::chunks, RT_NODE::count, RT_CHILD_PTR::local, RT_NODE_16_GET_INSERTPOS, RT_SHIFT_ARRAYS_FOR_INSERT, and RT_VERIFY_NODE.

◆ RT_ADD_CHILD_256()

static RT_PTR_ALLOC* RT_ADD_CHILD_256 ( RT_RADIX_TREE tree,
RT_CHILD_PTR  node,
uint8  chunk 
)
inlinestatic

Definition at line 1270 of file radixtree.h.

1271 {
1272  RT_NODE_256 *n256 = (RT_NODE_256 *) node.local;
1273  int idx = RT_BM_IDX(chunk);
1274  int bitnum = RT_BM_BIT(chunk);
1275 
1276  /* Mark the slot used for "chunk" */
1277  n256->isset[idx] |= ((bitmapword) 1 << bitnum);
1278 
1279  n256->base.count++;
1280  RT_VERIFY_NODE((RT_NODE *) n256);
1281 
1282  return RT_NODE_256_GET_CHILD(n256, chunk);
1283 }
Datum idx(PG_FUNCTION_ARGS)
Definition: _int_op.c:259
uint32 bitmapword
Definition: bitmapset.h:44
#define RT_BM_BIT(x)
Definition: radixtree.h:334
#define RT_NODE_256_GET_CHILD
Definition: radixtree.h:219
#define RT_BM_IDX(x)
Definition: radixtree.h:333
RT_NODE base
Definition: radixtree.h:568
bitmapword isset[RT_BM_IDX(RT_FANOUT_256)]
Definition: radixtree.h:571

References RT_NODE_256::base, chunk, RT_NODE::count, idx(), RT_NODE_256::isset, RT_CHILD_PTR::local, RT_BM_BIT, RT_BM_IDX, RT_NODE_256_GET_CHILD, and RT_VERIFY_NODE.

◆ RT_ADD_CHILD_4()

static RT_PTR_ALLOC* RT_ADD_CHILD_4 ( RT_RADIX_TREE tree,
RT_CHILD_PTR  node,
uint8  chunk 
)
inlinestatic

Definition at line 1511 of file radixtree.h.

1512 {
1513  RT_NODE_4 *n4 = (RT_NODE_4 *) (node.local);
1514  int count = n4->base.count;
1515  int insertpos = RT_NODE_4_GET_INSERTPOS(n4, chunk, count);
1516 
1517  /* shift chunks and children */
1519  count, insertpos);
1520 
1521  /* insert new chunk into place */
1522  n4->chunks[insertpos] = chunk;
1523 
1524  n4->base.count++;
1525  RT_VERIFY_NODE((RT_NODE *) n4);
1526 
1527  return &n4->children[insertpos];
1528 }
#define RT_NODE_4_GET_INSERTPOS
Definition: radixtree.h:210
RT_PTR_ALLOC children[FLEXIBLE_ARRAY_MEMBER]
Definition: radixtree.h:523
RT_NODE base
Definition: radixtree.h:518
uint8 chunks[RT_FANOUT_4_MAX]
Definition: radixtree.h:520

References RT_NODE_4::base, RT_NODE_4::children, chunk, RT_NODE_4::chunks, RT_NODE::count, RT_CHILD_PTR::local, RT_NODE_4_GET_INSERTPOS, RT_SHIFT_ARRAYS_FOR_INSERT, and RT_VERIFY_NODE.

◆ RT_ADD_CHILD_48()

static RT_PTR_ALLOC* RT_ADD_CHILD_48 ( RT_RADIX_TREE tree,
RT_CHILD_PTR  node,
uint8  chunk 
)
inlinestatic

Definition at line 1333 of file radixtree.h.

1334 {
1335  RT_NODE_48 *n48 = (RT_NODE_48 *) node.local;
1336  int insertpos;
1337  int idx = 0;
1338  bitmapword w,
1339  inverse;
1340 
1341  /* get the first word with at least one bit not set */
1342  for (int i = 0; i < RT_BM_IDX(RT_FANOUT_48_MAX); i++)
1343  {
1344  w = n48->isset[i];
1345  if (w < ~((bitmapword) 0))
1346  {
1347  idx = i;
1348  break;
1349  }
1350  }
1351 
1352  /* To get the first unset bit in w, get the first set bit in ~w */
1353  inverse = ~w;
1354  insertpos = idx * BITS_PER_BITMAPWORD;
1355  insertpos += bmw_rightmost_one_pos(inverse);
1356  Assert(insertpos < n48->base.fanout);
1357 
1358  /* mark the slot used by setting the rightmost zero bit */
1359  n48->isset[idx] |= w + 1;
1360 
1361  /* insert new chunk into place */
1362  n48->slot_idxs[chunk] = insertpos;
1363 
1364  n48->base.count++;
1365  RT_VERIFY_NODE((RT_NODE *) n48);
1366 
1367  return &n48->children[insertpos];
1368 }
#define bmw_rightmost_one_pos(w)
Definition: bitmapset.h:79
#define BITS_PER_BITMAPWORD
Definition: bitmapset.h:43
#define Assert(condition)
Definition: c.h:858
for(int i=0;i< RT_NUM_SIZE_CLASSES;i++)
Definition: radixtree.h:1856
#define RT_FANOUT_48_MAX
Definition: radixtree.h:502
RT_PTR_ALLOC children[FLEXIBLE_ARRAY_MEMBER]
Definition: radixtree.h:558
uint8 slot_idxs[RT_NODE_MAX_SLOTS]
Definition: radixtree.h:552
RT_NODE base
Definition: radixtree.h:542
bitmapword isset[RT_BM_IDX(RT_FANOUT_48_MAX)]
Definition: radixtree.h:545

References Assert, RT_NODE_48::base, BITS_PER_BITMAPWORD, bmw_rightmost_one_pos, RT_NODE_48::children, chunk, RT_NODE::count, for(), i, idx(), RT_NODE_48::isset, RT_CHILD_PTR::local, RT_BM_IDX, RT_FANOUT_48_MAX, RT_VERIFY_NODE, and RT_NODE_48::slot_idxs.

◆ RT_ALLOC_LEAF()

static RT_CHILD_PTR RT_ALLOC_LEAF ( RT_RADIX_TREE tree,
size_t  allocsize 
)
static

Definition at line 895 of file radixtree.h.

896 {
897  RT_CHILD_PTR leaf;
898 
899 #ifdef RT_SHMEM
900  leaf.alloc = dsa_allocate(tree->dsa, allocsize);
901  RT_PTR_SET_LOCAL(tree, &leaf);
902 #else
903  leaf.alloc = (RT_PTR_ALLOC) MemoryContextAlloc(tree->leaf_context, allocsize);
904 #endif
905 
906 #ifdef RT_DEBUG
907  tree->ctl->num_leaves++;
908 #endif
909 
910  return leaf;
911 }
#define dsa_allocate(area, size)
Definition: dsa.h:109
void * MemoryContextAlloc(MemoryContext context, Size size)
Definition: mcxt.c:1181
#define RT_PTR_SET_LOCAL
Definition: radixtree.h:208
#define RT_PTR_ALLOC
Definition: radixtree.h:402
RT_PTR_ALLOC alloc
Definition: radixtree.h:418

References RT_CHILD_PTR::alloc, dsa_allocate, MemoryContextAlloc(), RT_PTR_ALLOC, RT_PTR_SET_LOCAL, and tree.

◆ RT_ALLOC_NODE()

static RT_CHILD_PTR RT_ALLOC_NODE ( RT_RADIX_TREE tree,
const uint8  kind,
const RT_SIZE_CLASS  size_class 
)
inlinestatic

Definition at line 832 of file radixtree.h.

833 {
834  RT_CHILD_PTR allocnode;
835  RT_NODE *node;
836  size_t allocsize;
837 
838  allocsize = RT_SIZE_CLASS_INFO[size_class].allocsize;
839 
840 #ifdef RT_SHMEM
841  allocnode.alloc = dsa_allocate(tree->dsa, allocsize);
842 #else
843  allocnode.alloc = (RT_PTR_ALLOC) MemoryContextAlloc(tree->node_slabs[size_class],
844  allocsize);
845 #endif
846 
847  RT_PTR_SET_LOCAL(tree, &allocnode);
848  node = allocnode.local;
849 
850  /* initialize contents */
851 
852  switch (kind)
853  {
854  case RT_NODE_KIND_4:
855  memset(node, 0, offsetof(RT_NODE_4, children));
856  break;
857  case RT_NODE_KIND_16:
858  memset(node, 0, offsetof(RT_NODE_16, children));
859  break;
860  case RT_NODE_KIND_48:
861  {
862  RT_NODE_48 *n48 = (RT_NODE_48 *) node;
863 
864  memset(n48, 0, offsetof(RT_NODE_48, slot_idxs));
865  memset(n48->slot_idxs, RT_INVALID_SLOT_IDX, sizeof(n48->slot_idxs));
866  break;
867  }
868  case RT_NODE_KIND_256:
869  memset(node, 0, offsetof(RT_NODE_256, children));
870  break;
871  default:
872  pg_unreachable();
873  }
874 
875  node->kind = kind;
876 
877  /*
878  * For node256, this will actually overflow to zero, but that's okay
879  * because that node doesn't need to introspect this value.
880  */
881  node->fanout = RT_SIZE_CLASS_INFO[size_class].fanout;
882 
883 #ifdef RT_DEBUG
884  /* update the statistics */
885  tree->ctl->num_nodes[size_class]++;
886 #endif
887 
888  return allocnode;
889 }
#define pg_unreachable()
Definition: c.h:296
#define RT_NODE_KIND_16
Definition: radixtree.h:359
#define RT_INVALID_SLOT_IDX
Definition: radixtree.h:555
#define RT_NODE_KIND_48
Definition: radixtree.h:360
#define RT_NODE_KIND_256
Definition: radixtree.h:361
#define RT_NODE_KIND_4
Definition: radixtree.h:358
uint8 kind
Definition: radixtree.h:375
uint8 fanout
Definition: radixtree.h:384

References RT_CHILD_PTR::alloc, dsa_allocate, RT_NODE::fanout, RT_NODE::kind, RT_CHILD_PTR::local, MemoryContextAlloc(), pg_unreachable, RT_INVALID_SLOT_IDX, RT_NODE_KIND_16, RT_NODE_KIND_256, RT_NODE_KIND_4, RT_NODE_KIND_48, RT_PTR_ALLOC, RT_PTR_SET_LOCAL, RT_SIZE_CLASS_INFO, RT_NODE_48::slot_idxs, and tree.

◆ RT_BEGIN_ITERATE()

RT_SCOPE RT_ITER * RT_BEGIN_ITERATE ( RT_RADIX_TREE tree)

Definition at line 2082 of file radixtree.h.

2083 {
2084  RT_ITER *iter;
2086 
2087  iter = (RT_ITER *) MemoryContextAllocZero(tree->iter_context,
2088  sizeof(RT_ITER));
2089  iter->tree = tree;
2090 
2091  Assert(RT_PTR_ALLOC_IS_VALID(tree->ctl->root));
2092  root.alloc = iter->tree->ctl->root;
2094 
2095  iter->top_level = iter->tree->ctl->start_shift / RT_SPAN;
2096 
2097  /* Set the root to start */
2098  iter->cur_level = iter->top_level;
2099  iter->node_iters[iter->cur_level].node = root;
2100  iter->node_iters[iter->cur_level].idx = 0;
2101 
2102  return iter;
2103 }
void * MemoryContextAllocZero(MemoryContext context, Size size)
Definition: mcxt.c:1215
#define RT_SPAN
Definition: radixtree.h:312
tree ctl root
Definition: radixtree.h:1886
#define RT_PTR_ALLOC_IS_VALID(ptr)
Definition: radixtree.h:404
RT_NODE_ITER node_iters[RT_MAX_LEVEL]
Definition: radixtree.h:752
int cur_level
Definition: radixtree.h:754
RT_RADIX_TREE * tree
Definition: radixtree.h:746
int top_level
Definition: radixtree.h:753
RT_CHILD_PTR node
Definition: radixtree.h:733
RT_PTR_ALLOC root
Definition: radixtree.h:692
RT_RADIX_TREE_CONTROL * ctl
Definition: radixtree.h:710

References Assert, RT_RADIX_TREE::ctl, RT_ITER::cur_level, RT_NODE_ITER::idx, MemoryContextAllocZero(), RT_NODE_ITER::node, RT_ITER::node_iters, RT_RADIX_TREE_CONTROL::root, root, RT_PTR_ALLOC_IS_VALID, RT_PTR_SET_LOCAL, RT_SPAN, RT_RADIX_TREE_CONTROL::start_shift, RT_ITER::top_level, RT_ITER::tree, and tree.

◆ RT_CHILDPTR_IS_VALUE()

static bool RT_CHILDPTR_IS_VALUE ( RT_PTR_ALLOC  child)
inlinestatic

Definition at line 461 of file radixtree.h.

462 {
463 #ifdef RT_VARLEN_VALUE_SIZE
464 
465 #ifdef RT_RUNTIME_EMBEDDABLE_VALUE
466  /* check for pointer tag */
467 #ifdef RT_SHMEM
468  return child & 1;
469 #else
470  return ((uintptr_t) child) & 1;
471 #endif
472 
473 #else
474  return false;
475 #endif
476 
477 #else
478  return sizeof(RT_VALUE_TYPE) <= sizeof(RT_PTR_ALLOC);
479 #endif
480 }
#define RT_VALUE_TYPE
Definition: tidstore.c:106

References RT_PTR_ALLOC, and RT_VALUE_TYPE.

◆ RT_COPY_ARRAYS_FOR_INSERT()

static void RT_COPY_ARRAYS_FOR_INSERT ( uint8 dst_chunks,
RT_PTR_ALLOC dst_children,
uint8 src_chunks,
RT_PTR_ALLOC src_children,
int  count,
int  insertpos 
)
inlinestatic

Definition at line 1253 of file radixtree.h.

1256 {
1257  for (int i = 0; i < count; i++)
1258  {
1259  int sourceidx = i;
1260 
1261  /* use a branch-free computation to skip the index of the new element */
1262  int destidx = i + (i >= insertpos);
1263 
1264  dst_chunks[destidx] = src_chunks[sourceidx];
1265  dst_children[destidx] = src_children[sourceidx];
1266  }
1267 }

References i.

◆ RT_COPY_COMMON()

static void RT_COPY_COMMON ( RT_CHILD_PTR  newnode,
RT_CHILD_PTR  oldnode 
)
inlinestatic

Definition at line 918 of file radixtree.h.

919 {
920  (newnode.local)->count = (oldnode.local)->count;
921 }

References RT_CHILD_PTR::local.

◆ RT_CREATE()

RT_SCOPE RT_RADIX_TREE* RT_CREATE ( MemoryContext  ctx)

◆ RT_END_ITERATE()

RT_SCOPE void RT_END_ITERATE ( RT_ITER iter)

Definition at line 2256 of file radixtree.h.

2257 {
2258  pfree(iter);
2259 }
void pfree(void *pointer)
Definition: mcxt.c:1521

References pfree().

◆ RT_EXTEND_DOWN()

static pg_noinline RT_PTR_ALLOC* RT_EXTEND_DOWN ( RT_RADIX_TREE tree,
RT_PTR_ALLOC parent_slot,
uint64  key,
int  shift 
)
static

Definition at line 1614 of file radixtree.h.

1615 {
1616  RT_CHILD_PTR node,
1617  child;
1618  RT_NODE_4 *n4;
1619 
1620  /*
1621  * The child pointer of the first node in the chain goes in the
1622  * caller-provided slot.
1623  */
1625  *parent_slot = child.alloc;
1626 
1627  node = child;
1628  shift -= RT_SPAN;
1629 
1630  while (shift > 0)
1631  {
1633 
1634  /* We open-code the insertion ourselves, for speed. */
1635  n4 = (RT_NODE_4 *) node.local;
1636  n4->base.count = 1;
1637  n4->chunks[0] = RT_GET_KEY_CHUNK(key, shift);
1638  n4->children[0] = child.alloc;
1639 
1640  node = child;
1641  shift -= RT_SPAN;
1642  }
1643  Assert(shift == 0);
1644 
1645  /* Reserve slot for the value. */
1646  n4 = (RT_NODE_4 *) node.local;
1647  n4->chunks[0] = RT_GET_KEY_CHUNK(key, 0);
1648  n4->base.count = 1;
1649 
1650  return &n4->children[0];
1651 }
#define RT_ALLOC_NODE
Definition: radixtree.h:200
#define RT_GET_KEY_CHUNK(key, shift)
Definition: radixtree.h:330

References RT_CHILD_PTR::alloc, Assert, RT_NODE_4::base, RT_NODE_4::children, RT_NODE_4::chunks, RT_NODE::count, sort-test::key, RT_CHILD_PTR::local, RT_ALLOC_NODE, RT_CLASS_4, RT_GET_KEY_CHUNK, RT_NODE_KIND_4, RT_SPAN, and tree.

◆ RT_EXTEND_UP()

static pg_noinline void RT_EXTEND_UP ( RT_RADIX_TREE tree,
uint64  key 
)
static

Definition at line 1579 of file radixtree.h.

1580 {
1581  int target_shift = RT_KEY_GET_SHIFT(key);
1582  int shift = tree->ctl->start_shift;
1583 
1584  Assert(shift < target_shift);
1585 
1586  /* Grow tree upwards until start shift can accommodate the key */
1587  while (shift < target_shift)
1588  {
1589  RT_CHILD_PTR node;
1590  RT_NODE_4 *n4;
1591 
1593  n4 = (RT_NODE_4 *) node.local;
1594  n4->base.count = 1;
1595  n4->chunks[0] = 0;
1596  n4->children[0] = tree->ctl->root;
1597 
1598  /* Update the root */
1599  tree->ctl->root = node.alloc;
1600 
1601  shift += RT_SPAN;
1602  }
1603 
1604  tree->ctl->max_val = RT_SHIFT_GET_MAX_VAL(target_shift);
1605  tree->ctl->start_shift = target_shift;
1606 }
#define RT_SHIFT_GET_MAX_VAL
Definition: radixtree.h:221
#define RT_KEY_GET_SHIFT
Definition: radixtree.h:220

References RT_CHILD_PTR::alloc, Assert, RT_NODE_4::base, RT_NODE_4::children, RT_NODE_4::chunks, RT_NODE::count, sort-test::key, RT_CHILD_PTR::local, RT_ALLOC_NODE, RT_CLASS_4, RT_KEY_GET_SHIFT, RT_NODE_KIND_4, RT_SHIFT_GET_MAX_VAL, RT_SPAN, and tree.

◆ RT_FIND()

RT_SCOPE RT_VALUE_TYPE * RT_FIND ( RT_RADIX_TREE tree,
uint64  key 
)

Definition at line 1092 of file radixtree.h.

1093 {
1094  RT_CHILD_PTR node;
1095  RT_PTR_ALLOC *slot = NULL;
1096  int shift;
1097 
1098 #ifdef RT_SHMEM
1099  Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC);
1100 #endif
1101 
1102  if (key > tree->ctl->max_val)
1103  return NULL;
1104 
1105  Assert(RT_PTR_ALLOC_IS_VALID(tree->ctl->root));
1106  node.alloc = tree->ctl->root;
1107  shift = tree->ctl->start_shift;
1108 
1109  /* Descend the tree */
1110  while (shift >= 0)
1111  {
1112  RT_PTR_SET_LOCAL(tree, &node);
1113  slot = RT_NODE_SEARCH(node.local, RT_GET_KEY_CHUNK(key, shift));
1114  if (slot == NULL)
1115  return NULL;
1116 
1117  node.alloc = *slot;
1118  shift -= RT_SPAN;
1119  }
1120 
1121  if (RT_CHILDPTR_IS_VALUE(*slot))
1122  return (RT_VALUE_TYPE *) slot;
1123  else
1124  {
1125  RT_PTR_SET_LOCAL(tree, &node);
1126  return (RT_VALUE_TYPE *) node.local;
1127  }
1128 }
#define RT_NODE_SEARCH
Definition: radixtree.h:222
#define RT_CHILDPTR_IS_VALUE
Definition: radixtree.h:196

References RT_CHILD_PTR::alloc, Assert, sort-test::key, RT_CHILD_PTR::local, RT_CHILDPTR_IS_VALUE, RT_GET_KEY_CHUNK, RT_NODE_SEARCH, RT_PTR_ALLOC, RT_PTR_ALLOC_IS_VALID, RT_PTR_SET_LOCAL, RT_SPAN, RT_VALUE_TYPE, and tree.

◆ RT_FREE()

RT_SCOPE void RT_FREE ( RT_RADIX_TREE tree)

Definition at line 2049 of file radixtree.h.

2050 {
2051 #ifdef RT_SHMEM
2052  Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC);
2053 
2054  /* Free all memory used for radix tree nodes */
2055  Assert(RT_PTR_ALLOC_IS_VALID(tree->ctl->root));
2056  RT_FREE_RECURSE(tree, tree->ctl->root, tree->ctl->start_shift);
2057 
2058  /*
2059  * Vandalize the control block to help catch programming error where other
2060  * backends access the memory formerly occupied by this radix tree.
2061  */
2062  tree->ctl->magic = 0;
2063  dsa_free(tree->dsa, tree->ctl->handle);
2064 #endif
2065 
2066  /*
2067  * Free all space allocated within the tree's context and delete all child
2068  * contexts such as those used for nodes.
2069  */
2070  MemoryContextReset(tree->context);
2071 }
void dsa_free(dsa_area *area, dsa_pointer dp)
Definition: dsa.c:826
void MemoryContextReset(MemoryContext context)
Definition: mcxt.c:383
#define RT_FREE_RECURSE
Definition: radixtree.h:204

References Assert, dsa_free(), MemoryContextReset(), RT_FREE_RECURSE, RT_PTR_ALLOC_IS_VALID, and tree.

◆ RT_FREE_LEAF()

static void RT_FREE_LEAF ( RT_RADIX_TREE tree,
RT_PTR_ALLOC  leaf 
)
inlinestatic

Definition at line 957 of file radixtree.h.

958 {
959  Assert(leaf != tree->ctl->root);
960 
961 #ifdef RT_DEBUG
962  /* update the statistics */
963  tree->ctl->num_leaves--;
964  Assert(tree->ctl->num_leaves >= 0);
965 #endif
966 
967 #ifdef RT_SHMEM
968  dsa_free(tree->dsa, leaf);
969 #else
970  pfree(leaf);
971 #endif
972 }

References Assert, dsa_free(), pfree(), and tree.

◆ RT_FREE_NODE()

static void RT_FREE_NODE ( RT_RADIX_TREE tree,
RT_CHILD_PTR  node 
)
static

Definition at line 925 of file radixtree.h.

926 {
927 #ifdef RT_DEBUG
928  int i;
929 
930  /* update the statistics */
931 
932  for (i = 0; i < RT_NUM_SIZE_CLASSES; i++)
933  {
934  if ((node.local)->fanout == RT_SIZE_CLASS_INFO[i].fanout)
935  break;
936  }
937 
938  /*
939  * The fanout of node256 will appear to be zero within the node header
940  * because of overflow, so we need an extra check here.
941  */
942  if (i == RT_NUM_SIZE_CLASSES)
943  i = RT_CLASS_256;
944 
945  tree->ctl->num_nodes[i]--;
946  Assert(tree->ctl->num_nodes[i] >= 0);
947 #endif
948 
949 #ifdef RT_SHMEM
950  dsa_free(tree->dsa, node.alloc);
951 #else
952  pfree(node.alloc);
953 #endif
954 }
#define RT_NUM_SIZE_CLASSES
Definition: radixtree.h:676

References RT_CHILD_PTR::alloc, Assert, dsa_free(), i, RT_CHILD_PTR::local, pfree(), RT_CLASS_256, RT_NUM_SIZE_CLASSES, RT_SIZE_CLASS_INFO, and tree.

◆ RT_GET_SLOT_RECURSIVE()

static RT_PTR_ALLOC* RT_GET_SLOT_RECURSIVE ( RT_RADIX_TREE tree,
RT_PTR_ALLOC parent_slot,
uint64  key,
int  shift,
bool found 
)
static

Definition at line 1661 of file radixtree.h.

1662 {
1663  RT_PTR_ALLOC *slot;
1664  RT_CHILD_PTR node;
1665  uint8 chunk = RT_GET_KEY_CHUNK(key, shift);
1666 
1667  node.alloc = *parent_slot;
1668  RT_PTR_SET_LOCAL(tree, &node);
1669  slot = RT_NODE_SEARCH(node.local, chunk);
1670 
1671  if (slot == NULL)
1672  {
1673  *found = false;
1674 
1675  /* reserve slot for the caller to populate */
1676 
1677  slot = RT_NODE_INSERT(tree, parent_slot, node, chunk);
1678 
1679  if (shift == 0)
1680  return slot;
1681  else
1682  return RT_EXTEND_DOWN(tree, slot, key, shift);
1683  }
1684  else
1685  {
1686  if (shift == 0)
1687  {
1688  *found = true;
1689  return slot;
1690  }
1691  else
1692  return RT_GET_SLOT_RECURSIVE(tree, slot, key, shift - RT_SPAN, found);
1693  }
1694 }
unsigned char uint8
Definition: c.h:504
#define RT_GET_SLOT_RECURSIVE
Definition: radixtree.h:198
#define RT_EXTEND_DOWN
Definition: radixtree.h:206
#define RT_NODE_INSERT
Definition: radixtree.h:224

References RT_CHILD_PTR::alloc, chunk, sort-test::key, RT_CHILD_PTR::local, RT_EXTEND_DOWN, RT_GET_KEY_CHUNK, RT_GET_SLOT_RECURSIVE, RT_NODE_INSERT, RT_NODE_SEARCH, RT_PTR_ALLOC, RT_PTR_SET_LOCAL, RT_SPAN, and tree.

◆ RT_GROW_NODE_16()

static pg_noinline RT_PTR_ALLOC* RT_GROW_NODE_16 ( RT_RADIX_TREE tree,
RT_PTR_ALLOC parent_slot,
RT_CHILD_PTR  node,
uint8  chunk 
)
static

Definition at line 1371 of file radixtree.h.

1373 {
1374  RT_NODE_16 *n16 = (RT_NODE_16 *) node.local;
1375  int insertpos;
1376 
1377  if (n16->base.fanout < RT_FANOUT_16_HI)
1378  {
1379  RT_CHILD_PTR newnode;
1380  RT_NODE_16 *new16;
1381 
1382  Assert(n16->base.fanout == RT_FANOUT_16_LO);
1383 
1384  /* initialize new node */
1386  new16 = (RT_NODE_16 *) newnode.local;
1387 
1388  /* copy over existing entries */
1389  RT_COPY_COMMON(newnode, node);
1390  Assert(n16->base.count == RT_FANOUT_16_LO);
1391  insertpos = RT_NODE_16_GET_INSERTPOS(n16, chunk);
1392  RT_COPY_ARRAYS_FOR_INSERT(new16->chunks, new16->children,
1393  n16->chunks, n16->children,
1394  RT_FANOUT_16_LO, insertpos);
1395 
1396  /* insert new chunk into place */
1397  new16->chunks[insertpos] = chunk;
1398 
1399  new16->base.count++;
1400  RT_VERIFY_NODE((RT_NODE *) new16);
1401 
1402  /* free old node and update references */
1403  RT_FREE_NODE(tree, node);
1404  *parent_slot = newnode.alloc;
1405 
1406  return &new16->children[insertpos];
1407  }
1408  else
1409  {
1410  RT_CHILD_PTR newnode;
1411  RT_NODE_48 *new48;
1412  int idx,
1413  bit;
1414 
1415  Assert(n16->base.fanout == RT_FANOUT_16_HI);
1416 
1417  /* initialize new node */
1419  new48 = (RT_NODE_48 *) newnode.local;
1420 
1421  /* copy over the entries */
1422  RT_COPY_COMMON(newnode, node);
1423  for (int i = 0; i < RT_FANOUT_16_HI; i++)
1424  new48->slot_idxs[n16->chunks[i]] = i;
1425  memcpy(&new48->children[0], &n16->children[0], RT_FANOUT_16_HI * sizeof(new48->children[0]));
1426 
1427  /*
1428  * Since we just copied a dense array, we can fill "isset" using a
1429  * single store, provided the length of that array is at most the
1430  * number of bits in a bitmapword.
1431  */
1433  new48->isset[0] = (bitmapword) (((uint64) 1 << RT_FANOUT_16_HI) - 1);
1434 
1435  /* put the new child at the end of the copied entries */
1436  insertpos = RT_FANOUT_16_HI;
1437  idx = RT_BM_IDX(insertpos);
1438  bit = RT_BM_BIT(insertpos);
1439 
1440  /* mark the slot used */
1441  new48->isset[idx] |= ((bitmapword) 1 << bit);
1442 
1443  /* insert new chunk into place */
1444  new48->slot_idxs[chunk] = insertpos;
1445 
1446  new48->base.count++;
1447  RT_VERIFY_NODE((RT_NODE *) new48);
1448 
1449  /* free old node and update reference in parent */
1450  *parent_slot = newnode.alloc;
1451  RT_FREE_NODE(tree, node);
1452 
1453  return &new48->children[insertpos];
1454  }
1455 }
if(TABLE==NULL||TABLE_index==NULL)
Definition: isn.c:77
#define RT_COPY_ARRAYS_FOR_INSERT
Definition: radixtree.h:214
#define RT_COPY_COMMON
Definition: radixtree.h:207
#define RT_FREE_NODE
Definition: radixtree.h:202
#define RT_FANOUT_16_HI
Definition: radixtree.h:600
#define RT_FANOUT_16_LO
Definition: radixtree.h:598
Datum bit(PG_FUNCTION_ARGS)
Definition: varbit.c:391

References RT_CHILD_PTR::alloc, Assert, RT_NODE_16::base, RT_NODE_48::base, bit(), BITS_PER_BITMAPWORD, RT_NODE_16::children, RT_NODE_48::children, chunk, RT_NODE_16::chunks, RT_NODE::count, RT_NODE::fanout, i, idx(), if(), RT_NODE_48::isset, RT_CHILD_PTR::local, RT_ALLOC_NODE, RT_BM_BIT, RT_BM_IDX, RT_CLASS_16_HI, RT_CLASS_48, RT_COPY_ARRAYS_FOR_INSERT, RT_COPY_COMMON, RT_FANOUT_16_HI, RT_FANOUT_16_LO, RT_FREE_NODE, RT_NODE_16_GET_INSERTPOS, RT_NODE_KIND_16, RT_NODE_KIND_48, RT_VERIFY_NODE, RT_NODE_48::slot_idxs, and tree.

◆ RT_GROW_NODE_4()

static pg_noinline RT_PTR_ALLOC* RT_GROW_NODE_4 ( RT_RADIX_TREE tree,
RT_PTR_ALLOC parent_slot,
RT_CHILD_PTR  node,
uint8  chunk 
)
static

Definition at line 1477 of file radixtree.h.

1479 {
1480  RT_NODE_4 *n4 = (RT_NODE_4 *) (node.local);
1481  RT_CHILD_PTR newnode;
1482  RT_NODE_16 *new16;
1483  int insertpos;
1484 
1485  /* initialize new node */
1487  new16 = (RT_NODE_16 *) newnode.local;
1488 
1489  /* copy over existing entries */
1490  RT_COPY_COMMON(newnode, node);
1491  Assert(n4->base.count == RT_FANOUT_4);
1492  insertpos = RT_NODE_4_GET_INSERTPOS(n4, chunk, RT_FANOUT_4);
1493  RT_COPY_ARRAYS_FOR_INSERT(new16->chunks, new16->children,
1494  n4->chunks, n4->children,
1495  RT_FANOUT_4, insertpos);
1496 
1497  /* insert new chunk into place */
1498  new16->chunks[insertpos] = chunk;
1499 
1500  new16->base.count++;
1501  RT_VERIFY_NODE((RT_NODE *) new16);
1502 
1503  /* free old node and update reference in parent */
1504  *parent_slot = newnode.alloc;
1505  RT_FREE_NODE(tree, node);
1506 
1507  return &new16->children[insertpos];
1508 }
#define RT_FANOUT_4
Definition: radixtree.h:611

References RT_CHILD_PTR::alloc, Assert, RT_NODE_4::base, RT_NODE_16::base, RT_NODE_4::children, RT_NODE_16::children, chunk, RT_NODE_16::chunks, RT_NODE_4::chunks, RT_NODE::count, RT_CHILD_PTR::local, RT_ALLOC_NODE, RT_CLASS_16_LO, RT_COPY_ARRAYS_FOR_INSERT, RT_COPY_COMMON, RT_FANOUT_4, RT_FREE_NODE, RT_NODE_4_GET_INSERTPOS, RT_NODE_KIND_16, RT_VERIFY_NODE, and tree.

◆ RT_GROW_NODE_48()

static pg_noinline RT_PTR_ALLOC* RT_GROW_NODE_48 ( RT_RADIX_TREE tree,
RT_PTR_ALLOC parent_slot,
RT_CHILD_PTR  node,
uint8  chunk 
)
static

Definition at line 1286 of file radixtree.h.

1288 {
1289  RT_NODE_48 *n48 = (RT_NODE_48 *) node.local;
1290  RT_CHILD_PTR newnode;
1291  RT_NODE_256 *new256;
1292  int i = 0;
1293 
1294  /* initialize new node */
1296  new256 = (RT_NODE_256 *) newnode.local;
1297 
1298  /* copy over the entries */
1299  RT_COPY_COMMON(newnode, node);
1300  for (int word_num = 0; word_num < RT_BM_IDX(RT_NODE_MAX_SLOTS); word_num++)
1301  {
1302  bitmapword bitmap = 0;
1303 
1304  /*
1305  * Bit manipulation is a surprisingly large portion of the overhead in
1306  * the naive implementation. Doing stores word-at-a-time removes a lot
1307  * of that overhead.
1308  */
1309  for (int bit = 0; bit < BITS_PER_BITMAPWORD; bit++)
1310  {
1311  uint8 offset = n48->slot_idxs[i];
1312 
1313  if (offset != RT_INVALID_SLOT_IDX)
1314  {
1315  bitmap |= ((bitmapword) 1 << bit);
1316  new256->children[i] = n48->children[offset];
1317  }
1318 
1319  i++;
1320  }
1321 
1322  new256->isset[word_num] = bitmap;
1323  }
1324 
1325  /* free old node and update reference in parent */
1326  *parent_slot = newnode.alloc;
1327  RT_FREE_NODE(tree, node);
1328 
1329  return RT_ADD_CHILD_256(tree, newnode, chunk);
1330 }
#define RT_NODE_MAX_SLOTS
Definition: radixtree.h:318
#define RT_ADD_CHILD_256
Definition: radixtree.h:228

References bit(), BITS_PER_BITMAPWORD, RT_NODE_48::children, chunk, i, RT_CHILD_PTR::local, RT_ADD_CHILD_256, RT_ALLOC_NODE, RT_BM_IDX, RT_CLASS_256, RT_COPY_COMMON, RT_FREE_NODE, RT_INVALID_SLOT_IDX, RT_NODE_KIND_256, RT_NODE_MAX_SLOTS, RT_NODE_48::slot_idxs, and tree.

◆ RT_ITERATE_NEXT()

RT_SCOPE RT_VALUE_TYPE * RT_ITERATE_NEXT ( RT_ITER iter,
uint64 *  key_p 
)

Definition at line 2206 of file radixtree.h.

2207 {
2208  RT_PTR_ALLOC *slot = NULL;
2209 
2210  while (iter->cur_level <= iter->top_level)
2211  {
2212  RT_CHILD_PTR node;
2213 
2214  slot = RT_NODE_ITERATE_NEXT(iter, iter->cur_level);
2215 
2216  if (iter->cur_level == 0 && slot != NULL)
2217  {
2218  /* Found a value at the leaf node */
2219  *key_p = iter->key;
2220  node.alloc = *slot;
2221 
2222  if (RT_CHILDPTR_IS_VALUE(*slot))
2223  return (RT_VALUE_TYPE *) slot;
2224  else
2225  {
2226  RT_PTR_SET_LOCAL(iter->tree, &node);
2227  return (RT_VALUE_TYPE *) node.local;
2228  }
2229  }
2230 
2231  if (slot != NULL)
2232  {
2233  /* Found the child slot, move down the tree */
2234  node.alloc = *slot;
2235  RT_PTR_SET_LOCAL(iter->tree, &node);
2236 
2237  iter->cur_level--;
2238  iter->node_iters[iter->cur_level].node = node;
2239  iter->node_iters[iter->cur_level].idx = 0;
2240  }
2241  else
2242  {
2243  /* Not found the child slot, move up the tree */
2244  iter->cur_level++;
2245  }
2246  }
2247 
2248  /* We've visited all nodes, so the iteration finished */
2249  return NULL;
2250 }
#define RT_NODE_ITERATE_NEXT
Definition: radixtree.h:239
uint64 key
Definition: radixtree.h:757

References RT_CHILD_PTR::alloc, RT_ITER::cur_level, RT_NODE_ITER::idx, RT_ITER::key, RT_CHILD_PTR::local, RT_NODE_ITER::node, RT_ITER::node_iters, RT_CHILDPTR_IS_VALUE, RT_NODE_ITERATE_NEXT, RT_PTR_ALLOC, RT_PTR_SET_LOCAL, RT_VALUE_TYPE, RT_ITER::top_level, and RT_ITER::tree.

◆ RT_KEY_GET_SHIFT()

static int RT_KEY_GET_SHIFT ( uint64  key)
inlinestatic

Definition at line 808 of file radixtree.h.

809 {
810  if (key == 0)
811  return 0;
812  else
814 }
static int pg_leftmost_one_pos64(uint64 word)
Definition: pg_bitutils.h:72

References sort-test::key, pg_leftmost_one_pos64(), and RT_SPAN.

◆ RT_MEMORY_USAGE()

RT_SCOPE uint64 RT_MEMORY_USAGE ( RT_RADIX_TREE tree)

Definition at line 2676 of file radixtree.h.

2677 {
2678  size_t total = 0;
2679 
2680 #ifdef RT_SHMEM
2681  Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC);
2682  total = dsa_get_total_size(tree->dsa);
2683 #else
2684  total = MemoryContextMemAllocated(tree->context, true);
2685 #endif
2686 
2687  return total;
2688 }
size_t dsa_get_total_size(dsa_area *area)
Definition: dsa.c:1027
Size MemoryContextMemAllocated(MemoryContext context, bool recurse)
Definition: mcxt.c:762

References Assert, dsa_get_total_size(), MemoryContextMemAllocated(), and tree.

◆ RT_NODE_16_GET_INSERTPOS()

static int RT_NODE_16_GET_INSERTPOS ( RT_NODE_16 node,
uint8  chunk 
)
inlinestatic

Definition at line 1158 of file radixtree.h.

1159 {
1160  int count = node->base.count;
1161 #if defined(USE_NO_SIMD) || defined(USE_ASSERT_CHECKING)
1162  int index;
1163 #endif
1164 
1165 #ifndef USE_NO_SIMD
1166  Vector8 spread_chunk;
1167  Vector8 haystack1;
1168  Vector8 haystack2;
1169  Vector8 cmp1;
1170  Vector8 cmp2;
1171  Vector8 min1;
1172  Vector8 min2;
1173  uint32 bitfield;
1174  int index_simd;
1175 #endif
1176 
1177  /*
1178  * First compare the last element. There are two reasons to branch here:
1179  *
1180  * 1) A realistic pattern is inserting ordered keys. In that case,
1181  * non-SIMD platforms must do a linear search to the last chunk to find
1182  * the insert position. This will get slower as the node fills up.
1183  *
1184  * 2) On SIMD platforms, we must branch anyway to make sure we don't bit
1185  * scan an empty bitfield. Doing the branch here eliminates some work that
1186  * we might otherwise throw away.
1187  */
1188  Assert(count > 0);
1189  if (node->chunks[count - 1] < chunk)
1190  return count;
1191 
1192 #if defined(USE_NO_SIMD) || defined(USE_ASSERT_CHECKING)
1193 
1194  for (index = 0; index < count; index++)
1195  {
1196  if (node->chunks[index] > chunk)
1197  break;
1198  }
1199 #endif
1200 
1201 #ifndef USE_NO_SIMD
1202 
1203  /*
1204  * This is a bit more complicated than RT_NODE_16_SEARCH_EQ(), because no
1205  * unsigned uint8 comparison instruction exists, at least for SSE2. So we
1206  * need to play some trickery using vector8_min() to effectively get >=.
1207  * There'll never be any equal elements in current uses, but that's what
1208  * we get here...
1209  */
1210  spread_chunk = vector8_broadcast(chunk);
1211  vector8_load(&haystack1, &node->chunks[0]);
1212  vector8_load(&haystack2, &node->chunks[sizeof(Vector8)]);
1213  min1 = vector8_min(spread_chunk, haystack1);
1214  min2 = vector8_min(spread_chunk, haystack2);
1215  cmp1 = vector8_eq(spread_chunk, min1);
1216  cmp2 = vector8_eq(spread_chunk, min2);
1217  bitfield = vector8_highbit_mask(cmp1) | (vector8_highbit_mask(cmp2) << sizeof(Vector8));
1218 
1219  Assert((bitfield & ((UINT64CONST(1) << count) - 1)) != 0);
1220  index_simd = pg_rightmost_one_pos32(bitfield);
1221 
1222  Assert(index_simd == index);
1223  return index_simd;
1224 #else
1225  return index;
1226 #endif
1227 }
unsigned int uint32
Definition: c.h:506
static int pg_rightmost_one_pos32(uint32 word)
Definition: pg_bitutils.h:111
static Vector8 vector8_broadcast(const uint8 c)
Definition: simd.h:135
static void vector8_load(Vector8 *v, const uint8 *s)
Definition: simd.h:108
uint64 Vector8
Definition: simd.h:60
Definition: type.h:95

References Assert, RT_NODE_16::base, chunk, RT_NODE_16::chunks, RT_NODE::count, pg_rightmost_one_pos32(), vector8_broadcast(), and vector8_load().

◆ RT_NODE_16_SEARCH_EQ()

static RT_PTR_ALLOC* RT_NODE_16_SEARCH_EQ ( RT_NODE_16 node,
uint8  chunk 
)
inlinestatic

Definition at line 981 of file radixtree.h.

982 {
983  int count = node->base.count;
984 #ifndef USE_NO_SIMD
985  Vector8 spread_chunk;
986  Vector8 haystack1;
987  Vector8 haystack2;
988  Vector8 cmp1;
989  Vector8 cmp2;
990  uint32 bitfield;
991  RT_PTR_ALLOC *slot_simd = NULL;
992 #endif
993 
994 #if defined(USE_NO_SIMD) || defined(USE_ASSERT_CHECKING)
995  RT_PTR_ALLOC *slot = NULL;
996 
997  for (int i = 0; i < count; i++)
998  {
999  if (node->chunks[i] == chunk)
1000  {
1001  slot = &node->children[i];
1002  break;
1003  }
1004  }
1005 #endif
1006 
1007 #ifndef USE_NO_SIMD
1008  /* replicate the search key */
1009  spread_chunk = vector8_broadcast(chunk);
1010 
1011  /* compare to all 32 keys stored in the node */
1012  vector8_load(&haystack1, &node->chunks[0]);
1013  vector8_load(&haystack2, &node->chunks[sizeof(Vector8)]);
1014  cmp1 = vector8_eq(spread_chunk, haystack1);
1015  cmp2 = vector8_eq(spread_chunk, haystack2);
1016 
1017  /* convert comparison to a bitfield */
1018  bitfield = vector8_highbit_mask(cmp1) | (vector8_highbit_mask(cmp2) << sizeof(Vector8));
1019 
1020  /* mask off invalid entries */
1021  bitfield &= ((UINT64CONST(1) << count) - 1);
1022 
1023  /* convert bitfield to index by counting trailing zeros */
1024  if (bitfield)
1025  slot_simd = &node->children[pg_rightmost_one_pos32(bitfield)];
1026 
1027  Assert(slot_simd == slot);
1028  return slot_simd;
1029 #else
1030  return slot;
1031 #endif
1032 }

References Assert, RT_NODE_16::base, RT_NODE_16::children, chunk, RT_NODE_16::chunks, RT_NODE::count, i, pg_rightmost_one_pos32(), RT_PTR_ALLOC, vector8_broadcast(), and vector8_load().

◆ RT_NODE_256_GET_CHILD()

static RT_PTR_ALLOC* RT_NODE_256_GET_CHILD ( RT_NODE_256 node,
uint8  chunk 
)
inlinestatic

Definition at line 798 of file radixtree.h.

799 {
801  return &node->children[chunk];
802 }
#define RT_NODE_256_IS_CHUNK_USED
Definition: radixtree.h:218
RT_PTR_ALLOC children[RT_FANOUT_256]
Definition: radixtree.h:574

References Assert, RT_NODE_256::children, chunk, and RT_NODE_256_IS_CHUNK_USED.

◆ RT_NODE_256_IS_CHUNK_USED()

static bool RT_NODE_256_IS_CHUNK_USED ( RT_NODE_256 node,
uint8  chunk 
)
inlinestatic

Definition at line 789 of file radixtree.h.

790 {
791  int idx = RT_BM_IDX(chunk);
792  int bitnum = RT_BM_BIT(chunk);
793 
794  return (node->isset[idx] & ((bitmapword) 1 << bitnum)) != 0;
795 }

References chunk, idx(), RT_NODE_256::isset, RT_BM_BIT, and RT_BM_IDX.

◆ RT_NODE_48_GET_CHILD()

static RT_PTR_ALLOC* RT_NODE_48_GET_CHILD ( RT_NODE_48 node,
uint8  chunk 
)
inlinestatic

Definition at line 782 of file radixtree.h.

783 {
784  return &node->children[node->slot_idxs[chunk]];
785 }

References RT_NODE_48::children, chunk, and RT_NODE_48::slot_idxs.

◆ RT_NODE_48_IS_CHUNK_USED()

static bool RT_NODE_48_IS_CHUNK_USED ( RT_NODE_48 node,
uint8  chunk 
)
inlinestatic

Definition at line 776 of file radixtree.h.

777 {
778  return node->slot_idxs[chunk] != RT_INVALID_SLOT_IDX;
779 }

References chunk, RT_INVALID_SLOT_IDX, and RT_NODE_48::slot_idxs.

◆ RT_NODE_4_GET_INSERTPOS()

static int RT_NODE_4_GET_INSERTPOS ( RT_NODE_4 node,
uint8  chunk,
int  count 
)
inlinestatic

Definition at line 1140 of file radixtree.h.

1141 {
1142  int idx;
1143 
1144  for (idx = 0; idx < count; idx++)
1145  {
1146  if (node->chunks[idx] >= chunk)
1147  break;
1148  }
1149 
1150  return idx;
1151 }

References chunk, RT_NODE_4::chunks, and idx().

◆ RT_NODE_INSERT()

static RT_PTR_ALLOC* RT_NODE_INSERT ( RT_RADIX_TREE tree,
RT_PTR_ALLOC parent_slot,
RT_CHILD_PTR  node,
uint8  chunk 
)
inlinestatic

Definition at line 1539 of file radixtree.h.

1541 {
1542  RT_NODE *n = node.local;
1543 
1544  switch (n->kind)
1545  {
1546  case RT_NODE_KIND_4:
1547  {
1548  if (unlikely(RT_NODE_MUST_GROW(n)))
1549  return RT_GROW_NODE_4(tree, parent_slot, node, chunk);
1550 
1551  return RT_ADD_CHILD_4(tree, node, chunk);
1552  }
1553  case RT_NODE_KIND_16:
1554  {
1555  if (unlikely(RT_NODE_MUST_GROW(n)))
1556  return RT_GROW_NODE_16(tree, parent_slot, node, chunk);
1557 
1558  return RT_ADD_CHILD_16(tree, node, chunk);
1559  }
1560  case RT_NODE_KIND_48:
1561  {
1562  if (unlikely(RT_NODE_MUST_GROW(n)))
1563  return RT_GROW_NODE_48(tree, parent_slot, node, chunk);
1564 
1565  return RT_ADD_CHILD_48(tree, node, chunk);
1566  }
1567  case RT_NODE_KIND_256:
1568  return RT_ADD_CHILD_256(tree, node, chunk);
1569  default:
1570  pg_unreachable();
1571  }
1572 }
#define unlikely(x)
Definition: c.h:311
#define RT_ADD_CHILD_48
Definition: radixtree.h:227
#define RT_GROW_NODE_4
Definition: radixtree.h:229
#define RT_ADD_CHILD_16
Definition: radixtree.h:226
#define RT_NODE_MUST_GROW(node)
Definition: radixtree.h:1132
#define RT_ADD_CHILD_4
Definition: radixtree.h:225
#define RT_GROW_NODE_16
Definition: radixtree.h:230
#define RT_GROW_NODE_48
Definition: radixtree.h:231

References chunk, RT_NODE::kind, RT_CHILD_PTR::local, pg_unreachable, RT_ADD_CHILD_16, RT_ADD_CHILD_256, RT_ADD_CHILD_4, RT_ADD_CHILD_48, RT_GROW_NODE_16, RT_GROW_NODE_4, RT_GROW_NODE_48, RT_NODE_KIND_16, RT_NODE_KIND_256, RT_NODE_KIND_4, RT_NODE_KIND_48, RT_NODE_MUST_GROW, tree, and unlikely.

◆ RT_NODE_ITERATE_NEXT()

static RT_PTR_ALLOC* RT_NODE_ITERATE_NEXT ( RT_ITER iter,
int  level 
)
inlinestatic

Definition at line 2110 of file radixtree.h.

2111 {
2112  uint8 key_chunk = 0;
2113  RT_NODE_ITER *node_iter;
2114  RT_CHILD_PTR node;
2115  RT_PTR_ALLOC *slot = NULL;
2116 
2117 #ifdef RT_SHMEM
2118  Assert(iter->tree->ctl->magic == RT_RADIX_TREE_MAGIC);
2119 #endif
2120 
2121  node_iter = &(iter->node_iters[level]);
2122  node = node_iter->node;
2123 
2124  Assert(node.local != NULL);
2125 
2126  switch ((node.local)->kind)
2127  {
2128  case RT_NODE_KIND_4:
2129  {
2130  RT_NODE_4 *n4 = (RT_NODE_4 *) (node.local);
2131 
2132  if (node_iter->idx >= n4->base.count)
2133  return NULL;
2134 
2135  slot = &n4->children[node_iter->idx];
2136  key_chunk = n4->chunks[node_iter->idx];
2137  node_iter->idx++;
2138  break;
2139  }
2140  case RT_NODE_KIND_16:
2141  {
2142  RT_NODE_16 *n16 = (RT_NODE_16 *) (node.local);
2143 
2144  if (node_iter->idx >= n16->base.count)
2145  return NULL;
2146 
2147  slot = &n16->children[node_iter->idx];
2148  key_chunk = n16->chunks[node_iter->idx];
2149  node_iter->idx++;
2150  break;
2151  }
2152  case RT_NODE_KIND_48:
2153  {
2154  RT_NODE_48 *n48 = (RT_NODE_48 *) (node.local);
2155  int chunk;
2156 
2157  for (chunk = node_iter->idx; chunk < RT_NODE_MAX_SLOTS; chunk++)
2158  {
2159  if (RT_NODE_48_IS_CHUNK_USED(n48, chunk))
2160  break;
2161  }
2162 
2163  if (chunk >= RT_NODE_MAX_SLOTS)
2164  return NULL;
2165 
2166  slot = RT_NODE_48_GET_CHILD(n48, chunk);
2167 
2168  key_chunk = chunk;
2169  node_iter->idx = chunk + 1;
2170  break;
2171  }
2172  case RT_NODE_KIND_256:
2173  {
2174  RT_NODE_256 *n256 = (RT_NODE_256 *) (node.local);
2175  int chunk;
2176 
2177  for (chunk = node_iter->idx; chunk < RT_NODE_MAX_SLOTS; chunk++)
2178  {
2179  if (RT_NODE_256_IS_CHUNK_USED(n256, chunk))
2180  break;
2181  }
2182 
2183  if (chunk >= RT_NODE_MAX_SLOTS)
2184  return NULL;
2185 
2186  slot = RT_NODE_256_GET_CHILD(n256, chunk);
2187 
2188  key_chunk = chunk;
2189  node_iter->idx = chunk + 1;
2190  break;
2191  }
2192  }
2193 
2194  /* Update the key */
2195  iter->key &= ~(((uint64) RT_CHUNK_MASK) << (level * RT_SPAN));
2196  iter->key |= (((uint64) key_chunk) << (level * RT_SPAN));
2197 
2198  return slot;
2199 }
#define RT_NODE_48_GET_CHILD
Definition: radixtree.h:217
#define RT_NODE_48_IS_CHUNK_USED
Definition: radixtree.h:216
#define RT_CHUNK_MASK
Definition: radixtree.h:321

References Assert, RT_NODE_4::base, RT_NODE_16::base, RT_NODE_4::children, RT_NODE_16::children, chunk, RT_NODE_16::chunks, RT_NODE_4::chunks, RT_NODE::count, RT_RADIX_TREE::ctl, RT_NODE_ITER::idx, RT_ITER::key, RT_CHILD_PTR::local, RT_NODE_ITER::node, RT_ITER::node_iters, RT_CHUNK_MASK, RT_NODE_256_GET_CHILD, RT_NODE_256_IS_CHUNK_USED, RT_NODE_48_GET_CHILD, RT_NODE_48_IS_CHUNK_USED, RT_NODE_KIND_16, RT_NODE_KIND_256, RT_NODE_KIND_4, RT_NODE_KIND_48, RT_NODE_MAX_SLOTS, RT_PTR_ALLOC, RT_SPAN, and RT_ITER::tree.

◆ RT_NODE_SEARCH()

static RT_PTR_ALLOC* RT_NODE_SEARCH ( RT_NODE node,
uint8  chunk 
)
inlinestatic

Definition at line 1040 of file radixtree.h.

1041 {
1042  /* Make sure we already converted to local pointer */
1043  Assert(node != NULL);
1044 
1045  switch (node->kind)
1046  {
1047  case RT_NODE_KIND_4:
1048  {
1049  RT_NODE_4 *n4 = (RT_NODE_4 *) node;
1050 
1051  for (int i = 0; i < n4->base.count; i++)
1052  {
1053  if (n4->chunks[i] == chunk)
1054  return &n4->children[i];
1055  }
1056  return NULL;
1057  }
1058  case RT_NODE_KIND_16:
1059  return RT_NODE_16_SEARCH_EQ((RT_NODE_16 *) node, chunk);
1060  case RT_NODE_KIND_48:
1061  {
1062  RT_NODE_48 *n48 = (RT_NODE_48 *) node;
1063  int slotpos = n48->slot_idxs[chunk];
1064 
1065  if (slotpos == RT_INVALID_SLOT_IDX)
1066  return NULL;
1067 
1068  return RT_NODE_48_GET_CHILD(n48, chunk);
1069  }
1070  case RT_NODE_KIND_256:
1071  {
1072  RT_NODE_256 *n256 = (RT_NODE_256 *) node;
1073 
1074  if (!RT_NODE_256_IS_CHUNK_USED(n256, chunk))
1075  return NULL;
1076 
1077  return RT_NODE_256_GET_CHILD(n256, chunk);
1078  }
1079  default:
1080  pg_unreachable();
1081  }
1082 }
#define RT_NODE_16_SEARCH_EQ
Definition: radixtree.h:209

References Assert, RT_NODE_4::base, RT_NODE_4::children, chunk, RT_NODE_4::chunks, RT_NODE::count, i, RT_NODE::kind, pg_unreachable, RT_INVALID_SLOT_IDX, RT_NODE_16_SEARCH_EQ, RT_NODE_256_GET_CHILD, RT_NODE_256_IS_CHUNK_USED, RT_NODE_48_GET_CHILD, RT_NODE_KIND_16, RT_NODE_KIND_256, RT_NODE_KIND_4, RT_NODE_KIND_48, and RT_NODE_48::slot_idxs.

◆ RT_PTR_SET_LOCAL()

static void RT_PTR_SET_LOCAL ( RT_RADIX_TREE tree,
RT_CHILD_PTR node 
)
inlinestatic

Definition at line 765 of file radixtree.h.

766 {
767 #ifdef RT_SHMEM
768  node->local = dsa_get_address(tree->dsa, node->alloc);
769 #endif
770 }
void * dsa_get_address(dsa_area *area, dsa_pointer dp)
Definition: dsa.c:942

References RT_CHILD_PTR::alloc, dsa_get_address(), RT_CHILD_PTR::local, and tree.

◆ RT_SET()

RT_SCOPE bool RT_SET ( RT_RADIX_TREE tree,
uint64  key,
RT_VALUE_TYPE value_p 
)

Definition at line 1703 of file radixtree.h.

1704 {
1705  bool found;
1706  RT_PTR_ALLOC *slot;
1707  size_t value_sz = RT_GET_VALUE_SIZE(value_p);
1708 
1709 #ifdef RT_SHMEM
1710  Assert(tree->ctl->magic == RT_RADIX_TREE_MAGIC);
1711 #endif
1712 
1713  Assert(RT_PTR_ALLOC_IS_VALID(tree->ctl->root));
1714 
1715  /* Extend the tree if necessary */
1716  if (unlikely(key > tree->ctl->max_val))
1717  {
1718  if (tree->ctl->num_keys == 0)
1719  {
1720  RT_CHILD_PTR node;
1721  RT_NODE_4 *n4;
1723 
1724  /*
1725  * With an empty root node, we don't extend the tree upwards,
1726  * since that would result in orphan empty nodes. Instead we open
1727  * code inserting into the root node and extend downward from
1728  * there.
1729  */
1730  node.alloc = tree->ctl->root;
1731  RT_PTR_SET_LOCAL(tree, &node);
1732  n4 = (RT_NODE_4 *) node.local;
1733  n4->base.count = 1;
1735 
1736  slot = RT_EXTEND_DOWN(tree, &n4->children[0], key, start_shift);
1737  found = false;
1738  tree->ctl->start_shift = start_shift;
1739  tree->ctl->max_val = RT_SHIFT_GET_MAX_VAL(start_shift);
1740  goto have_slot;
1741  }
1742  else
1743  RT_EXTEND_UP(tree, key);
1744  }
1745 
1746  slot = RT_GET_SLOT_RECURSIVE(tree, &tree->ctl->root,
1747  key, tree->ctl->start_shift, &found);
1748 
1749 have_slot:
1750  Assert(slot != NULL);
1751 
1752  if (RT_VALUE_IS_EMBEDDABLE(value_p))
1753  {
1754  /* free the existing leaf */
1755  if (found && !RT_CHILDPTR_IS_VALUE(*slot))
1756  RT_FREE_LEAF(tree, *slot);
1757 
1758  /* store value directly in child pointer slot */
1759  memcpy(slot, value_p, value_sz);
1760 
1761 #ifdef RT_RUNTIME_EMBEDDABLE_VALUE
1762  /* tag child pointer */
1763 #ifdef RT_SHMEM
1764  *slot |= 1;
1765 #else
1766  *((uintptr_t *) slot) |= 1;
1767 #endif
1768 #endif
1769  }
1770  else
1771  {
1772  RT_CHILD_PTR leaf;
1773 
1774  if (found && !RT_CHILDPTR_IS_VALUE(*slot))
1775  {
1776  Assert(RT_PTR_ALLOC_IS_VALID(*slot));
1777  leaf.alloc = *slot;
1778  RT_PTR_SET_LOCAL(tree, &leaf);
1779 
1780  if (RT_GET_VALUE_SIZE((RT_VALUE_TYPE *) leaf.local) != value_sz)
1781  {
1782  /*
1783  * different sizes, so first free the existing leaf before
1784  * allocating a new one
1785  */
1786  RT_FREE_LEAF(tree, *slot);
1787  leaf = RT_ALLOC_LEAF(tree, value_sz);
1788  *slot = leaf.alloc;
1789  }
1790  }
1791  else
1792  {
1793  /* allocate new leaf and store it in the child array */
1794  leaf = RT_ALLOC_LEAF(tree, value_sz);
1795  *slot = leaf.alloc;
1796  }
1797 
1798  memcpy(leaf.local, value_p, value_sz);
1799  }
1800 
1801  /* Update the statistics */
1802  if (!found)
1803  tree->ctl->num_keys++;
1804 
1805  return found;
1806 }
#define RT_ALLOC_LEAF
Definition: radixtree.h:201
#define RT_VALUE_IS_EMBEDDABLE
Definition: radixtree.h:197
tree ctl start_shift
Definition: radixtree.h:1887
#define RT_GET_VALUE_SIZE(v)
Definition: radixtree.h:431
#define RT_EXTEND_UP
Definition: radixtree.h:205
#define RT_FREE_LEAF
Definition: radixtree.h:203

References RT_CHILD_PTR::alloc, Assert, RT_NODE_4::base, RT_NODE_4::children, RT_NODE_4::chunks, RT_NODE::count, sort-test::key, RT_CHILD_PTR::local, RT_ALLOC_LEAF, RT_CHILDPTR_IS_VALUE, RT_EXTEND_DOWN, RT_EXTEND_UP, RT_FREE_LEAF, RT_GET_KEY_CHUNK, RT_GET_SLOT_RECURSIVE, RT_GET_VALUE_SIZE, RT_KEY_GET_SHIFT, RT_PTR_ALLOC, RT_PTR_ALLOC_IS_VALID, RT_PTR_SET_LOCAL, RT_SHIFT_GET_MAX_VAL, RT_VALUE_IS_EMBEDDABLE, RT_VALUE_TYPE, start_shift, tree, and unlikely.

◆ RT_SHIFT_ARRAYS_FOR_INSERT()

static void RT_SHIFT_ARRAYS_FOR_INSERT ( uint8 chunks,
RT_PTR_ALLOC children,
int  count,
int  insertpos 
)
inlinestatic

Definition at line 1231 of file radixtree.h.

1232 {
1233  /*
1234  * This is basically a memmove, but written in a simple loop for speed on
1235  * small inputs.
1236  */
1237  for (int i = count - 1; i >= insertpos; i--)
1238  {
1239  /* workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101481 */
1240 #ifdef __GNUC__
1241  __asm__("");
1242 #endif
1243  chunks[i + 1] = chunks[i];
1244  children[i + 1] = children[i];
1245  }
1246 }

References i.

◆ RT_SHIFT_GET_MAX_VAL()

static uint64 RT_SHIFT_GET_MAX_VAL ( int  shift)
static

Definition at line 820 of file radixtree.h.

821 {
822  if (shift == RT_MAX_SHIFT)
823  return UINT64_MAX;
824  else
825  return (UINT64CONST(1) << (shift + RT_SPAN)) - 1;
826 }
#define RT_MAX_SHIFT
Definition: radixtree.h:324

References RT_MAX_SHIFT, and RT_SPAN.

◆ RT_VALUE_IS_EMBEDDABLE()

static bool RT_VALUE_IS_EMBEDDABLE ( RT_VALUE_TYPE value_p)
inlinestatic

Definition at line 441 of file radixtree.h.

442 {
443 #ifdef RT_VARLEN_VALUE_SIZE
444 
445 #ifdef RT_RUNTIME_EMBEDDABLE_VALUE
446  return RT_GET_VALUE_SIZE(value_p) <= sizeof(RT_PTR_ALLOC);
447 #else
448  return false;
449 #endif
450 
451 #else
452  return RT_GET_VALUE_SIZE(value_p) <= sizeof(RT_PTR_ALLOC);
453 #endif
454 }

References RT_GET_VALUE_SIZE, and RT_PTR_ALLOC.

◆ RT_VERIFY_NODE()

static void RT_VERIFY_NODE ( RT_NODE node)
static

Definition at line 2694 of file radixtree.h.

2695 {
2696 #ifdef USE_ASSERT_CHECKING
2697 
2698  switch (node->kind)
2699  {
2700  case RT_NODE_KIND_4:
2701  {
2702  RT_NODE_4 *n4 = (RT_NODE_4 *) node;
2703 
2704  /* RT_DUMP_NODE(node); */
2705 
2706  for (int i = 1; i < n4->base.count; i++)
2707  Assert(n4->chunks[i - 1] < n4->chunks[i]);
2708 
2709  break;
2710  }
2711  case RT_NODE_KIND_16:
2712  {
2713  RT_NODE_16 *n16 = (RT_NODE_16 *) node;
2714 
2715  /* RT_DUMP_NODE(node); */
2716 
2717  for (int i = 1; i < n16->base.count; i++)
2718  Assert(n16->chunks[i - 1] < n16->chunks[i]);
2719 
2720  break;
2721  }
2722  case RT_NODE_KIND_48:
2723  {
2724  RT_NODE_48 *n48 = (RT_NODE_48 *) node;
2725  int cnt = 0;
2726 
2727  /* RT_DUMP_NODE(node); */
2728 
2729  for (int i = 0; i < RT_NODE_MAX_SLOTS; i++)
2730  {
2731  uint8 slot = n48->slot_idxs[i];
2732  int idx = RT_BM_IDX(slot);
2733  int bitnum = RT_BM_BIT(slot);
2734 
2735  if (!RT_NODE_48_IS_CHUNK_USED(n48, i))
2736  continue;
2737 
2738  /* Check if the corresponding slot is used */
2739  Assert(slot < node->fanout);
2740  Assert((n48->isset[idx] & ((bitmapword) 1 << bitnum)) != 0);
2741 
2742  cnt++;
2743  }
2744 
2745  Assert(n48->base.count == cnt);
2746 
2747  break;
2748  }
2749  case RT_NODE_KIND_256:
2750  {
2751  RT_NODE_256 *n256 = (RT_NODE_256 *) node;
2752  int cnt = 0;
2753 
2754  /* RT_DUMP_NODE(node); */
2755 
2756  for (int i = 0; i < RT_BM_IDX(RT_NODE_MAX_SLOTS); i++)
2757  cnt += bmw_popcount(n256->isset[i]);
2758 
2759  /*
2760  * Check if the number of used chunk matches, accounting for
2761  * overflow
2762  */
2763  if (cnt == RT_FANOUT_256)
2764  Assert(n256->base.count == 0);
2765  else
2766  Assert(n256->base.count == cnt);
2767 
2768  break;
2769  }
2770  }
2771 #endif
2772 }
#define bmw_popcount(w)
Definition: bitmapset.h:80
#define RT_FANOUT_256
Definition: radixtree.h:504

References Assert, RT_NODE_4::base, RT_NODE_16::base, RT_NODE_48::base, RT_NODE_256::base, bmw_popcount, RT_NODE_16::chunks, RT_NODE_4::chunks, RT_NODE::count, i, idx(), RT_NODE_256::isset, RT_NODE_48::isset, RT_NODE::kind, RT_BM_BIT, RT_BM_IDX, RT_FANOUT_256, RT_NODE_48_IS_CHUNK_USED, RT_NODE_KIND_16, RT_NODE_KIND_256, RT_NODE_KIND_4, RT_NODE_KIND_48, RT_NODE_MAX_SLOTS, and RT_NODE_48::slot_idxs.

◆ StaticAssertDecl() [1/3]

StaticAssertDecl ( )

◆ StaticAssertDecl() [2/3]

StaticAssertDecl ( RT_FANOUT_48<=  RT_FANOUT_48_MAX,
"more slots than isset bits"   
)

◆ StaticAssertDecl() [3/3]

StaticAssertDecl ( RT_FANOUT_4<=  RT_FANOUT_4_MAX,
"watch struct padding"   
)

Variable Documentation

◆ context

tree context = ctx

Definition at line 1835 of file radixtree.h.

Referenced by _SPI_execute_plan(), acquireLocksOnSubLinks(), AcquireRewriteLocks(), add_nulling_relids(), add_nulling_relids_mutator(), adjust_appendrel_attrs(), adjust_appendrel_attrs_mutator(), adjust_inherited_attnums(), AllocateSnapshotBuilder(), AllocSetAlloc(), AllocSetAllocFromNewBlock(), AllocSetAllocLarge(), AllocSetDelete(), AllocSetIsEmpty(), AllocSetReset(), AllocSetStats(), AlterTable(), appendAggOrderBy(), appendConditions(), appendContextKeyword(), appendFunctionName(), appendGroupByClause(), appendLimitClause(), appendOrderByClause(), appendOrderBySuffix(), appendWhereClause(), assign_collations_walker(), assign_expr_collations(), ATController(), ATExecAddColumn(), ATExecAttachPartition(), ATExecCmd(), ATExecMergePartitions(), ATExecSplitPartition(), ATParseTransformCmd(), ATPrepAddColumn(), ATPrepAlterColumnType(), ATPrepCmd(), ATPrepDropColumn(), ATPrepSetNotNull(), ATRewriteCatalogs(), ATRewriteTables(), ATSimpleRecursion(), ATTypedTableRecursion(), bbstreamer_content(), bbstreamer_extractor_content(), bbstreamer_recovery_injector_content(), bbstreamer_tar_archiver_content(), bbstreamer_tar_parser_content(), bbstreamer_tar_terminator_content(), be_tls_init(), BuildV1Call(), BumpAlloc(), BumpAllocFromNewBlock(), BumpAllocLarge(), BumpBlockInit(), BumpDelete(), BumpIsEmpty(), BumpReset(), BumpStats(), can_minmax_aggs(), ChangeVarNodes(), ChangeVarNodes_walker(), check_agg_arguments(), check_agg_arguments_walker(), check_functions_in_node(), check_nested_generated_walker(), check_ungrouped_columns(), check_ungrouped_columns_walker(), checkExprHasSubLink_walker(), coerce_to_common_type(), combinebackup_per_file_cb(), combinebackup_per_wal_range_cb(), combinebackup_system_identifier_cb(), contain_agg_clause_walker(), contain_aggs_of_level(), contain_aggs_of_level_walker(), contain_dml_walker(), contain_invalid_rfcolumn_walker(), contain_leaked_vars_walker(), contain_mutable_functions_walker(), contain_non_const_walker(), contain_nonstrict_functions_walker(), contain_placeholder_references_to(), contain_placeholder_references_walker(), contain_subplans_walker(), contain_var_clause_walker(), contain_volatile_functions_not_nextval_walker(), contain_volatile_functions_walker(), contain_windowfuncs_walker(), contains_multiexpr_param(), convert_combining_aggrefs(), convert_testexpr(), convert_testexpr_mutator(), CopyAndAddInvertedQual(), cost_qual_eval(), cost_qual_eval_node(), cost_qual_eval_walker(), CreateIncrementalBackupInfo(), createPartitionTable(), dblink_fdw_validator(), default_openssl_tls_init(), DefineCustomBoolVariable(), DefineCustomEnumVariable(), DefineCustomIntVariable(), DefineCustomRealVariable(), DefineCustomStringVariable(), deparse_expression_pretty(), deparseAggref(), deparseArrayExpr(), deparseBoolExpr(), deparseCaseExpr(), deparseConst(), deparseDirectDeleteSql(), deparseDirectUpdateSql(), deparseDistinctExpr(), deparseExplicitTargetList(), deparseExpr(), deparseFromExpr(), deparseFromExprForRel(), deparseFuncExpr(), deparseLockingClause(), deparseNullTest(), deparseOpExpr(), deparseParam(), deparseRelabelType(), deparseScalarArrayOpExpr(), deparseSelectSql(), deparseSelectStmtForRel(), deparseSortGroupClause(), deparseSubqueryTargetList(), deparseSubscriptingRef(), deparseVar(), ece_function_is_safe(), errcontext_msg(), errsave_finish(), errsave_start(), estimate_expression_value(), eval_const_expressions(), eval_const_expressions_mutator(), evaluate_function(), EventTriggerInvoke(), exec_object_restorecon(), ExecCrossPartitionUpdate(), ExecCrossPartitionUpdateForeignKey(), ExecDelete(), ExecDeleteAct(), ExecDeleteEpilogue(), ExecDeletePrologue(), ExecInsert(), ExecMerge(), ExecMergeMatched(), ExecMergeNotMatched(), ExecModifyTable(), ExecOnConflictUpdate(), ExecShutdownNode_walker(), ExecUpdate(), ExecUpdateAct(), ExecUpdateEpilogue(), ExecUpdatePrologue(), expression_returns_set_walker(), expression_tree_mutator_impl(), extract_query_dependencies_walker(), finalize_agg_primnode(), finalize_grouping_exprs(), finalize_grouping_exprs_walker(), finalize_plan(), finalize_primnode(), find_cols(), find_cols_walker(), find_dependent_phvs(), find_dependent_phvs_in_jointree(), find_dependent_phvs_walker(), find_expr_references_walker(), find_param_generator(), find_param_referent(), fireRIRrules(), fix_join_expr(), fix_join_expr_mutator(), fix_opfuncids_walker(), fix_scan_expr(), fix_scan_expr_mutator(), fix_scan_expr_walker(), fix_upper_expr(), fix_upper_expr_mutator(), fix_windowagg_condition_expr(), fix_windowagg_condition_expr_mutator(), flatten_join_alias_vars(), flatten_join_alias_vars_mutator(), fmgr_security_definer(), FreeSnapshotBuilder(), g_box_consider_split(), gen_partprune_steps(), gen_partprune_steps_internal(), gen_prune_step_combine(), gen_prune_step_op(), gen_prune_steps_from_opexps(), GenerationAlloc(), GenerationAllocFromNewBlock(), GenerationAllocLarge(), GenerationBlockInit(), GenerationDelete(), GenerationIsEmpty(), GenerationReset(), GenerationStats(), get_agg_combine_expr(), get_agg_expr(), get_agg_expr_helper(), get_basic_select_query(), get_coercion_expr(), get_column_alias_list(), get_const_collation(), get_const_expr(), get_delete_query_def(), get_from_clause(), get_from_clause_coldeflist(), get_from_clause_item(), get_func_expr(), get_func_sql_syntax(), get_insert_query_def(), get_json_agg_constructor(), get_json_behavior(), get_json_constructor(), get_json_expr_options(), get_json_path_spec(), get_json_table(), get_json_table_columns(), get_json_table_nested_columns(), get_list_partvalue_string(), get_matching_hash_bounds(), get_matching_list_bounds(), get_matching_partitions(), get_matching_range_bounds(), get_memory_context_name_and_ident(), get_merge_query_def(), get_name_for_var_field(), get_oper_expr(), get_parameter(), get_query_def(), get_range_partbound_string(), get_rtable_name(), get_rte_alias(), get_rule_expr(), get_rule_expr_funccall(), get_rule_expr_paren(), get_rule_expr_toplevel(), get_rule_groupingset(), get_rule_list_toplevel(), get_rule_orderby(), get_rule_sortgroupclause(), get_rule_windowclause(), get_rule_windowspec(), get_select_query_def(), get_setop_query(), get_special_variable(), get_steps_using_prefix(), get_steps_using_prefix_recurse(), get_sublink_expr(), get_tablefunc(), get_tablesample_def(), get_target_list(), get_update_query_def(), get_update_query_targetlist_def(), get_utility_query_def(), get_values_def(), get_variable(), get_windowfunc_expr(), get_windowfunc_expr_helper(), get_with_clause(), get_xmltable(), GetSearchPathMatcher(), gist_box_picksplit(), IncrementVarSublevelsUp(), IncrementVarSublevelsUp_rtable(), IncrementVarSublevelsUp_walker(), index_form_tuple_context(), init_custom_variable(), initialize_dh(), initialize_ecdh(), InitPartitionPruneContext(), inline_cte(), inline_cte_walker(), inline_function(), is_conninfo_option(), is_parallel_safe(), is_valid_dblink_option(), is_valid_option(), isPlainForeignVar(), isQueryUsingTempRelation_walker(), jit_release_context(), json_manifest_finalize_file(), json_manifest_finalize_system_identifier(), json_manifest_finalize_version(), json_manifest_finalize_wal_range(), json_manifest_parse_failure(), json_parse_manifest(), json_parse_manifest_incremental_chunk(), json_parse_manifest_incremental_init(), llvm_compile_expr(), llvm_compile_module(), llvm_create_context(), llvm_expand_funcname(), llvm_get_function(), llvm_mutable_module(), llvm_optimize_module(), llvm_release_context(), load_backup_manifest(), locate_agg_of_level(), locate_agg_of_level_walker(), locate_var_of_level(), locate_var_of_level_walker(), locate_windowfunc(), locate_windowfunc_walker(), LockViewRecurse(), LockViewRecurse_walker(), lookupCreateVariable(), main(), make_partitionedrel_pruneinfo(), make_ruledef(), manifest_process_file(), manifest_process_system_identifier(), manifest_process_version(), manifest_process_wal_range(), map_variable_attnos(), map_variable_attnos_mutator(), match_clause_to_partition_key(), max_parallel_hazard(), max_parallel_hazard_checker(), max_parallel_hazard_test(), max_parallel_hazard_walker(), MemoryContextAlloc(), MemoryContextAllocAligned(), MemoryContextAllocationFailure(), MemoryContextAllocExtended(), MemoryContextAllocHuge(), MemoryContextAllocZero(), MemoryContextAllowInCriticalSection(), MemoryContextCallResetCallbacks(), MemoryContextCheckSize(), MemoryContextDelete(), MemoryContextDeleteChildren(), MemoryContextDeleteOnly(), MemoryContextGetParent(), MemoryContextIsEmpty(), MemoryContextMemAllocated(), MemoryContextMemConsumed(), MemoryContextRegisterResetCallback(), MemoryContextReset(), MemoryContextResetChildren(), MemoryContextResetOnly(), MemoryContextSetIdentifier(), MemoryContextSetParent(), MemoryContextStats(), MemoryContextStatsDetail(), MemoryContextStatsInternal(), MemoryContextStatsPrint(), MemoryContextStrdup(), MemoryContextSwitchTo(), merge_collation_state(), OffsetVarNodes(), OffsetVarNodes_walker(), palloc(), palloc0(), palloc_extended(), ParallelSlotSetHandler(), parse_manifest_file(), parse_required_wal(), partkey_datum_from_expr(), perform_pruning_base_step(), perform_pruning_combine_step(), pfree(), pg_checksum_final(), pg_checksum_init(), pg_checksum_update(), pg_get_constraintdef_worker(), pg_get_expr_worker(), pg_get_indexdef_worker(), pg_get_partconstrdef_string(), pg_get_partition_constraintdef(), pg_get_partkeydef_worker(), pg_get_statisticsobj_worker(), pg_get_statisticsobjdef_expressions(), pg_get_triggerdef_worker(), pg_sha224_final(), pg_sha224_init(), pg_sha224_update(), pg_sha256_final(), pg_sha256_init(), pg_sha256_update(), pg_sha384_final(), pg_sha384_init(), pg_sha384_update(), pg_sha512_final(), pg_sha512_init(), pg_sha512_update(), pgss_ProcessUtility(), planstate_tree_walker_impl(), PLy_get_scratch_context(), PLy_pop_execution_context(), PLy_push_execution_context(), pqParseIntParam(), printRemoteParam(), printRemotePlaceholder(), printSubscripts(), process_function_rte_ref(), process_sublinks_mutator(), ProcessConfigFileInternal(), ProcessGUCArray(), processIndirection(), ProcessUtility(), ProcessUtilityForAlterTable(), ProcessUtilitySlow(), prune_append_rel_partitions(), pub_rf_contains_invalid_column(), pull_exec_paramids_walker(), pull_paramids_walker(), pull_var_clause(), pull_var_clause_walker(), pull_varattnos(), pull_varattnos_walker(), pull_varnos(), pull_varnos_of_level(), pull_varnos_walker(), pull_vars_of_level(), pull_vars_walker(), pullup_replace_vars(), pullup_replace_vars_callback(), pullup_replace_vars_subquery(), PutMemoryContextsStatsTupleStore(), putVariable(), putVariableInt(), putVariableValue(), query_contains_extern_params_walker(), query_or_expression_tree_mutator_impl(), query_or_expression_tree_walker_impl(), query_tree_mutator_impl(), query_tree_walker_impl(), range_gist_consider_split(), range_gist_double_sorting_split(), range_table_walker_impl(), rangeTableEntry_used(), rangeTableEntry_used_walker(), rank_up(), recordDependencyOnExpr(), recordDependencyOnSingleRelExpr(), REGRESS_utility_command(), remove_nulling_relids(), remove_nulling_relids_mutator(), ReorderBufferFree(), repalloc(), repalloc_extended(), replace_rte_variables(), replace_rte_variables_mutator(), replace_vars_in_jointree(), ReplaceVarsFromTargetList(), ReplaceVarsFromTargetList_callback(), report_backup_error(), report_extra_backup_files(), resolve_special_varno(), ResOwnerReleaseJitContext(), RestoreUserContext(), rewriteRuleAction(), rewriteTargetView(), select_common_collation(), select_common_type(), sepgsql_utility_command(), set_config_option(), set_config_option_ext(), set_config_with_handle(), set_debug_options(), set_plan_disabling_options(), set_rot13(), SetConfigOption(), setRuleCheckAsUser_walker(), SHA256_Last(), SHA256_Transform(), SHA512_Last(), SHA512_Transform(), should_ignore_relpath(), show_expression(), show_grouping_set_keys(), show_grouping_sets(), show_memoize_info(), show_plan_tlist(), show_sort_group_keys(), show_tablesample(), simplify_and_arguments(), simplify_function(), simplify_or_arguments(), SlabAlloc(), SlabAllocFromNewBlock(), SlabAllocSetupNewChunk(), SlabDelete(), SlabIsEmpty(), SlabReset(), SlabStats(), slot_compile_deform(), split_pathtarget_at_srfs(), split_pathtarget_walker(), SS_process_sublinks(), standard_ProcessUtility(), StartupDecodingContext(), substitute_actual_parameters(), substitute_actual_parameters_mutator(), substitute_actual_srf_parameters(), substitute_actual_srf_parameters_mutator(), substitute_phv_relids(), substitute_phv_relids_walker(), SwitchToUntrustedUser(), transformSetOperationTree(), ValidJsonBehaviorDefaultExpr(), verify_backup_checksums(), verify_backup_directory(), verify_backup_file(), verify_btree_slot_handler(), verify_file_checksum(), verify_heap_slot_handler(), verify_manifest_checksum(), verifybackup_per_file_cb(), verifybackup_per_wal_range_cb(), verifybackup_system_identifier(), verifybackup_version_cb(), WalSummarizerMain(), window_cume_dist(), window_dense_rank(), window_ntile(), window_percent_rank(), window_rank(), and WritebackContextInit().

◆ ctl

Definition at line 1853 of file radixtree.h.

Referenced by AddPendingSync(), assign_record_type_typmod(), BuildEventTriggerCache(), CompactCheckpointerRequestQueue(), create_seq_hashtable(), createConnHash(), CreatePartitionDirectory(), do_autovacuum(), EnablePortalManager(), find_all_inheritors(), find_oper_cache_entry(), find_rendezvous_variable(), get_json_object_as_hash(), GetConnection(), init_rel_sync_cache(), init_ts_config_cache(), InitializeAttoptCache(), InitializeRelfilenumberMap(), InitializeShippableCache(), InitializeTableSpaceCache(), json_unique_check_init(), load_categories_hash(), log_invalid_page(), logicalrep_partmap_init(), logicalrep_relmap_init(), lookup_collation_cache(), lookup_proof_cache(), lookup_ts_dictionary_cache(), lookup_ts_parser_cache(), lookup_type_cache(), LookupOpclassInfo(), pa_allocate_worker(), pg_get_backend_memory_contexts(), plpgsql_estate_setup(), plpgsql_HashTableInit(), populate_recordset_object_start(), process_syncing_tables_for_apply(), RegisterExtensibleNodeEntry(), RelationCacheInitialize(), ResetUnloggedRelationsInDbspaceDir(), ri_InitHashTables(), SerializePendingSyncs(), SimpleLruDoesPhysicalPageExist(), SimpleLruGetBankLock(), SimpleLruInit(), SimpleLruReadPage(), SimpleLruReadPage_ReadOnly(), SimpleLruTruncate(), SimpleLruWaitIO(), SimpleLruWriteAll(), SimpleLruWritePage(), SimpleLruZeroLSNs(), SimpleLruZeroPage(), SlruCorrectSegmentFilenameLength(), SlruDeleteSegment(), SlruFileName(), SlruInternalDeleteSegment(), SlruInternalWritePage(), SlruMayDeleteSegment(), SlruPhysicalReadPage(), SlruPhysicalWritePage(), SlruReportIOError(), SlruScanDirCbDeleteAll(), SlruScanDirCbDeleteCutoff(), SlruScanDirCbFindEarliest(), SlruScanDirCbReportPresence(), SlruScanDirectory(), SlruSelectLRUPage(), SlruSyncFileTag(), smgropen(), StatsShmemInit(), and test_slru_scan_cb().

◆ iter_context

tree iter_context
Initial value:
RT_STR(RT_PREFIX) "_radix_tree iter context",
#define AllocSetContextCreate
Definition: memutils.h:129
#define ALLOCSET_SMALL_SIZES
Definition: memutils.h:170
#define RT_STR(s)
Definition: radixtree.h:169
#define RT_PREFIX
Definition: tidstore.c:101

Definition at line 1841 of file radixtree.h.

◆ leaf_context

tree leaf_context = tree->context

Definition at line 1868 of file radixtree.h.

◆ max_val

◆ old_ctx

◆ root

tree ctl root = rootnode.alloc

Definition at line 1886 of file radixtree.h.

Referenced by _int_matchsel(), add_base_clause_to_rel(), add_base_rels_to_query(), add_child_join_rel_equivalences(), add_child_rel_equivalences(), add_foreign_final_paths(), add_foreign_grouping_paths(), add_foreign_ordered_paths(), add_function_cost(), add_join_clause_to_rels(), add_join_rel(), add_nullingrels_if_needed(), add_other_rels_to_query(), add_outer_joins_to_relids(), add_paths_to_append_rel(), add_paths_to_grouping_rel(), add_paths_to_joinrel(), add_paths_with_pathkeys_for_rel(), add_placeholders_to_base_rels(), add_placeholders_to_joinrel(), add_row_identity_columns(), add_row_identity_var(), add_rtes_to_flat_rtable(), add_setop_child_rel_equivalences(), add_unique_group_var(), add_vars_to_targetlist(), adjust_appendrel_attrs(), adjust_appendrel_attrs_multilevel(), adjust_child_relids_multilevel(), adjust_foreign_grouping_path_cost(), adjust_group_pathkeys_for_groupagg(), adjust_inherited_attnums_multilevel(), adjust_paths_for_srfs(), adjust_rowcount_for_semijoins(), appendLimitClause(), apply_child_basequals(), apply_projection_to_path(), apply_scanjoin_target_to_paths(), approx_tuple_count(), approximate_joinrel_size(), arraycontsel(), assign_param_for_placeholdervar(), assign_param_for_var(), assign_special_exec_param(), bernoulli_samplescangetsamplesize(), bitmap_and_cost_est(), bitmap_scan_cost_est(), blcostestimate(), booltestsel(), boolvarsel(), brincostestimate(), btcostestimate(), build_base_rel_tlists(), build_child_join_rel(), build_child_join_reltarget(), build_child_join_sjinfo(), build_expression_pathkey(), build_implied_join_equality(), build_index_pathkeys(), build_index_paths(), build_join_pathkeys(), build_join_rel(), build_join_rel_hash(), build_joinrel_partition_info(), build_joinrel_restrictlist(), build_joinrel_tlist(), build_minmax_path(), build_partition_pathkeys(), build_path_tlist(), build_paths_for_OR(), build_physical_tlist(), build_setop_child_paths(), build_simple_rel(), build_subplan(), BuildParameterizedTidPaths(), cached_scansel(), calc_joinrel_size_estimate(), can_minmax_aggs(), can_partial_agg(), check_index_predicates(), check_redundant_nullability_qual(), choose_bitmap_and(), choose_hashed_setop(), classifyConditions(), clause_selectivity(), clause_selectivity_ext(), clauselist_apply_dependencies(), clauselist_selectivity(), clauselist_selectivity_ext(), clauselist_selectivity_or(), clean_NOT(), cleanup_tsquery_stopwords(), compute_bitmap_pages(), compute_partition_bounds(), compute_semi_anti_join_factors(), compute_semijoin_info(), consider_groupingsets_paths(), consider_index_join_clauses(), consider_index_join_outer_rels(), consider_new_or_clause(), consider_parallel_mergejoin(), consider_parallel_nestloop(), contain_placeholder_references_to(), convert_ANY_sublink_to_join(), convert_EXISTS_sublink_to_join(), convert_EXISTS_to_ANY(), convert_subquery_pathkeys(), convert_testexpr(), cost_agg(), cost_bitmap_heap_scan(), cost_ctescan(), cost_functionscan(), cost_group(), cost_incremental_sort(), cost_index(), cost_memoize_rescan(), cost_namedtuplestorescan(), cost_qual_eval(), cost_qual_eval_node(), cost_rescan(), cost_resultscan(), cost_samplescan(), cost_seqscan(), cost_subplan(), cost_subqueryscan(), cost_tablefuncscan(), cost_tidrangescan(), cost_tidscan(), cost_valuesscan(), cost_windowagg(), create_agg_path(), create_agg_plan(), create_append_path(), create_append_plan(), create_bitmap_and_path(), create_bitmap_heap_path(), create_bitmap_or_path(), create_bitmap_scan_plan(), create_bitmap_subplan(), create_ctescan_path(), create_ctescan_plan(), create_customscan_plan(), create_degenerate_grouping_paths(), create_distinct_paths(), create_final_distinct_paths(), create_foreignscan_path(), create_foreignscan_plan(), create_functionscan_path(), create_functionscan_plan(), create_gather_merge_path(), create_gather_merge_plan(), create_gather_path(), create_gather_plan(), create_gating_plan(), create_group_path(), create_group_plan(), create_group_result_path(), create_group_result_plan(), create_grouping_paths(), create_groupingsets_path(), create_groupingsets_plan(), create_hashjoin_path(), create_hashjoin_plan(), create_incremental_sort_path(), create_incrementalsort_plan(), create_index_path(), create_index_paths(), create_indexscan_plan(), create_join_clause(), create_join_plan(), create_lateral_join_info(), create_limit_plan(), create_lockrows_plan(), create_material_plan(), create_memoize_plan(), create_merge_append_path(), create_merge_append_plan(), create_mergejoin_path(), create_mergejoin_plan(), create_minmaxagg_path(), create_minmaxagg_plan(), create_modifytable_plan(), create_namedtuplestorescan_path(), create_namedtuplestorescan_plan(), create_nestloop_path(), create_nestloop_plan(), create_one_window_path(), create_ordered_paths(), create_ordinary_grouping_paths(), create_partial_bitmap_paths(), create_partial_distinct_paths(), create_partial_grouping_paths(), create_partitionwise_grouping_paths(), create_plain_partial_paths(), create_plan(), create_plan_recurse(), create_project_set_plan(), create_projection_path(), create_projection_plan(), create_recursiveunion_plan(), create_resultscan_path(), create_resultscan_plan(), create_samplescan_path(), create_samplescan_plan(), create_scan_plan(), create_seqscan_path(), create_seqscan_plan(), create_set_projection_path(), create_setop_plan(), create_sort_path(), create_sort_plan(), create_subqueryscan_path(), create_subqueryscan_plan(), create_tablefuncscan_path(), create_tablefuncscan_plan(), create_tidrangescan_path(), create_tidrangescan_plan(), create_tidscan_path(), create_tidscan_paths(), create_tidscan_plan(), create_unique_path(), create_unique_plan(), create_upper_unique_plan(), create_valuesscan_path(), create_valuesscan_plan(), create_window_paths(), create_windowagg_path(), create_windowagg_plan(), create_worktablescan_path(), create_worktablescan_plan(), deconstruct_distribute(), deconstruct_distribute_oj_quals(), deconstruct_jointree(), deconstruct_recurse(), deparseDirectDeleteSql(), deparseDirectUpdateSql(), deparseFromExprForRel(), deparseLockingClause(), deparseRangeTblRef(), deparseSelectSql(), deparseSelectStmtForRel(), dependencies_clauselist_selectivity(), desirable_join(), distribute_qual_to_rels(), distribute_quals_to_rels(), distribute_restrictinfo_to_rels(), distribute_row_identity_vars(), dofindsubquery(), edge_failure(), eqjoinsel(), eqsel_internal(), estimate_array_length(), estimate_expression_value(), estimate_hash_bucket_stats(), estimate_hashagg_tablesize(), estimate_multivariate_ndistinct(), estimate_num_groups(), estimate_path_cost_size(), estimate_size(), eval_const_expressions(), examine_simple_variable(), examine_variable(), expand_appendrel_subquery(), expand_indexqual_rowcompare(), expand_inherited_rtentry(), expand_partitioned_rtentry(), expand_planner_arrays(), expand_single_inheritance_child(), expr_is_nonnullable(), expression_planner_with_deps(), expression_returns_set_rows(), exprs_known_equal(), extract_jsp_query(), extract_lateral_references(), extract_lateral_vars_from_PHVs(), extract_query_dependencies(), extract_restriction_or_clauses(), fetch_upper_rel(), fileGetForeignPaths(), fileGetForeignRelSize(), final_cost_hashjoin(), final_cost_mergejoin(), final_cost_nestloop(), finalize_plan(), find_appinfos_by_relids(), find_base_rel(), find_base_rel_ignore_join(), find_base_rel_noerr(), find_childrel_parents(), find_compatible_agg(), find_compatible_trans(), find_computable_ec_member(), find_dependent_phvs(), find_dependent_phvs_in_jointree(), find_em_for_rel(), find_em_for_rel_target(), find_join_domain(), find_join_input_rel(), find_join_rel(), find_lateral_references(), find_mergeclauses_for_outer_pathkeys(), find_minmax_agg_replacement_param(), find_partition_scheme(), find_placeholder_info(), find_placeholders_in_expr(), find_placeholders_in_jointree(), find_placeholders_recurse(), find_simplified_clause(), find_single_rel_for_clauses(), findsubquery(), fix_alternative_subplan(), fix_append_rel_relids(), fix_expr_common(), fix_indexorderby_references(), fix_indexqual_clause(), fix_indexqual_references(), fix_join_expr(), fix_param_node(), fix_placeholder_input_needed_levels(), fix_scan_expr(), fix_upper_expr(), fix_windowagg_condition_expr(), flatten_join_alias_vars(), flatten_simple_union_all(), foreign_grouping_ok(), foreign_join_ok(), FreePageBtreeCleanup(), FreePageManagerDump(), FreePageManagerPutInternal(), function_selectivity(), gather_grouping_paths(), generate_base_implied_equalities(), generate_base_implied_equalities_broken(), generate_base_implied_equalities_const(), generate_base_implied_equalities_no_const(), generate_bitmap_or_paths(), generate_gather_paths(), generate_implied_equalities_for_column(), generate_join_implied_equalities(), generate_join_implied_equalities_broken(), generate_join_implied_equalities_for_ecs(), generate_join_implied_equalities_normal(), generate_mergejoin_paths(), generate_new_exec_param(), generate_nonunion_paths(), generate_orderedappend_paths(), generate_partitionwise_join_paths(), generate_recursion_path(), generate_subquery_params(), generate_union_paths(), generate_useful_gather_paths(), generic_restriction_selectivity(), genericcostestimate(), geqo(), geqo_eval(), geqo_rand(), geqo_randint(), geqo_selection(), geqo_set_seed(), get_actual_variable_range(), get_agg_clause_costs(), get_baserel_parampathinfo(), get_cheapest_parameterized_child_path(), get_common_eclass_indexes(), get_dependent_generated_columns(), get_eclass_for_sort_expr(), get_eclass_indexes_for_relids(), get_expr_width(), get_foreign_key_join_selectivity(), get_function_rows(), get_gating_quals(), get_index_clause_from_support(), get_index_paths(), get_join_domain_min_rels(), get_join_index_paths(), get_join_variables(), get_joinrel_parampathinfo(), get_json_table(), get_loop_count(), get_matching_part_pairs(), get_memoize_path(), get_number_of_groups(), get_parameterized_baserel_size(), get_parameterized_joinrel_size(), get_rel_all_updated_cols(), get_relation_constraints(), get_relation_foreign_keys(), get_relation_info(), get_restriction_qual_cost(), get_restriction_variable(), get_result_relid(), get_row_security_policies(), get_translated_update_targetlist(), get_useful_ecs_for_relation(), get_useful_group_keys_orderings(), get_useful_pathkeys_for_relation(), get_variable_range(), get_windowclause_startup_tuples(), gimme_edge_table(), gimme_gene(), gimme_tour(), gimme_tree(), gincost_opexpr(), gincost_scalararrayopexpr(), gincostestimate(), ginDataFillRoot(), ginEntryFillRoot(), ginFindParents(), ginVacuumPostingTree(), gistcostestimate(), grouping_planner(), has_join_restriction(), has_legal_joinclause(), has_relevant_eclass_joinclause(), has_row_triggers(), has_stored_generated_columns(), has_useful_pathkeys(), hash_inner_and_outer(), hashcostestimate(), have_dangerous_phv(), have_join_order_restriction(), have_partkey_equi_join(), have_relevant_eclass_joinclause(), have_relevant_joinclause(), identify_current_nestloop_params(), index_other_operands_eval_cost(), index_pages_fetched(), indexcol_is_bool_constant_for_query(), ineq_histogram_selectivity(), infer_arbiter_indexes(), init_tour(), initial_cost_mergejoin(), initial_cost_nestloop(), initialize_mergeclause_eclasses(), inline_cte(), inline_set_returning_function(), innerrel_is_unique(), is_degenerate_grouping(), is_foreign_expr(), is_foreign_pathkey(), is_innerrel_unique_for(), is_parallel_safe(), is_pseudo_constant_for_index(), is_simple_subquery(), is_simple_values(), IsTidEqualAnyClause(), join_is_legal(), join_is_removable(), join_search_one_level(), join_selectivity(), jointree_contains_lateral_outer_refs(), label_sort_with_costsize(), linear_rand(), logicalrep_partition_open(), ltreeparentsel(), make_canonical_pathkey(), make_group_input_target(), make_grouping_rel(), make_inner_pathkeys_for_merge(), make_join_rel(), make_modifytable(), make_one_rel(), make_ordered_path(), make_outerjoininfo(), make_partial_grouping_target(), make_partition_pruneinfo(), make_partitionedrel_pruneinfo(), make_pathkey_from_sortinfo(), make_pathkey_from_sortop(), make_pathkeys_for_sortclauses(), make_pathkeys_for_sortclauses_extended(), make_pathkeys_for_window(), make_placeholder_expr(), make_rel_from_joinlist(), make_rels_by_clause_joins(), make_rels_by_clauseless_joins(), make_restrictinfo(), make_restrictinfo_internal(), make_sort_input_target(), make_sub_restrictinfos(), make_subplan(), make_window_input_target(), mark_rels_nulled_by_join(), match_boolean_index_clause(), match_clause_to_index(), match_clause_to_indexcol(), match_clauses_to_index(), match_eclass_clauses_to_index(), match_eclasses_to_foreign_key_col(), match_foreign_keys_to_quals(), match_funcclause_to_indexcol(), match_join_clauses_to_index(), match_opclause_to_indexcol(), match_restriction_clauses_to_index(), match_rowcompare_to_indexcol(), match_saopclause_to_indexcol(), match_unsorted_outer(), matchingsel(), mcv_clause_selectivity_or(), mcv_clauselist_selectivity(), mcv_get_match_bitmap(), merge_clump(), mergejoinscansel(), minmax_qp_callback(), multirangesel(), neqjoinsel(), networkjoinsel(), networksel(), nulltestsel(), NumRelids(), optimize_window_clauses(), order_qual_clauses(), pathkeys_useful_for_grouping(), pathkeys_useful_for_merging(), pathkeys_useful_for_ordering(), pathkeys_useful_for_setop(), patternsel(), patternsel_common(), perform_pullup_replace_vars(), plaintree(), plan_cluster_use_sort(), plan_create_index_workers(), plan_set_operations(), plan_union_children(), populate_joinrel_with_paths(), postgresAddForeignUpdateTargets(), postgresGetForeignJoinPaths(), postgresGetForeignPaths(), postgresGetForeignPlan(), postgresGetForeignRelSize(), postgresGetForeignUpperPaths(), postgresPlanDirectModify(), postgresPlanForeignModify(), postprocess_setop_rel(), prefix_selectivity(), preprocess_aggref(), preprocess_aggrefs(), preprocess_aggrefs_walker(), preprocess_expression(), preprocess_function_rtes(), preprocess_groupclause(), preprocess_grouping_sets(), preprocess_limit(), preprocess_minmax_aggregates(), preprocess_phv_expression(), preprocess_qual_conditions(), preprocess_rowmarks(), preprocess_targetlist(), process_equivalence(), process_implied_equality(), process_security_barrier_quals(), process_subquery_nestloop_params(), pull_up_constant_function(), pull_up_simple_subquery(), pull_up_simple_union_all(), pull_up_simple_values(), pull_up_sublinks(), pull_up_sublinks_jointree_recurse(), pull_up_sublinks_qual_recurse(), pull_up_subqueries(), pull_up_subqueries_recurse(), pull_up_union_leaf_queries(), pull_varnos(), pull_varnos_of_level(), query_planner(), random_init_pool(), rangesel(), reconsider_full_join_clause(), reconsider_outer_join_clause(), reconsider_outer_join_clauses(), record_plan_function_dependency(), record_plan_type_dependency(), recurse_set_operations(), reduce_outer_joins(), reduce_outer_joins_pass2(), reduce_unique_semijoins(), rel_is_distinct_for(), rel_supports_distinctness(), relation_can_be_sorted_early(), relation_excluded_by_constraints(), remap_groupColIdx(), remove_join_clause_from_rels(), remove_rel_from_query(), remove_result_refs(), remove_useless_groupby_columns(), remove_useless_joins(), remove_useless_result_rtes(), remove_useless_results_recurse(), reparameterize_path(), reparameterize_path_by_child(), reparameterize_pathlist_by_child(), replace_correlation_vars_mutator(), replace_nestloop_param_placeholdervar(), replace_nestloop_param_var(), replace_nestloop_params(), replace_nestloop_params_mutator(), replace_outer_agg(), replace_outer_grouping(), replace_outer_merge_support(), replace_outer_placeholdervar(), replace_outer_var(), RestrictInfoIsTidQual(), restriction_is_always_false(), restriction_is_always_true(), restriction_selectivity(), right_merge_direction(), rowcomparesel(), RT_BEGIN_ITERATE(), scalararraysel(), scalararraysel_containment(), scalarineqsel(), scalarineqsel_wrapper(), select_active_windows(), select_mergejoin_clauses(), select_outer_pathkeys_for_merge(), set_append_references(), set_append_rel_pathlist(), set_append_rel_size(), set_base_rel_consider_startup(), set_base_rel_pathlists(), set_base_rel_sizes(), set_baserel_size_estimates(), set_cte_pathlist(), set_cte_size_estimates(), set_customscan_references(), set_foreign_pathlist(), set_foreign_size(), set_foreign_size_estimates(), set_foreignscan_references(), set_function_pathlist(), set_function_size_estimates(), set_hash_references(), set_indexonlyscan_references(), set_join_references(), set_joinrel_size_estimates(), set_mergeappend_references(), set_namedtuplestore_pathlist(), set_namedtuplestore_size_estimates(), set_param_references(), set_pathtarget_cost_width(), set_plain_rel_pathlist(), set_plain_rel_size(), set_plan_references(), set_plan_refs(), set_rel_consider_parallel(), set_rel_pathlist(), set_rel_size(), set_rel_width(), set_relation_partition_info(), set_result_pathlist(), set_result_size_estimates(), set_returning_clause_references(), set_subquery_pathlist(), set_subquery_size_estimates(), set_subqueryscan_references(), set_tablefunc_pathlist(), set_tablefunc_size_estimates(), set_tablesample_rel_pathlist(), set_tablesample_rel_size(), set_upper_references(), set_values_pathlist(), set_values_size_estimates(), set_windowagg_runcondition_references(), set_worktable_pathlist(), setup_simple_rel_arrays(), simplify_EXISTS_query(), sort_inner_and_outer(), spgcostestimate(), split_pathtarget_at_srfs(), spread_chromo(), SS_attach_initplans(), SS_charge_for_initplans(), SS_finalize_plan(), SS_identify_outer_params(), SS_make_initplan_from_plan(), SS_make_initplan_output_param(), SS_process_ctes(), SS_process_sublinks(), SS_replace_correlation_vars(), standard_join_search(), standard_planner(), standard_qp_callback(), statext_clauselist_selectivity(), statext_is_compatible_clause(), statext_is_compatible_clause_internal(), statext_mcv_clauselist_selectivity(), subquery_planner(), system_rows_samplescangetsamplesize(), system_samplescangetsamplesize(), system_time_samplescangetsamplesize(), TidQualFromRestrictInfoList(), translate_col_privs_multilevel(), treat_as_join_clause(), truncate_useless_pathkeys(), try_hashjoin_path(), try_mergejoin_path(), try_nestloop_path(), try_partial_hashjoin_path(), try_partial_mergejoin_path(), try_partial_nestloop_path(), try_partitionwise_join(), tsmatchsel(), use_physical_tlist(), and xmltotext_with_options().

◆ rootnode

Definition at line 1827 of file radixtree.h.

◆ RT_SIZE_CLASS_INFO

const RT_SIZE_CLASS_ELEM RT_SIZE_CLASS_INFO[]
static
Initial value:
= {
[RT_CLASS_4] = {
.name = RT_STR(RT_PREFIX) "_radix_tree node4",
.fanout = RT_FANOUT_4,
.allocsize = sizeof(RT_NODE_4) + RT_FANOUT_4 * sizeof(RT_PTR_ALLOC),
},
.name = RT_STR(RT_PREFIX) "_radix_tree node16_lo",
.fanout = RT_FANOUT_16_LO,
.allocsize = sizeof(RT_NODE_16) + RT_FANOUT_16_LO * sizeof(RT_PTR_ALLOC),
},
.name = RT_STR(RT_PREFIX) "_radix_tree node16_hi",
.fanout = RT_FANOUT_16_HI,
.allocsize = sizeof(RT_NODE_16) + RT_FANOUT_16_HI * sizeof(RT_PTR_ALLOC),
},
.name = RT_STR(RT_PREFIX) "_radix_tree node48",
.fanout = RT_FANOUT_48,
.allocsize = sizeof(RT_NODE_48) + RT_FANOUT_48 * sizeof(RT_PTR_ALLOC),
},
.name = RT_STR(RT_PREFIX) "_radix_tree node256",
.fanout = RT_FANOUT_256,
.allocsize = sizeof(RT_NODE_256),
},
}
#define RT_NODE_4
Definition: radixtree.h:252
#define RT_NODE_256
Definition: radixtree.h:255
#define RT_NODE_48
Definition: radixtree.h:254
#define RT_NODE_16
Definition: radixtree.h:253
#define RT_FANOUT_48
Definition: radixtree.h:601

Definition at line 648 of file radixtree.h.

◆ start_shift

tree ctl start_shift = 0

Definition at line 1887 of file radixtree.h.

Referenced by RT_SET().

◆ tree