From 6e4c3407802dd0f54aa5842ace8b4110a1917451 Mon Sep 17 00:00:00 2001 From: Pragyansh Chaturvedi Date: Thu, 2 Oct 2025 22:07:28 +0530 Subject: [PATCH] Allow non-call convention for maps --- pythonbpf/functions_pass.py | 19 +++++++++++++++++-- pythonbpf/maps/maps_pass.py | 1 + 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/pythonbpf/functions_pass.py b/pythonbpf/functions_pass.py index fc3ddc3..05d0e90 100644 --- a/pythonbpf/functions_pass.py +++ b/pythonbpf/functions_pass.py @@ -192,8 +192,23 @@ def handle_assign( elif isinstance(rval.func, ast.Attribute): print(f"Assignment call attribute: {ast.dump(rval.func)}") if isinstance(rval.func.value, ast.Name): - # TODO: probably a struct access - print(f"TODO STRUCT ACCESS {ast.dump(rval)}") + if rval.func.value.id in map_sym_tab: + map_name = rval.func.value.id + method_name = rval.func.attr + if HelperHandlerRegistry.has_handler(method_name): + val = handle_helper_call( + rval, + module, + builder, + func, + local_sym_tab, + map_sym_tab, + structs_sym_tab, + ) + builder.store(val[0], local_sym_tab[var_name].var) + else: + # TODO: probably a struct access + print(f"TODO STRUCT ACCESS {ast.dump(rval)}") elif isinstance(rval.func.value, ast.Call) and isinstance( rval.func.value.func, ast.Name ): diff --git a/pythonbpf/maps/maps_pass.py b/pythonbpf/maps/maps_pass.py index 693655f..e7dd174 100644 --- a/pythonbpf/maps/maps_pass.py +++ b/pythonbpf/maps/maps_pass.py @@ -274,6 +274,7 @@ def process_bpf_map(func_node, module): rval = return_stmt.value if isinstance(rval, ast.Call) and isinstance(rval.func, ast.Name): + print(f"we're lit, {ast.dump(rval)}") handler = MapProcessorRegistry.get_processor(rval.func.id) if handler: return handler(map_name, rval, module)