From 36c9dd221a25dc741e6f5844ff7cdc87f6f6c946 Mon Sep 17 00:00:00 2001 From: WormHeamer Date: Sun, 31 Aug 2025 01:42:04 -0400 Subject: thoughts about arenas --- proc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/proc.c b/proc.c index ff1197f..0877a91 100644 --- a/proc.c +++ b/proc.c @@ -3,6 +3,20 @@ /* procedures */ +/* the tangle of arenas here will need to be sorted out eventually: currently + * we have two arenas for every single procedure, a permanent one lasting the + * full length of compilation, and a scratch arena reset after every statement. + * so, long-lasting node data and very temporary allocations. + * + * this works fine when there's just one procedure, but long-term there should + * be a couple arenas per _worker thread_, not per procedure. and for this, + * there's a third kind of data --- stuff that lasts the length of parsing one + * procedure, but no longer; scope information, mainly. + * + * so in the end we might have like + * _Thread_local Arena graph_arena, scratch_arena, parse_arena; + */ + void proc_init(Proc *proc, Str name) { memset(proc, 0, sizeof(Proc)); Graph *g = &proc->graph; -- cgit v1.2.3