Infrastructure and build updates
- Update build configuration and flags - Add missing header files and dependencies - Update TLS list implementation with proper scoping - Fix various compilation warnings and issues - Update debug ring and tiny allocation infrastructure - Update benchmark results documentation Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
@ -53,17 +53,19 @@ void bg_spill_drain_class(int class_idx, pthread_mutex_t* lock) {
|
||||
#endif
|
||||
while (cur && processed < g_bg_spill_max_batch) {
|
||||
prev = cur;
|
||||
cur = *(void**)((uint8_t*)cur + next_off);
|
||||
#include "tiny_nextptr.h"
|
||||
cur = tiny_next_load(cur, class_idx);
|
||||
processed++;
|
||||
}
|
||||
if (cur != NULL) { rest = cur; *(void**)((uint8_t*)prev + next_off) = NULL; }
|
||||
if (cur != NULL) { rest = cur; tiny_next_store(prev, class_idx, NULL); }
|
||||
|
||||
// Return processed nodes to SS freelists
|
||||
pthread_mutex_lock(lock);
|
||||
uint32_t self_tid = tiny_self_u32_guard();
|
||||
void* node = (void*)chain;
|
||||
while (node) {
|
||||
void* next = *(void**)((uint8_t*)node + next_off);
|
||||
#include "tiny_nextptr.h"
|
||||
void* next = tiny_next_load(node, class_idx);
|
||||
SuperSlab* owner_ss = hak_super_lookup(node);
|
||||
if (owner_ss && owner_ss->magic == SUPERSLAB_MAGIC) {
|
||||
int slab_idx = slab_index_for(owner_ss, node);
|
||||
@ -94,10 +96,10 @@ void bg_spill_drain_class(int class_idx, pthread_mutex_t* lock) {
|
||||
// Prepend remainder back to head
|
||||
uintptr_t old_head;
|
||||
void* tail = rest;
|
||||
while (*(void**)((uint8_t*)tail + next_off)) tail = *(void**)((uint8_t*)tail + next_off);
|
||||
while (tiny_next_load(tail, class_idx)) tail = tiny_next_load(tail, class_idx);
|
||||
do {
|
||||
old_head = atomic_load_explicit(&g_bg_spill_head[class_idx], memory_order_acquire);
|
||||
*(void**)((uint8_t*)tail + next_off) = (void*)old_head;
|
||||
tiny_next_store(tail, class_idx, (void*)old_head);
|
||||
} while (!atomic_compare_exchange_weak_explicit(&g_bg_spill_head[class_idx], &old_head,
|
||||
(uintptr_t)rest,
|
||||
memory_order_release, memory_order_relaxed));
|
||||
|
||||
Reference in New Issue
Block a user