mirror of
https://github.com/Ed94/metadesk.git
synced 2026-07-21 13:55:44 +00:00
prepping to collapse Arena receiving functions to those that receive AllocatorInfo
perf impact of the indirection should be minimal, reduces code duplication. Ideally we'd use gencpp to just have the user specify what they want, then modify which proc is avail by doing the refactors required for using either However, it can't process execution bodies yet or expressions so thats not possible. The other way is to just utilize _Generic to generalize the codepath so that it collapses neater but that leads to a ton of implementation getting lifted to preprocessing... so no.
This commit is contained in:
@@ -39,6 +39,14 @@ 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__)
|
||||
|
||||
inline TempArena
|
||||
scratch__begin_alloc(AllocatorInfo ainfo) {
|
||||
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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user