165 #define RT_MAKE_PREFIX(a) CppConcat(a,_)
166 #define RT_MAKE_NAME(name) RT_MAKE_NAME_(RT_MAKE_PREFIX(RT_PREFIX),name)
167 #define RT_MAKE_NAME_(a,b) CppConcat(a,b)
171 #define RT_STR(s) RT_STR_(s)
172 #define RT_STR_(s) #s
175 #define RT_CREATE RT_MAKE_NAME(create)
176 #define RT_FREE RT_MAKE_NAME(free)
177 #define RT_FIND RT_MAKE_NAME(find)
179 #define RT_ATTACH RT_MAKE_NAME(attach)
180 #define RT_DETACH RT_MAKE_NAME(detach)
181 #define RT_GET_HANDLE RT_MAKE_NAME(get_handle)
182 #define RT_LOCK_EXCLUSIVE RT_MAKE_NAME(lock_exclusive)
183 #define RT_LOCK_SHARE RT_MAKE_NAME(lock_share)
184 #define RT_UNLOCK RT_MAKE_NAME(unlock)
186 #define RT_SET RT_MAKE_NAME(set)
187 #define RT_BEGIN_ITERATE RT_MAKE_NAME(begin_iterate)
188 #define RT_ITERATE_NEXT RT_MAKE_NAME(iterate_next)
189 #define RT_END_ITERATE RT_MAKE_NAME(end_iterate)
191 #define RT_DELETE RT_MAKE_NAME(delete)
193 #define RT_MEMORY_USAGE RT_MAKE_NAME(memory_usage)
194 #define RT_DUMP_NODE RT_MAKE_NAME(dump_node)
195 #define RT_STATS RT_MAKE_NAME(stats)
198 #define RT_CHILDPTR_IS_VALUE RT_MAKE_NAME(childptr_is_value)
199 #define RT_VALUE_IS_EMBEDDABLE RT_MAKE_NAME(value_is_embeddable)
200 #define RT_GET_SLOT_RECURSIVE RT_MAKE_NAME(get_slot_recursive)
201 #define RT_DELETE_RECURSIVE RT_MAKE_NAME(delete_recursive)
202 #define RT_ALLOC_NODE RT_MAKE_NAME(alloc_node)
203 #define RT_ALLOC_LEAF RT_MAKE_NAME(alloc_leaf)
204 #define RT_FREE_NODE RT_MAKE_NAME(free_node)
205 #define RT_FREE_LEAF RT_MAKE_NAME(free_leaf)
206 #define RT_FREE_RECURSE RT_MAKE_NAME(free_recurse)
207 #define RT_EXTEND_UP RT_MAKE_NAME(extend_up)
208 #define RT_EXTEND_DOWN RT_MAKE_NAME(extend_down)
209 #define RT_COPY_COMMON RT_MAKE_NAME(copy_common)
210 #define RT_PTR_SET_LOCAL RT_MAKE_NAME(ptr_set_local)
211 #define RT_NODE_16_SEARCH_EQ RT_MAKE_NAME(node_16_search_eq)
212 #define RT_NODE_4_GET_INSERTPOS RT_MAKE_NAME(node_4_get_insertpos)
213 #define RT_NODE_16_GET_INSERTPOS RT_MAKE_NAME(node_16_get_insertpos)
214 #define RT_SHIFT_ARRAYS_FOR_INSERT RT_MAKE_NAME(shift_arrays_for_insert)
215 #define RT_SHIFT_ARRAYS_AND_DELETE RT_MAKE_NAME(shift_arrays_and_delete)
216 #define RT_COPY_ARRAYS_FOR_INSERT RT_MAKE_NAME(copy_arrays_for_insert)
217 #define RT_COPY_ARRAYS_AND_DELETE RT_MAKE_NAME(copy_arrays_and_delete)
218 #define RT_NODE_48_IS_CHUNK_USED RT_MAKE_NAME(node_48_is_chunk_used)
219 #define RT_NODE_48_GET_CHILD RT_MAKE_NAME(node_48_get_child)
220 #define RT_NODE_256_IS_CHUNK_USED RT_MAKE_NAME(node_256_is_chunk_used)
221 #define RT_NODE_256_GET_CHILD RT_MAKE_NAME(node_256_get_child)
222 #define RT_KEY_GET_SHIFT RT_MAKE_NAME(key_get_shift)
223 #define RT_SHIFT_GET_MAX_VAL RT_MAKE_NAME(shift_get_max_val)
224 #define RT_NODE_SEARCH RT_MAKE_NAME(node_search)
225 #define RT_NODE_DELETE RT_MAKE_NAME(node_delete)
226 #define RT_NODE_INSERT RT_MAKE_NAME(node_insert)
227 #define RT_ADD_CHILD_4 RT_MAKE_NAME(add_child_4)
228 #define RT_ADD_CHILD_16 RT_MAKE_NAME(add_child_16)
229 #define RT_ADD_CHILD_48 RT_MAKE_NAME(add_child_48)
230 #define RT_ADD_CHILD_256 RT_MAKE_NAME(add_child_256)
231 #define RT_GROW_NODE_4 RT_MAKE_NAME(grow_node_4)
232 #define RT_GROW_NODE_16 RT_MAKE_NAME(grow_node_16)
233 #define RT_GROW_NODE_48 RT_MAKE_NAME(grow_node_48)
234 #define RT_REMOVE_CHILD_4 RT_MAKE_NAME(remove_child_4)
235 #define RT_REMOVE_CHILD_16 RT_MAKE_NAME(remove_child_16)
236 #define RT_REMOVE_CHILD_48 RT_MAKE_NAME(remove_child_48)
237 #define RT_REMOVE_CHILD_256 RT_MAKE_NAME(remove_child_256)
238 #define RT_SHRINK_NODE_16 RT_MAKE_NAME(shrink_child_16)
239 #define RT_SHRINK_NODE_48 RT_MAKE_NAME(shrink_child_48)
240 #define RT_SHRINK_NODE_256 RT_MAKE_NAME(shrink_child_256)
241 #define RT_NODE_ITERATE_NEXT RT_MAKE_NAME(node_iterate_next)
242 #define RT_VERIFY_NODE RT_MAKE_NAME(verify_node)
245 #define RT_RADIX_TREE RT_MAKE_NAME(radix_tree)
246 #define RT_RADIX_TREE_CONTROL RT_MAKE_NAME(radix_tree_control)
247 #define RT_ITER RT_MAKE_NAME(iter)
249 #define RT_HANDLE RT_MAKE_NAME(handle)
251 #define RT_NODE RT_MAKE_NAME(node)
252 #define RT_CHILD_PTR RT_MAKE_NAME(child_ptr)
253 #define RT_NODE_ITER RT_MAKE_NAME(node_iter)
254 #define RT_NODE_4 RT_MAKE_NAME(node_4)
255 #define RT_NODE_16 RT_MAKE_NAME(node_16)
256 #define RT_NODE_48 RT_MAKE_NAME(node_48)
257 #define RT_NODE_256 RT_MAKE_NAME(node_256)
258 #define RT_SIZE_CLASS RT_MAKE_NAME(size_class)
259 #define RT_SIZE_CLASS_ELEM RT_MAKE_NAME(size_class_elem)
260 #define RT_SIZE_CLASS_INFO RT_MAKE_NAME(size_class_info)
261 #define RT_CLASS_4 RT_MAKE_NAME(class_4)
262 #define RT_CLASS_16_LO RT_MAKE_NAME(class_32_min)
263 #define RT_CLASS_16_HI RT_MAKE_NAME(class_32_max)
264 #define RT_CLASS_48 RT_MAKE_NAME(class_48)
265 #define RT_CLASS_256 RT_MAKE_NAME(class_256)
314 #define RT_SPAN BITS_PER_BYTE
320 #define RT_NODE_MAX_SLOTS (1 << RT_SPAN)
323 #define RT_CHUNK_MASK ((1 << RT_SPAN) - 1)
326 #define RT_MAX_SHIFT RT_KEY_GET_SHIFT(UINT64_MAX)
329 #define RT_MAX_LEVEL ((sizeof(uint64) * BITS_PER_BYTE) / RT_SPAN)
332 #define RT_GET_KEY_CHUNK(key, shift) ((uint8) (((key) >> (shift)) & RT_CHUNK_MASK))
335 #define RT_BM_IDX(x) ((x) / BITS_PER_BITMAPWORD)
336 #define RT_BM_BIT(x) ((x) % BITS_PER_BITMAPWORD)
360 #define RT_NODE_KIND_4 0x00
361 #define RT_NODE_KIND_16 0x01
362 #define RT_NODE_KIND_48 0x02
363 #define RT_NODE_KIND_256 0x03
364 #define RT_NODE_KIND_COUNT 4
370 #define RT_SLAB_BLOCK_SIZE(size) \
371 Max(SLAB_DEFAULT_BLOCK_SIZE, pg_nextpower2_32(size * 32))
400 #define RT_PTR_ALLOC dsa_pointer
401 #define RT_INVALID_PTR_ALLOC InvalidDsaPointer
402 #define RT_PTR_ALLOC_IS_VALID(ptr) DsaPointerIsValid(ptr)
404 #define RT_PTR_ALLOC RT_NODE *
405 #define RT_INVALID_PTR_ALLOC NULL
406 #define RT_PTR_ALLOC_IS_VALID(ptr) PointerIsValid(ptr)
432 #ifdef RT_VARLEN_VALUE_SIZE
433 #define RT_GET_VALUE_SIZE(v) RT_VARLEN_VALUE_SIZE(v)
435 #define RT_GET_VALUE_SIZE(v) sizeof(RT_VALUE_TYPE)
445 #ifdef RT_VARLEN_VALUE_SIZE
447 #ifdef RT_RUNTIME_EMBEDDABLE_VALUE
465 #ifdef RT_VARLEN_VALUE_SIZE
467 #ifdef RT_RUNTIME_EMBEDDABLE_VALUE
472 return ((uintptr_t) child) & 1;
491 #define RT_FANOUT_4_MAX (8 - sizeof(RT_NODE))
494 #define RT_FANOUT_16_MAX 32
504 #define RT_FANOUT_48_MAX 64
506 #define RT_FANOUT_256 RT_NODE_MAX_SLOTS
557 #define RT_INVALID_SLOT_IDX 0xFF
579 #if defined(RT_SHMEM)
587 #if SIZEOF_DSA_POINTER < 8
588 #define RT_FANOUT_16_LO ((96 - offsetof(RT_NODE_16, children)) / sizeof(RT_PTR_ALLOC))
589 #define RT_FANOUT_16_HI Min(RT_FANOUT_16_MAX, (160 - offsetof(RT_NODE_16, children)) / sizeof(RT_PTR_ALLOC))
590 #define RT_FANOUT_48 Min(RT_FANOUT_48_MAX, (512 - offsetof(RT_NODE_48, children)) / sizeof(RT_PTR_ALLOC))
592 #define RT_FANOUT_16_LO ((160 - offsetof(RT_NODE_16, children)) / sizeof(RT_PTR_ALLOC))
593 #define RT_FANOUT_16_HI Min(RT_FANOUT_16_MAX, (320 - offsetof(RT_NODE_16, children)) / sizeof(RT_PTR_ALLOC))
594 #define RT_FANOUT_48 Min(RT_FANOUT_48_MAX, (768 - offsetof(RT_NODE_48, children)) / sizeof(RT_PTR_ALLOC))
600 #define RT_FANOUT_16_LO 16
602 #define RT_FANOUT_16_HI RT_FANOUT_16_MAX
603 #define RT_FANOUT_48 RT_FANOUT_48_MAX
613 #define RT_FANOUT_4 4
678 #define RT_NUM_SIZE_CLASSES lengthof(RT_SIZE_CLASS_INFO)
682 #define RT_RADIX_TREE_MAGIC 0x54A48167
850 node = allocnode.
local;
857 memset(node, 0, offsetof(
RT_NODE_4, children));
860 memset(node, 0, offsetof(
RT_NODE_16, children));
866 memset(n48, 0, offsetof(
RT_NODE_48, slot_idxs));
887 tree->ctl->num_nodes[size_class]++;
909 tree->ctl->num_leaves++;
922 (newnode.
local)->count = (oldnode.
local)->count;
947 tree->ctl->num_nodes[
i]--;
965 tree->ctl->num_leaves--;
996 #if defined(USE_NO_SIMD) || defined(USE_ASSERT_CHECKING)
999 for (
int i = 0;
i < count;
i++)
1016 cmp1 = vector8_eq(spread_chunk, haystack1);
1017 cmp2 = vector8_eq(spread_chunk, haystack2);
1020 bitfield = vector8_highbit_mask(cmp1) | (vector8_highbit_mask(cmp2) <<
sizeof(
Vector8));
1029 Assert(slot_simd == slot);
1101 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
1109 shift =
tree->ctl->start_shift;
1134 #define RT_NODE_MUST_GROW(node) \
1135 ((node)->count == (node)->fanout)
1163 #if defined(USE_NO_SIMD) || defined(USE_ASSERT_CHECKING)
1194 #if defined(USE_NO_SIMD) || defined(USE_ASSERT_CHECKING)
1215 min1 = vector8_min(spread_chunk, haystack1);
1216 min2 = vector8_min(spread_chunk, haystack2);
1217 cmp1 = vector8_eq(spread_chunk, min1);
1218 cmp2 = vector8_eq(spread_chunk, min2);
1219 bitfield = vector8_highbit_mask(cmp1) | (vector8_highbit_mask(cmp2) <<
sizeof(
Vector8));
1239 for (
int i = count - 1;
i >= insertpos;
i--)
1245 chunks[
i + 1] = chunks[
i];
1246 children[
i + 1] = children[
i];
1257 int count,
int insertpos)
1259 for (
int i = 0;
i < count;
i++)
1264 int destidx =
i + (
i >= insertpos);
1266 dst_chunks[destidx] = src_chunks[sourceidx];
1267 dst_children[destidx] = src_children[sourceidx];
1318 new256->children[
i] = n48->
children[offset];
1324 new256->isset[word_num] = bitmap;
1328 *parent_slot = newnode.alloc;
1358 Assert(insertpos < n48->base.fanout);
1406 *parent_slot = newnode.
alloc;
1408 return &new16->
children[insertpos];
1452 *parent_slot = newnode.
alloc;
1455 return &new48->
children[insertpos];
1506 *parent_slot = newnode.
alloc;
1509 return &new16->
children[insertpos];
1584 int shift =
tree->ctl->start_shift;
1586 Assert(shift < target_shift);
1589 while (shift < target_shift)
1607 tree->ctl->start_shift = target_shift;
1627 *parent_slot = child.
alloc;
1669 node.
alloc = *parent_slot;
1712 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
1720 if (
tree->ctl->num_keys == 0)
1749 key,
tree->ctl->start_shift, &found);
1761 memcpy(slot, value_p, value_sz);
1763 #ifdef RT_RUNTIME_EMBEDDABLE_VALUE
1768 *((uintptr_t *) slot) |= 1;
1800 memcpy(leaf.
local, value_p, value_sz);
1805 tree->ctl->num_keys++;
1851 tree->ctl->handle = dp;
1852 tree->ctl->magic = RT_RADIX_TREE_MAGIC;
1872 #ifndef RT_VARLEN_VALUE_SIZE
1899 RT_ATTACH(
dsa_area *dsa, RT_HANDLE handle)
1911 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
1919 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
1926 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
1927 return tree->ctl->handle;
1933 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
1940 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
1947 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
2054 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
2064 tree->ctl->magic = 0;
2114 uint8 key_chunk = 0;
2124 node = node_iter->
node;
2128 switch ((node.
local)->kind)
2150 key_chunk = n16->
chunks[node_iter->
idx];
2218 if (iter->
cur_level == 0 && slot != NULL)
2265 #ifdef RT_USE_DELETE
2275 for (
int i = deletepos;
i < count - 1;
i++)
2281 chunks[
i] = chunks[
i + 1];
2282 children[
i] = children[
i + 1];
2293 int count,
int deletepos)
2295 for (
int i = 0;
i < count - 1;
i++)
2301 int sourceidx =
i + (
i >= deletepos);
2304 dst_chunks[destidx] = src_chunks[sourceidx];
2305 dst_children[destidx] = src_children[sourceidx];
2343 new48->slot_idxs[
i] = slot_idx;
2344 new48->children[slot_idx] = n256->
children[
i];
2358 *parent_slot = newnode.alloc;
2365 int shrink_threshold;
2385 if (n256->
base.
count <= shrink_threshold)
2420 Assert(destidx < new16->base.fanout);
2425 *parent_slot = newnode.
alloc;
2453 if (n48->
base.
count <= shrink_threshold)
2483 *parent_slot = newnode.
alloc;
2491 int deletepos = slot - n16->
children;
2526 if (parent_slot == &
tree->ctl->root)
2529 tree->ctl->start_shift = 0;
2550 int deletepos = slot - n4->
children;
2568 switch ((node.
local)->kind)
2603 node.
alloc = *parent_slot;
2647 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
2660 tree->ctl->num_keys--;
2683 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
2698 #ifdef USE_ASSERT_CHECKING
2741 Assert(slot < node->fanout);
2787 fprintf(stderr,
"num_keys = %lld\n", (
long long)
tree->ctl->num_keys);
2799 fprintf(stderr,
", n%d = %lld", size_class.
fanout, (
long long)
tree->ctl->num_nodes[
i]);
2802 fprintf(stderr,
", leaves = %lld", (
long long)
tree->ctl->num_leaves);
2815 #define RT_CHILD_PTR_FORMAT DSA_POINTER_FORMAT
2817 #define RT_CHILD_PTR_FORMAT "%p"
2820 fprintf(stderr,
"kind %d, fanout %d, count %u\n",
2824 node->fanout == 0 ? 256 : node->fanout,
2825 node->count == 0 ? 256 : node->count);
2833 fprintf(stderr,
"chunks and slots:\n");
2836 fprintf(stderr,
" [%d] chunk %x slot " RT_CHILD_PTR_FORMAT
"\n",
2846 fprintf(stderr,
"chunks and slots:\n");
2849 fprintf(stderr,
" [%d] chunk %x slot " RT_CHILD_PTR_FORMAT
"\n",
2859 fprintf(stderr,
"slot_idxs: \n");
2865 fprintf(stderr,
" idx[%d] = %d\n",
2869 fprintf(stderr,
"isset-bitmap: ");
2877 fprintf(stderr,
"chunks and slots:\n");
2883 fprintf(stderr,
" chunk %x slot " RT_CHILD_PTR_FORMAT
"\n",
2894 fprintf(stderr,
"isset-bitmap: ");
2902 fprintf(stderr,
"chunks and slots:\n");
2908 fprintf(stderr,
" chunk %x slot " RT_CHILD_PTR_FORMAT
"\n",
2926 #undef RT_VALUE_TYPE
2927 #undef RT_VARLEN_VALUE_SIZE
2928 #undef RT_RUNTIME_EMBEDDABLE_VALUE
2930 #undef RT_USE_DELETE
2934 #undef RT_MAKE_PREFIX
2936 #undef RT_MAKE_NAME_
2940 #undef RT_NODE_MAX_SLOTS
2941 #undef RT_CHUNK_MASK
2944 #undef RT_GET_KEY_CHUNK
2947 #undef RT_NODE_MUST_GROW
2948 #undef RT_NODE_KIND_COUNT
2949 #undef RT_NUM_SIZE_CLASSES
2950 #undef RT_INVALID_SLOT_IDX
2951 #undef RT_SLAB_BLOCK_SIZE
2952 #undef RT_RADIX_TREE_MAGIC
2953 #undef RT_CHILD_PTR_FORMAT
2956 #undef RT_RADIX_TREE
2957 #undef RT_RADIX_TREE_CONTROL
2960 #undef RT_INVALID_PTR_ALLOC
2965 #undef RT_NODE_KIND_4
2966 #undef RT_NODE_KIND_16
2967 #undef RT_NODE_KIND_48
2968 #undef RT_NODE_KIND_256
2973 #undef RT_SIZE_CLASS
2974 #undef RT_SIZE_CLASS_ELEM
2975 #undef RT_SIZE_CLASS_INFO
2977 #undef RT_CLASS_16_LO
2978 #undef RT_CLASS_16_HI
2982 #undef RT_FANOUT_4_MAX
2983 #undef RT_FANOUT_16_LO
2984 #undef RT_FANOUT_16_HI
2985 #undef RT_FANOUT_16_MAX
2987 #undef RT_FANOUT_48_MAX
2988 #undef RT_FANOUT_256
2995 #undef RT_LOCK_EXCLUSIVE
2996 #undef RT_LOCK_SHARE
2998 #undef RT_GET_HANDLE
3001 #undef RT_BEGIN_ITERATE
3002 #undef RT_ITERATE_NEXT
3003 #undef RT_END_ITERATE
3005 #undef RT_MEMORY_USAGE
3010 #undef RT_GET_VALUE_SIZE
3011 #undef RT_VALUE_IS_EMBEDDABLE
3012 #undef RT_CHILDPTR_IS_VALUE
3013 #undef RT_GET_SLOT_RECURSIVE
3014 #undef RT_DELETE_RECURSIVE
3015 #undef RT_ALLOC_NODE
3016 #undef RT_ALLOC_LEAF
3019 #undef RT_FREE_RECURSE
3021 #undef RT_EXTEND_DOWN
3022 #undef RT_COPY_COMMON
3023 #undef RT_PTR_SET_LOCAL
3024 #undef RT_PTR_ALLOC_IS_VALID
3025 #undef RT_NODE_16_SEARCH_EQ
3026 #undef RT_NODE_4_GET_INSERTPOS
3027 #undef RT_NODE_16_GET_INSERTPOS
3028 #undef RT_SHIFT_ARRAYS_FOR_INSERT
3029 #undef RT_SHIFT_ARRAYS_AND_DELETE
3030 #undef RT_COPY_ARRAYS_FOR_INSERT
3031 #undef RT_COPY_ARRAYS_AND_DELETE
3032 #undef RT_NODE_48_IS_CHUNK_USED
3033 #undef RT_NODE_48_GET_CHILD
3034 #undef RT_NODE_256_IS_CHUNK_USED
3035 #undef RT_NODE_256_GET_CHILD
3036 #undef RT_KEY_GET_SHIFT
3037 #undef RT_SHIFT_GET_MAX_VAL
3038 #undef RT_NODE_SEARCH
3039 #undef RT_ADD_CHILD_4
3040 #undef RT_ADD_CHILD_16
3041 #undef RT_ADD_CHILD_48
3042 #undef RT_ADD_CHILD_256
3043 #undef RT_GROW_NODE_4
3044 #undef RT_GROW_NODE_16
3045 #undef RT_GROW_NODE_48
3046 #undef RT_REMOVE_CHILD_4
3047 #undef RT_REMOVE_CHILD_16
3048 #undef RT_REMOVE_CHILD_48
3049 #undef RT_REMOVE_CHILD_256
3050 #undef RT_SHRINK_NODE_16
3051 #undef RT_SHRINK_NODE_48
3052 #undef RT_SHRINK_NODE_256
3053 #undef RT_NODE_DELETE
3054 #undef RT_NODE_INSERT
3055 #undef RT_NODE_ITERATE_NEXT
3056 #undef RT_VERIFY_NODE
Datum idx(PG_FUNCTION_ARGS)
#define bmw_rightmost_one_pos(w)
#define BITS_PER_BITMAPWORD
#define pg_attribute_unused()
#define Assert(condition)
#define FLEXIBLE_ARRAY_MEMBER
size_t dsa_get_total_size(dsa_area *area)
void * dsa_get_address(dsa_area *area, dsa_pointer dp)
void dsa_free(dsa_area *area, dsa_pointer dp)
#define dsa_allocate0(area, size)
#define DSA_POINTER_FORMAT
#define dsa_allocate(area, size)
if(TABLE==NULL||TABLE_index==NULL)
bool LWLockAcquire(LWLock *lock, LWLockMode mode)
void LWLockRelease(LWLock *lock)
void LWLockInitialize(LWLock *lock, int tranche_id)
void MemoryContextReset(MemoryContext context)
void pfree(void *pointer)
void * palloc0(Size size)
void * MemoryContextAllocZero(MemoryContext context, Size size)
void * MemoryContextAlloc(MemoryContext context, Size size)
Size MemoryContextMemAllocated(MemoryContext context, bool recurse)
#define AllocSetContextCreate
#define ALLOCSET_SMALL_SIZES
static int pg_rightmost_one_pos32(uint32 word)
static int pg_leftmost_one_pos64(uint64 word)
void check_stack_depth(void)
#define RT_NODE_ITERATE_NEXT
#define RT_NODE_4_GET_INSERTPOS
#define RT_INVALID_SLOT_IDX
#define RT_CHILDPTR_IS_VALUE
#define RT_REMOVE_CHILD_16
#define RT_VALUE_IS_EMBEDDABLE
#define RT_NODE_16_GET_INSERTPOS
#define RT_NODE_48_GET_CHILD
#define RT_NODE_MAX_SLOTS
RT_SCOPE RT_RADIX_TREE *MemoryContext old_ctx
#define RT_COPY_ARRAYS_FOR_INSERT
#define RT_DELETE_RECURSIVE
#define RT_GET_SLOT_RECURSIVE
for(int i=0;i< RT_NUM_SIZE_CLASSES;i++)
#define RT_SHRINK_NODE_256
#define RT_SHRINK_NODE_48
#define RT_SIZE_CLASS_ELEM
MemoryContextSwitchTo(old_ctx)
#define RT_REMOVE_CHILD_256
#define RT_RADIX_TREE_CONTROL
#define RT_NODE_MUST_GROW(node)
#define RT_SLAB_BLOCK_SIZE(size)
#define RT_SHIFT_GET_MAX_VAL
#define RT_NODE_48_IS_CHUNK_USED
#define RT_COPY_ARRAYS_AND_DELETE
#define RT_REMOVE_CHILD_48
#define RT_SHIFT_ARRAYS_AND_DELETE
#define RT_NODE_256_GET_CHILD
StaticAssertDecl(RT_FANOUT_4<=RT_FANOUT_4_MAX, "watch struct padding")
#define RT_SHRINK_NODE_16
#define RT_PTR_ALLOC_IS_VALID(ptr)
#define RT_GET_KEY_CHUNK(key, shift)
#define RT_GET_VALUE_SIZE(v)
#define RT_NODE_256_IS_CHUNK_USED
#define RT_SHIFT_ARRAYS_FOR_INSERT
#define RT_NODE_16_SEARCH_EQ
#define RT_SIZE_CLASS_INFO
#define RT_INVALID_PTR_ALLOC
#define RT_REMOVE_CHILD_4
#define RT_NUM_SIZE_CLASSES
static Vector8 vector8_broadcast(const uint8 c)
static void vector8_load(Vector8 *v, const uint8 *s)
MemoryContext SlabContextCreate(MemoryContext parent, const char *name, Size blockSize, Size chunkSize)
RT_NODE_ITER node_iters[RT_MAX_LEVEL]
RT_PTR_ALLOC children[FLEXIBLE_ARRAY_MEMBER]
uint8 chunks[RT_FANOUT_16_MAX]
RT_PTR_ALLOC children[RT_FANOUT_256]
bitmapword isset[RT_BM_IDX(RT_FANOUT_256)]
RT_PTR_ALLOC children[FLEXIBLE_ARRAY_MEMBER]
uint8 slot_idxs[RT_NODE_MAX_SLOTS]
bitmapword isset[RT_BM_IDX(RT_FANOUT_48_MAX)]
RT_PTR_ALLOC children[FLEXIBLE_ARRAY_MEMBER]
uint8 chunks[RT_FANOUT_4_MAX]
MemoryContextData * node_slabs[RT_NUM_SIZE_CLASSES]
MemoryContextData * leaf_context
MemoryContextData * iter_context
RT_RADIX_TREE_CONTROL * ctl
Datum bit(PG_FUNCTION_ARGS)