49#define LF_DYNARRAY_LEVEL_LENGTH 256
50#define LF_DYNARRAY_LEVELS 4
69#define LF_PINBOX_PINS 4
70#define LF_PURGATORY_SIZE 10
90#if SIZEOF_INT * 2 + SIZEOF_CHARP * (LF_PINBOX_PINS + 2) != 64
100#if defined(__GNUC__) && defined(MY_LF_EXTRA_DEBUG)
101#define LF_REQUIRE_PINS(N) \
102 static const char require_pins[LF_PINBOX_PINS - N] [[maybe_unused]]; \
103 static const int LF_NUM_PINS_IN_THIS_FILE = N;
105#define LF_REQUIRE_PINS(N)
109#if defined(__GNUC__) && defined(MY_LF_EXTRA_DEBUG)
110 assert(pin < LF_NUM_PINS_IN_THIS_FILE);
112 pins->
pin[pin].store(addr);
116#if defined(__GNUC__) && defined(MY_LF_EXTRA_DEBUG)
117 assert(pin < LF_NUM_PINS_IN_THIS_FILE);
119 pins->
pin[pin].store(
nullptr);
143#define lf_alloc_init(A, B, C) lf_alloc_init2(A, B, C, NULL, NULL)
165#define LF_HASH_UNIQUE 1
166#define MY_LF_ERRPTR ((void *)(intptr)1)
209#define lf_hash_init(A, B, C, D, E, F, G) \
210 lf_hash_init2(A, B, C, D, E, F, G, NULL, NULL, NULL, NULL)
static mysql_service_status_t init()
Component initialization.
Definition: audit_api_message_emit.cc:570
static int flags[50]
Definition: hp_test1.cc:39
static uint16 key1[1001]
Definition: hp_test2.cc:46
void lf_hash_init_func(uchar *dst, const uchar *src)
Definition: lf.h:163
void lf_allocator_func(uchar *)
Definition: lf.h:132
uint lf_hash_func(const LF_HASH *, const uchar *, size_t)
Definition: lf.h:160
static void lf_unpin(LF_PINS *pins, int pin)
Definition: lf.h:115
static void lf_alloc_direct_free(LF_ALLOCATOR *allocator, void *addr)
Definition: lf.h:149
static void lf_pin(LF_PINS *pins, int pin, void *addr)
Definition: lf.h:108
void lf_alloc_destroy(LF_ALLOCATOR *allocator)
Definition: lf_alloc-pin.cc:418
int lf_dynarray_iterate(LF_DYNARRAY *array, lf_dynarray_func func, void *arg)
Definition: lf_dynarray.cc:226
#define LF_PINBOX_PINS
Definition: lf.h:69
void lf_pinbox_put_pins(LF_PINS *pins)
Definition: lf_alloc-pin.cc:218
void lf_pinbox_free_func(void *, void *, void *)
Definition: lf.h:72
void lf_pinbox_destroy(LF_PINBOX *pinbox)
Definition: lf_alloc-pin.cc:151
LF_PINS * lf_pinbox_get_pins(LF_PINBOX *pinbox)
Definition: lf_alloc-pin.cc:165
void * lf_hash_search(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
Find hash element corresponding to the key.
Definition: lf_hash.cc:683
const uchar *(* hash_get_key_function)(const uchar *arg, size_t *length)
Callback for extracting key and key length from user data in a LF_HASH.
Definition: lf.h:182
int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen)
Definition: lf_hash.cc:629
void lf_pinbox_free(LF_PINS *pins, void *addr)
Definition: lf_alloc-pin.cc:272
static void lf_hash_search_unpin(LF_PINS *pins)
Definition: lf.h:235
void lf_hash_init3(LF_HASH *hash, uint element_size, uint flags, hash_get_key_function get_key, lf_hash_func *hash_function, lf_cmp_func *cmp_function, lf_allocator_func *ctor, lf_allocator_func *dtor, lf_hash_init_func *init)
Definition: lf_hash.cc:532
void lf_alloc_init2(LF_ALLOCATOR *allocator, uint size, uint free_ptr_offset, lf_allocator_func *ctor, lf_allocator_func *dtor)
Initialize lock-free allocator.
Definition: lf_alloc-pin.cc:396
void lf_hash_destroy(LF_HASH *hash)
Definition: lf_hash.cc:540
int lf_hash_insert(LF_HASH *hash, LF_PINS *pins, const void *data)
Definition: lf_hash.cc:575
static LF_PINS * lf_hash_get_pins(LF_HASH *hash)
Definition: lf.h:229
void lf_dynarray_destroy(LF_DYNARRAY *array)
Definition: lf_dynarray.cc:85
int lf_cmp_func(const uchar *key1, size_t key1_length, const uchar *key2, size_t key2_length)
Definition: lf.h:161
void lf_hash_init2(LF_HASH *hash, uint element_size, uint flags, uint key_offset, uint key_length, hash_get_key_function get_key, CHARSET_INFO *charset, lf_hash_func *hash_function, lf_allocator_func *ctor, lf_allocator_func *dtor, lf_hash_init_func *init)
Definition: lf_hash.cc:523
void * lf_dynarray_value(LF_DYNARRAY *array, uint idx)
Definition: lf_dynarray.cc:174
#define LF_DYNARRAY_LEVELS
Definition: lf.h:50
static void lf_hash_put_pins(LF_PINS *pins)
Definition: lf.h:233
int(* lf_dynarray_func)(void *, void *)
Definition: lf.h:57
void * lf_alloc_new(LF_PINS *pins)
Definition: lf_alloc-pin.cc:439
uint lf_alloc_pool_count(LF_ALLOCATOR *allocator)
Definition: lf_alloc-pin.cc:475
void lf_dynarray_init(LF_DYNARRAY *array, uint element_size)
Definition: lf_dynarray.cc:64
void lf_pinbox_init(LF_PINBOX *pinbox, uint free_ptr_offset, lf_pinbox_free_func *free_func, void *free_func_arg)
Definition: lf_alloc-pin.cc:139
MYSQL_PLUGIN_IMPORT const int LF_HASH_OVERHEAD
Definition: lf_hash.cc:70
void * lf_dynarray_lvalue(LF_DYNARRAY *array, uint idx)
Definition: lf_dynarray.cc:114
void * lf_hash_random_match(LF_HASH *hash, LF_PINS *pins, lf_hash_match_func *match, uint rand_val, void *match_arg)
Find random hash element which satisfies condition specified by match function.
Definition: lf_hash.cc:735
int lf_hash_match_func(const uchar *el, void *arg)
Definition: lf.h:237
static uint key_length
Definition: mi_test1.cc:42
static uchar key2[100]
Definition: mi_test2.cc:58
Some integer typedefs for easier portability.
unsigned char uchar
Definition: my_inttypes.h:51
uint32_t uint32
Definition: my_inttypes.h:66
void my_free(void *ptr)
Frees the memory pointed by the ptr.
Definition: my_memory.cc:80
#define MYSQL_PLUGIN_IMPORT
Definition: my_sharedlib.h:70
Instrumentation helpers for statements.
const std::string charset("charset")
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:75
required string key
Definition: replication_asynchronous_connection_failover.proto:59
Our own string classes, used pervasively throughout the executor.
Definition: m_ctype.h:382
lf_allocator_func * destructor
Definition: lf.h:140
uint element_size
Definition: lf.h:137
std::atomic< uint32 > mallocs
Definition: lf.h:138
lf_allocator_func * constructor
Definition: lf.h:139
LF_PINBOX pinbox
Definition: lf.h:135
std::atomic< uchar * > top
Definition: lf.h:136
uint size_of_element
Definition: lf.h:54
std::atomic< void * > level[LF_DYNARRAY_LEVELS]
Definition: lf.h:53
CHARSET_INFO * charset
Definition: lf.h:188
uint element_size
Definition: lf.h:192
std::atomic< int32 > size
Definition: lf.h:194
hash_get_key_function get_key
Definition: lf.h:187
lf_hash_init_func * initialize
"Initialize" hook - called to finish initialization of object provided by LF_ALLOCATOR (which is poin...
Definition: lf.h:206
lf_hash_func * hash_function
Definition: lf.h:189
uint key_length
Definition: lf.h:191
LF_DYNARRAY array
Definition: lf.h:185
uint key_offset
Definition: lf.h:191
uint flags
Definition: lf.h:193
std::atomic< int32 > count
Definition: lf.h:195
LF_ALLOCATOR alloc
Definition: lf.h:186
lf_cmp_func * cmp_function
Definition: lf.h:190
lf_pinbox_free_func * free_func
Definition: lf.h:76
LF_DYNARRAY pinarray
Definition: lf.h:75
void * free_func_arg
Definition: lf.h:77
uint free_ptr_offset
Definition: lf.h:78
std::atomic< uint32 > pins_in_array
Definition: lf.h:80
std::atomic< uint32 > pinstack_top_ver
Definition: lf.h:79
char pad[64 - sizeof(uint32) *2 - sizeof(void *) *(LF_PINBOX_PINS+2)]
Definition: lf.h:91
uint32 purgatory_count
Definition: lf.h:87
LF_PINBOX * pinbox
Definition: lf.h:85
std::atomic< void * > pin[LF_PINBOX_PINS]
Definition: lf.h:84
void * purgatory
Definition: lf.h:86
std::atomic< uint32 > link
Definition: lf.h:88
unsigned int uint
Definition: uca-dump.cc:29