Skip to content

Commit 05660d4

Browse files
r41k0uclaude
andcommitted
Core: The pool-duplication TODO after #104: free with opt, 8 bytes without
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent 5e5c14e commit 05660d4

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

‎pythonbpf/functions/functions_pass.py‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,10 @@ def update_max_temps_for_stmt(stmt):
150150
# TODO: allocate_mem is re-entered for every if body (handle_if_allocation),
151151
# and each level allocates a pool of its own even though the top-level count
152152
# already covers nested statements. Only the last-allocated pool stays in
153-
# local_sym_tab; the others are unreferenced, but llc does not delete
154-
# unreferenced allocas before frame layout (opt -O2 would, and the pipeline
155-
# is llc only), so each duplicated temp slot costs its size in BPF stack:
156-
# measured 8 bytes per i64 temp per nesting level. Fix: count recursively,
157-
# allocate once at the top level.
153+
# local_sym_tab; the others are unreferenced. The opt -O2 step (#104)
154+
# deletes them, so with opt on PATH this costs nothing; on the no-opt
155+
# fallback llc keeps them through frame layout, measured 8 bytes per i64
156+
# temp per nesting level. Fix: count recursively, allocate once at the top.
158157
allocate_temp_pool(builder, max_temps_needed, local_sym_tab)
159158

160159
return local_sym_tab

0 commit comments

Comments
 (0)