mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2026-12-06 01:48:35 +00:00
Core: Review nits on the signedness branch
- A global's descriptor is built from the loaded value, not from None. - get_operand_value, the [0] wrapper over get_typed_operand, had no callers left; removed with its export. - infer_int_type's map branch names the map's declared value type for what it is (value_ctype), says that the key argument plays no part, and applies only to lookup: update and delete return a status, not a value of the map's type. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@ -237,7 +237,8 @@ def get_typed_operand(func, compilation_context, operand, builder, local_sym_tab
|
||||
)
|
||||
elif operand.id in compilation_context.bpf_globals:
|
||||
sym = compilation_context.bpf_globals[operand.id]
|
||||
return builder.load(sym.var), _descriptor(None, sym.ir_type)
|
||||
val = builder.load(sym.var)
|
||||
return val, _descriptor(val, sym.ir_type)
|
||||
else:
|
||||
vmlinux_result = VmlinuxHandlerRegistry.handle_name(operand.id)
|
||||
if vmlinux_result is not None:
|
||||
@ -265,13 +266,6 @@ def get_typed_operand(func, compilation_context, operand, builder, local_sym_tab
|
||||
raise TypeError(f"Unsupported operand type: {type(operand)}")
|
||||
|
||||
|
||||
def get_operand_value(func, compilation_context, operand, builder, local_sym_tab):
|
||||
"""Extract the value from an operand, handling variables and constants."""
|
||||
return get_typed_operand(
|
||||
func, compilation_context, operand, builder, local_sym_tab
|
||||
)[0]
|
||||
|
||||
|
||||
def _handle_binary_op_impl(func, compilation_context, rval, builder, local_sym_tab):
|
||||
"""A binary operation, typed per node the way C types it: the operation is
|
||||
performed in the type given by the usual arithmetic conversions of its two
|
||||
|
||||
Reference in New Issue
Block a user