163 #define RT_MAKE_PREFIX(a) CppConcat(a,_)
164 #define RT_MAKE_NAME(name) RT_MAKE_NAME_(RT_MAKE_PREFIX(RT_PREFIX),name)
165 #define RT_MAKE_NAME_(a,b) CppConcat(a,b)
169 #define RT_STR(s) RT_STR_(s)
170 #define RT_STR_(s) #s
173 #define RT_CREATE RT_MAKE_NAME(create)
174 #define RT_FREE RT_MAKE_NAME(free)
175 #define RT_FIND RT_MAKE_NAME(find)
177 #define RT_ATTACH RT_MAKE_NAME(attach)
178 #define RT_DETACH RT_MAKE_NAME(detach)
179 #define RT_GET_HANDLE RT_MAKE_NAME(get_handle)
180 #define RT_LOCK_EXCLUSIVE RT_MAKE_NAME(lock_exclusive)
181 #define RT_LOCK_SHARE RT_MAKE_NAME(lock_share)
182 #define RT_UNLOCK RT_MAKE_NAME(unlock)
184 #define RT_SET RT_MAKE_NAME(set)
185 #define RT_BEGIN_ITERATE RT_MAKE_NAME(begin_iterate)
186 #define RT_ITERATE_NEXT RT_MAKE_NAME(iterate_next)
187 #define RT_END_ITERATE RT_MAKE_NAME(end_iterate)
189 #define RT_DELETE RT_MAKE_NAME(delete)
191 #define RT_MEMORY_USAGE RT_MAKE_NAME(memory_usage)
192 #define RT_DUMP_NODE RT_MAKE_NAME(dump_node)
193 #define RT_STATS RT_MAKE_NAME(stats)
196 #define RT_CHILDPTR_IS_VALUE RT_MAKE_NAME(childptr_is_value)
197 #define RT_VALUE_IS_EMBEDDABLE RT_MAKE_NAME(value_is_embeddable)
198 #define RT_GET_SLOT_RECURSIVE RT_MAKE_NAME(get_slot_recursive)
199 #define RT_DELETE_RECURSIVE RT_MAKE_NAME(delete_recursive)
200 #define RT_ALLOC_NODE RT_MAKE_NAME(alloc_node)
201 #define RT_ALLOC_LEAF RT_MAKE_NAME(alloc_leaf)
202 #define RT_FREE_NODE RT_MAKE_NAME(free_node)
203 #define RT_FREE_LEAF RT_MAKE_NAME(free_leaf)
204 #define RT_FREE_RECURSE RT_MAKE_NAME(free_recurse)
205 #define RT_EXTEND_UP RT_MAKE_NAME(extend_up)
206 #define RT_EXTEND_DOWN RT_MAKE_NAME(extend_down)
207 #define RT_COPY_COMMON RT_MAKE_NAME(copy_common)
208 #define RT_PTR_SET_LOCAL RT_MAKE_NAME(ptr_set_local)
209 #define RT_NODE_16_SEARCH_EQ RT_MAKE_NAME(node_16_search_eq)
210 #define RT_NODE_4_GET_INSERTPOS RT_MAKE_NAME(node_4_get_insertpos)
211 #define RT_NODE_16_GET_INSERTPOS RT_MAKE_NAME(node_16_get_insertpos)
212 #define RT_SHIFT_ARRAYS_FOR_INSERT RT_MAKE_NAME(shift_arrays_for_insert)
213 #define RT_SHIFT_ARRAYS_AND_DELETE RT_MAKE_NAME(shift_arrays_and_delete)
214 #define RT_COPY_ARRAYS_FOR_INSERT RT_MAKE_NAME(copy_arrays_for_insert)
215 #define RT_COPY_ARRAYS_AND_DELETE RT_MAKE_NAME(copy_arrays_and_delete)
216 #define RT_NODE_48_IS_CHUNK_USED RT_MAKE_NAME(node_48_is_chunk_used)
217 #define RT_NODE_48_GET_CHILD RT_MAKE_NAME(node_48_get_child)
218 #define RT_NODE_256_IS_CHUNK_USED RT_MAKE_NAME(node_256_is_chunk_used)
219 #define RT_NODE_256_GET_CHILD RT_MAKE_NAME(node_256_get_child)
220 #define RT_KEY_GET_SHIFT RT_MAKE_NAME(key_get_shift)
221 #define RT_SHIFT_GET_MAX_VAL RT_MAKE_NAME(shift_get_max_val)
222 #define RT_NODE_SEARCH RT_MAKE_NAME(node_search)
223 #define RT_NODE_DELETE RT_MAKE_NAME(node_delete)
224 #define RT_NODE_INSERT RT_MAKE_NAME(node_insert)
225 #define RT_ADD_CHILD_4 RT_MAKE_NAME(add_child_4)
226 #define RT_ADD_CHILD_16 RT_MAKE_NAME(add_child_16)
227 #define RT_ADD_CHILD_48 RT_MAKE_NAME(add_child_48)
228 #define RT_ADD_CHILD_256 RT_MAKE_NAME(add_child_256)
229 #define RT_GROW_NODE_4 RT_MAKE_NAME(grow_node_4)
230 #define RT_GROW_NODE_16 RT_MAKE_NAME(grow_node_16)
231 #define RT_GROW_NODE_48 RT_MAKE_NAME(grow_node_48)
232 #define RT_REMOVE_CHILD_4 RT_MAKE_NAME(remove_child_4)
233 #define RT_REMOVE_CHILD_16 RT_MAKE_NAME(remove_child_16)
234 #define RT_REMOVE_CHILD_48 RT_MAKE_NAME(remove_child_48)
235 #define RT_REMOVE_CHILD_256 RT_MAKE_NAME(remove_child_256)
236 #define RT_SHRINK_NODE_16 RT_MAKE_NAME(shrink_child_16)
237 #define RT_SHRINK_NODE_48 RT_MAKE_NAME(shrink_child_48)
238 #define RT_SHRINK_NODE_256 RT_MAKE_NAME(shrink_child_256)
239 #define RT_NODE_ITERATE_NEXT RT_MAKE_NAME(node_iterate_next)
240 #define RT_VERIFY_NODE RT_MAKE_NAME(verify_node)
243 #define RT_RADIX_TREE RT_MAKE_NAME(radix_tree)
244 #define RT_RADIX_TREE_CONTROL RT_MAKE_NAME(radix_tree_control)
245 #define RT_ITER RT_MAKE_NAME(iter)
247 #define RT_HANDLE RT_MAKE_NAME(handle)
249 #define RT_NODE RT_MAKE_NAME(node)
250 #define RT_CHILD_PTR RT_MAKE_NAME(child_ptr)
251 #define RT_NODE_ITER RT_MAKE_NAME(node_iter)
252 #define RT_NODE_4 RT_MAKE_NAME(node_4)
253 #define RT_NODE_16 RT_MAKE_NAME(node_16)
254 #define RT_NODE_48 RT_MAKE_NAME(node_48)
255 #define RT_NODE_256 RT_MAKE_NAME(node_256)
256 #define RT_SIZE_CLASS RT_MAKE_NAME(size_class)
257 #define RT_SIZE_CLASS_ELEM RT_MAKE_NAME(size_class_elem)
258 #define RT_SIZE_CLASS_INFO RT_MAKE_NAME(size_class_info)
259 #define RT_CLASS_4 RT_MAKE_NAME(class_4)
260 #define RT_CLASS_16_LO RT_MAKE_NAME(class_32_min)
261 #define RT_CLASS_16_HI RT_MAKE_NAME(class_32_max)
262 #define RT_CLASS_48 RT_MAKE_NAME(class_48)
263 #define RT_CLASS_256 RT_MAKE_NAME(class_256)
312 #define RT_SPAN BITS_PER_BYTE
318 #define RT_NODE_MAX_SLOTS (1 << RT_SPAN)
321 #define RT_CHUNK_MASK ((1 << RT_SPAN) - 1)
324 #define RT_MAX_SHIFT RT_KEY_GET_SHIFT(UINT64_MAX)
327 #define RT_MAX_LEVEL ((sizeof(uint64) * BITS_PER_BYTE) / RT_SPAN)
330 #define RT_GET_KEY_CHUNK(key, shift) ((uint8) (((key) >> (shift)) & RT_CHUNK_MASK))
333 #define RT_BM_IDX(x) ((x) / BITS_PER_BITMAPWORD)
334 #define RT_BM_BIT(x) ((x) % BITS_PER_BITMAPWORD)
358 #define RT_NODE_KIND_4 0x00
359 #define RT_NODE_KIND_16 0x01
360 #define RT_NODE_KIND_48 0x02
361 #define RT_NODE_KIND_256 0x03
362 #define RT_NODE_KIND_COUNT 4
368 #define RT_SLAB_BLOCK_SIZE(size) \
369 Max(SLAB_DEFAULT_BLOCK_SIZE, pg_nextpower2_32(size * 32))
398 #define RT_PTR_ALLOC dsa_pointer
399 #define RT_INVALID_PTR_ALLOC InvalidDsaPointer
400 #define RT_PTR_ALLOC_IS_VALID(ptr) DsaPointerIsValid(ptr)
402 #define RT_PTR_ALLOC RT_NODE *
403 #define RT_INVALID_PTR_ALLOC NULL
404 #define RT_PTR_ALLOC_IS_VALID(ptr) PointerIsValid(ptr)
430 #ifdef RT_VARLEN_VALUE_SIZE
431 #define RT_GET_VALUE_SIZE(v) RT_VARLEN_VALUE_SIZE(v)
433 #define RT_GET_VALUE_SIZE(v) sizeof(RT_VALUE_TYPE)
443 #ifdef RT_VARLEN_VALUE_SIZE
445 #ifdef RT_RUNTIME_EMBEDDABLE_VALUE
463 #ifdef RT_VARLEN_VALUE_SIZE
465 #ifdef RT_RUNTIME_EMBEDDABLE_VALUE
470 return ((uintptr_t) child) & 1;
489 #define RT_FANOUT_4_MAX (8 - sizeof(RT_NODE))
492 #define RT_FANOUT_16_MAX 32
502 #define RT_FANOUT_48_MAX 64
504 #define RT_FANOUT_256 RT_NODE_MAX_SLOTS
555 #define RT_INVALID_SLOT_IDX 0xFF
577 #if defined(RT_SHMEM)
585 #if SIZEOF_DSA_POINTER < 8
586 #define RT_FANOUT_16_LO ((96 - offsetof(RT_NODE_16, children)) / sizeof(RT_PTR_ALLOC))
587 #define RT_FANOUT_16_HI Min(RT_FANOUT_16_MAX, (160 - offsetof(RT_NODE_16, children)) / sizeof(RT_PTR_ALLOC))
588 #define RT_FANOUT_48 Min(RT_FANOUT_48_MAX, (512 - offsetof(RT_NODE_48, children)) / sizeof(RT_PTR_ALLOC))
590 #define RT_FANOUT_16_LO ((160 - offsetof(RT_NODE_16, children)) / sizeof(RT_PTR_ALLOC))
591 #define RT_FANOUT_16_HI Min(RT_FANOUT_16_MAX, (320 - offsetof(RT_NODE_16, children)) / sizeof(RT_PTR_ALLOC))
592 #define RT_FANOUT_48 Min(RT_FANOUT_48_MAX, (768 - offsetof(RT_NODE_48, children)) / sizeof(RT_PTR_ALLOC))
598 #define RT_FANOUT_16_LO 16
600 #define RT_FANOUT_16_HI RT_FANOUT_16_MAX
601 #define RT_FANOUT_48 RT_FANOUT_48_MAX
611 #define RT_FANOUT_4 4
676 #define RT_NUM_SIZE_CLASSES lengthof(RT_SIZE_CLASS_INFO)
680 #define RT_RADIX_TREE_MAGIC 0x54A48167
825 return (UINT64CONST(1) << (shift +
RT_SPAN)) - 1;
848 node = allocnode.
local;
855 memset(node, 0, offsetof(
RT_NODE_4, children));
858 memset(node, 0, offsetof(
RT_NODE_16, children));
864 memset(n48, 0, offsetof(
RT_NODE_48, slot_idxs));
885 tree->ctl->num_nodes[size_class]++;
907 tree->ctl->num_leaves++;
920 (newnode.
local)->count = (oldnode.
local)->count;
945 tree->ctl->num_nodes[
i]--;
963 tree->ctl->num_leaves--;
994 #if defined(USE_NO_SIMD) || defined(USE_ASSERT_CHECKING)
997 for (
int i = 0;
i < count;
i++)
1014 cmp1 = vector8_eq(spread_chunk, haystack1);
1015 cmp2 = vector8_eq(spread_chunk, haystack2);
1018 bitfield = vector8_highbit_mask(cmp1) | (vector8_highbit_mask(cmp2) <<
sizeof(
Vector8));
1021 bitfield &= ((UINT64CONST(1) << count) - 1);
1027 Assert(slot_simd == slot);
1099 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
1107 shift =
tree->ctl->start_shift;
1132 #define RT_NODE_MUST_GROW(node) \
1133 ((node)->count == (node)->fanout)
1161 #if defined(USE_NO_SIMD) || defined(USE_ASSERT_CHECKING)
1192 #if defined(USE_NO_SIMD) || defined(USE_ASSERT_CHECKING)
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));
1219 Assert((bitfield & ((UINT64CONST(1) << count) - 1)) != 0);
1237 for (
int i = count - 1;
i >= insertpos;
i--)
1243 chunks[
i + 1] = chunks[
i];
1244 children[
i + 1] = children[
i];
1255 int count,
int insertpos)
1257 for (
int i = 0;
i < count;
i++)
1262 int destidx =
i + (
i >= insertpos);
1264 dst_chunks[destidx] = src_chunks[sourceidx];
1265 dst_children[destidx] = src_children[sourceidx];
1316 new256->children[
i] = n48->
children[offset];
1322 new256->isset[word_num] = bitmap;
1326 *parent_slot = newnode.alloc;
1356 Assert(insertpos < n48->base.fanout);
1404 *parent_slot = newnode.
alloc;
1406 return &new16->
children[insertpos];
1450 *parent_slot = newnode.
alloc;
1453 return &new48->
children[insertpos];
1504 *parent_slot = newnode.
alloc;
1507 return &new16->
children[insertpos];
1582 int shift =
tree->ctl->start_shift;
1584 Assert(shift < target_shift);
1587 while (shift < target_shift)
1605 tree->ctl->start_shift = target_shift;
1625 *parent_slot = child.
alloc;
1667 node.
alloc = *parent_slot;
1710 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
1718 if (
tree->ctl->num_keys == 0)
1747 key,
tree->ctl->start_shift, &found);
1759 memcpy(slot, value_p, value_sz);
1761 #ifdef RT_RUNTIME_EMBEDDABLE_VALUE
1766 *((uintptr_t *) slot) |= 1;
1798 memcpy(leaf.
local, value_p, value_sz);
1803 tree->ctl->num_keys++;
1849 tree->ctl->handle = dp;
1850 tree->ctl->magic = RT_RADIX_TREE_MAGIC;
1870 #ifndef RT_VARLEN_VALUE_SIZE
1897 RT_ATTACH(
dsa_area *dsa, RT_HANDLE handle)
1909 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
1917 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
1924 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
1925 return tree->ctl->handle;
1931 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
1938 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
1945 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
2052 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
2062 tree->ctl->magic = 0;
2112 uint8 key_chunk = 0;
2122 node = node_iter->
node;
2126 switch ((node.
local)->kind)
2148 key_chunk = n16->
chunks[node_iter->
idx];
2196 iter->
key |= (((uint64) key_chunk) << (level *
RT_SPAN));
2216 if (iter->
cur_level == 0 && slot != NULL)
2263 #ifdef RT_USE_DELETE
2273 for (
int i = deletepos;
i < count - 1;
i++)
2279 chunks[
i] = chunks[
i + 1];
2280 children[
i] = children[
i + 1];
2291 int count,
int deletepos)
2293 for (
int i = 0;
i < count - 1;
i++)
2299 int sourceidx =
i + (
i >= deletepos);
2302 dst_chunks[destidx] = src_chunks[sourceidx];
2303 dst_children[destidx] = src_children[sourceidx];
2341 new48->slot_idxs[
i] = slot_idx;
2342 new48->children[slot_idx] = n256->
children[
i];
2356 *parent_slot = newnode.alloc;
2363 int shrink_threshold;
2383 if (n256->
base.
count <= shrink_threshold)
2418 Assert(destidx < new16->base.fanout);
2423 *parent_slot = newnode.
alloc;
2451 if (n48->
base.
count <= shrink_threshold)
2481 *parent_slot = newnode.
alloc;
2489 int deletepos = slot - n16->
children;
2524 if (parent_slot == &
tree->ctl->root)
2527 tree->ctl->start_shift = 0;
2548 int deletepos = slot - n4->
children;
2566 switch ((node.
local)->kind)
2601 node.
alloc = *parent_slot;
2645 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
2658 tree->ctl->num_keys--;
2681 Assert(
tree->ctl->magic == RT_RADIX_TREE_MAGIC);
2696 #ifdef USE_ASSERT_CHECKING
2739 Assert(slot < node->fanout);
2785 fprintf(stderr,
"num_keys = %lld\n", (
long long)
tree->ctl->num_keys);
2797 fprintf(stderr,
", n%d = %lld", size_class.
fanout, (
long long)
tree->ctl->num_nodes[
i]);
2800 fprintf(stderr,
", leaves = %lld", (
long long)
tree->ctl->num_leaves);
2813 #define RT_CHILD_PTR_FORMAT DSA_POINTER_FORMAT
2815 #define RT_CHILD_PTR_FORMAT "%p"
2818 fprintf(stderr,
"kind %d, fanout %d, count %u\n",
2822 node->fanout == 0 ? 256 : node->fanout,
2823 node->count == 0 ? 256 : node->count);
2831 fprintf(stderr,
"chunks and slots:\n");
2834 fprintf(stderr,
" [%d] chunk %x slot " RT_CHILD_PTR_FORMAT
"\n",
2844 fprintf(stderr,
"chunks and slots:\n");
2847 fprintf(stderr,
" [%d] chunk %x slot " RT_CHILD_PTR_FORMAT
"\n",
2857 fprintf(stderr,
"slot_idxs: \n");
2863 fprintf(stderr,
" idx[%d] = %d\n",
2867 fprintf(stderr,
"isset-bitmap: ");
2875 fprintf(stderr,
"chunks and slots:\n");
2881 fprintf(stderr,
" chunk %x slot " RT_CHILD_PTR_FORMAT
"\n",
2892 fprintf(stderr,
"isset-bitmap: ");
2900 fprintf(stderr,
"chunks and slots:\n");
2906 fprintf(stderr,
" chunk %x slot " RT_CHILD_PTR_FORMAT
"\n",
2924 #undef RT_VALUE_TYPE
2925 #undef RT_VARLEN_VALUE_SIZE
2926 #undef RT_RUNTIME_EMBEDDABLE_VALUE
2928 #undef RT_USE_DELETE
2932 #undef RT_MAKE_PREFIX
2934 #undef RT_MAKE_NAME_
2938 #undef RT_NODE_MAX_SLOTS
2939 #undef RT_CHUNK_MASK
2942 #undef RT_GET_KEY_CHUNK
2945 #undef RT_NODE_MUST_GROW
2946 #undef RT_NODE_KIND_COUNT
2947 #undef RT_NUM_SIZE_CLASSES
2948 #undef RT_INVALID_SLOT_IDX
2949 #undef RT_SLAB_BLOCK_SIZE
2950 #undef RT_RADIX_TREE_MAGIC
2951 #undef RT_CHILD_PTR_FORMAT
2954 #undef RT_RADIX_TREE
2955 #undef RT_RADIX_TREE_CONTROL
2958 #undef RT_INVALID_PTR_ALLOC
2963 #undef RT_NODE_KIND_4
2964 #undef RT_NODE_KIND_16
2965 #undef RT_NODE_KIND_48
2966 #undef RT_NODE_KIND_256
2971 #undef RT_SIZE_CLASS
2972 #undef RT_SIZE_CLASS_ELEM
2973 #undef RT_SIZE_CLASS_INFO
2975 #undef RT_CLASS_16_LO
2976 #undef RT_CLASS_16_HI
2980 #undef RT_FANOUT_4_MAX
2981 #undef RT_FANOUT_16_LO
2982 #undef RT_FANOUT_16_HI
2983 #undef RT_FANOUT_16_MAX
2985 #undef RT_FANOUT_48_MAX
2986 #undef RT_FANOUT_256
2993 #undef RT_LOCK_EXCLUSIVE
2994 #undef RT_LOCK_SHARE
2996 #undef RT_GET_HANDLE
2999 #undef RT_BEGIN_ITERATE
3000 #undef RT_ITERATE_NEXT
3001 #undef RT_END_ITERATE
3003 #undef RT_MEMORY_USAGE
3008 #undef RT_GET_VALUE_SIZE
3009 #undef RT_VALUE_IS_EMBEDDABLE
3010 #undef RT_CHILDPTR_IS_VALUE
3011 #undef RT_GET_SLOT_RECURSIVE
3012 #undef RT_DELETE_RECURSIVE
3013 #undef RT_ALLOC_NODE
3014 #undef RT_ALLOC_LEAF
3017 #undef RT_FREE_RECURSE
3019 #undef RT_EXTEND_DOWN
3020 #undef RT_COPY_COMMON
3021 #undef RT_PTR_SET_LOCAL
3022 #undef RT_PTR_ALLOC_IS_VALID
3023 #undef RT_NODE_16_SEARCH_EQ
3024 #undef RT_NODE_4_GET_INSERTPOS
3025 #undef RT_NODE_16_GET_INSERTPOS
3026 #undef RT_SHIFT_ARRAYS_FOR_INSERT
3027 #undef RT_SHIFT_ARRAYS_AND_DELETE
3028 #undef RT_COPY_ARRAYS_FOR_INSERT
3029 #undef RT_COPY_ARRAYS_AND_DELETE
3030 #undef RT_NODE_48_IS_CHUNK_USED
3031 #undef RT_NODE_48_GET_CHILD
3032 #undef RT_NODE_256_IS_CHUNK_USED
3033 #undef RT_NODE_256_GET_CHILD
3034 #undef RT_KEY_GET_SHIFT
3035 #undef RT_SHIFT_GET_MAX_VAL
3036 #undef RT_NODE_SEARCH
3037 #undef RT_ADD_CHILD_4
3038 #undef RT_ADD_CHILD_16
3039 #undef RT_ADD_CHILD_48
3040 #undef RT_ADD_CHILD_256
3041 #undef RT_GROW_NODE_4
3042 #undef RT_GROW_NODE_16
3043 #undef RT_GROW_NODE_48
3044 #undef RT_REMOVE_CHILD_4
3045 #undef RT_REMOVE_CHILD_16
3046 #undef RT_REMOVE_CHILD_48
3047 #undef RT_REMOVE_CHILD_256
3048 #undef RT_SHRINK_NODE_16
3049 #undef RT_SHRINK_NODE_48
3050 #undef RT_SHRINK_NODE_256
3051 #undef RT_NODE_DELETE
3052 #undef RT_NODE_INSERT
3053 #undef RT_NODE_ITERATE_NEXT
3054 #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)