mirror of
https://github.com/varun-r-mallya/Python-BPF.git
synced 2026-12-06 09:58:34 +00:00
return p and p + 1 on a map lookup worked, because they go through get_typed_operand, which loads through the pointer with a null check. r.val = p, x = p into an integer local, and c_int64(p) (so also return c_int64(p)) did not: those three sites call eval_expr directly and handed the pointer to the integer path, failing with i64* vs i64. deref_to_value is get_typed_operand's pointer fallback as a helper, used by it and by the three sites, only when the destination is an integer: a pointer slot still aliases (q = p), and an opaque pointer, which names no pointee, is left alone. The descriptor takes the map's declared value ctype, as the operand path does. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
32 lines
825 B
Python
32 lines
825 B
Python
from .expr_pass import eval_expr, handle_expr, get_typed_operand, deref_to_value
|
|
from .type_normalization import (
|
|
convert_to_bool,
|
|
get_base_type_and_depth,
|
|
convert,
|
|
canonicalise,
|
|
to_promoted,
|
|
)
|
|
from .operators import usual_arithmetic_conversions
|
|
from .ir_ops import deref_to_depth, access_struct_field
|
|
from .operators import apply_binop
|
|
from .call_registry import CallHandlerRegistry
|
|
from .vmlinux_registry import VmlinuxHandlerRegistry
|
|
|
|
__all__ = [
|
|
"eval_expr",
|
|
"handle_expr",
|
|
"convert_to_bool",
|
|
"convert",
|
|
"canonicalise",
|
|
"to_promoted",
|
|
"get_typed_operand",
|
|
"deref_to_value",
|
|
"usual_arithmetic_conversions",
|
|
"get_base_type_and_depth",
|
|
"deref_to_depth",
|
|
"apply_binop",
|
|
"access_struct_field",
|
|
"CallHandlerRegistry",
|
|
"VmlinuxHandlerRegistry",
|
|
]
|