summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authorWormHeamer2025-08-31 01:42:04 -0400
committerWormHeamer2025-08-31 01:42:04 -0400
commit36c9dd221a25dc741e6f5844ff7cdc87f6f6c946 (patch)
tree3cefaffb61e4bb0cbbd11a0d90e42ce51987d67a /proc.c
parentcbca8b454309122632615f0bcb787bc898503df9 (diff)
thoughts about arenas
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c14
1 files changed, 14 insertions, 0 deletions
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;