Skip to content

PythonBPF: Add Compilation Context to allow parallel compilation of multiple jobs#82

Merged
r41k0u merged 11 commits into
masterfrom
compilation-context
Mar 29, 2026
Merged

PythonBPF: Add Compilation Context to allow parallel compilation of multiple jobs#82
r41k0u merged 11 commits into
masterfrom
compilation-context

Conversation

@r41k0u

@r41k0u r41k0u commented Feb 21, 2026

Copy link
Copy Markdown
Collaborator

Introduces Compilation Context to allow multiple job runs on different threads, and to clean up core implementation - cleaner function signatures

sz = None
if isinstance(arg, ast.Name):
# Stack space is already allocated
ptr = get_var_ptr_from_name(arg.id, local_sym_tab)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary change

val = get_operand_value(
func, module, arg, builder, local_sym_tab, map_sym_tab, struct_sym_tab
)
val = eval_expr(func, compilation_context, builder, arg, local_sym_tab)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looked sus but is probably fine

Comment thread pythonbpf/helper/helper_utils.py Outdated


_temp_pool_manager = ScratchPoolManager() # Singleton instance
# Simple check for name

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't like this, will stick to older implementation but with compilation context. This is somehow incompatible with bpf_helper_handler as well

Comment thread pythonbpf/maps/maps_pass.py Outdated
if handler and handler.is_vmlinux_enum(name):
return handler.get_vmlinux_enum_value(name)

# Fallback to VmlinuxHandlerRegistry if handler invalid

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unnecessary until we port VmlinuxHandlerRegistry to compilation_context

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say even undesirable

Comment thread pythonbpf/allocation_pass.py Outdated
logger.debug(f"Allocated temp variable: {temp_name}")


def _get_alignment(tmp_type):

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unnecessary to change this

Comment thread pythonbpf/allocation_pass.py Outdated


def _allocate_for_attribute(builder, var_name, rval, local_sym_tab, structs_sym_tab):
def _allocate_with_type(builder, var_name, ir_type):

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, unnecessary

@r41k0u r41k0u left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed once. All the things I didn't like have been changed. Will test again and merge.

@r41k0u r41k0u merged commit 0498885 into master Mar 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant