progress on collaping arena->allocator info code paths (did some generic selection changes)

Going to offload prefix naming to the c11.refactor and cpp17.refactor
This commit is contained in:
2025-02-09 19:14:33 -05:00
parent dc9743b003
commit 546c50885f
23 changed files with 403 additions and 290 deletions
+18 -4
View File
@@ -39,16 +39,30 @@ void tctx_write_srcloc(char* file_name, U64 line_number);
void tctx_read_srcloc (char** file_name, U64* line_number);
#define tctx_write_this_srcloc() tctx_write_srcloc(__FILE__, __LINE__)
typedef struct { U64 count; } Opt_ScratchBegin;
inline TempArena
scratch__begin_alloc(AllocatorInfo ainfo) {
scratch_begin__ainfo(AllocatorInfo ainfo, Opt_ScratchBegin opt) {
Arena* arena = extract_arena(ainfo);
TempArena scratch = temp_begin(tctx_get_scratch(&arena, arena != nullptr));
return scratch;
}
#define scratch_begin_alloc(ainfo) scratch__begin_alloc(ainfo)
#define scratch_begin(conflicts, count) temp_begin(tctx_get_scratch((conflicts), (count)))
#define scratch_end(scratch) temp_end(scratch)
inline TempArena
scratch_begin__arena(Arena** arena, Opt_ScratchBegin opt) {
TempArena scratch = temp_begin(tctx_get_scratch(arena, opt.count));
return scratch;
}
#define scratch_begin(conflicts, ...) \
_Generic(conflicts, \
int : scratch_begin__arena, \
Arena** : scratch_begin__arena, \
AllocatorInfo: scratch_begin__ainfo, \
default : assert_generic_selection_fail \
) resolved_function_call(conflicts, (Opt_ScratchBegin){__VA_ARGS__})
#define scratch_end(scratch) temp_end(scratch)
inline void
tctx_set_thread_name(String8 string){