On Tue, Jan 27, 2026 at 1:07 PM Taylor Simpson <[email protected]> wrote: > > > > On Mon, Jan 26, 2026 at 3:07 PM Marco Liebel <[email protected]> > wrote: >> >> On Sat, Jan 24, 2026 at 5:41 PM Taylor Simpson <[email protected]> >> wrote: >>> >>> This patch would be alot smaller if you kept pkt as-is and added a new >>> member >>> Packet packet; >> >> >> That would reduce the patch size, but it wouldn’t remove the risk of a >> dangling pointer >> and would introduce an alias instead. Is there a specific reason we need to >> keep the >> pointer around? > > > There's a bunch of code throughout target/hexagon where a variable named > "pkt" is a pointer to a packet. If you really want to get rid of the pointer > in DisasContext, do 2 things > > Name the field in DisasContext something else, e.g., packet. > Don't eliminate the local "Packet *pkt" variables in various functions, e.g., > gen_end_tb. > > Then, it will be clear that "packet" is the actual struct and "pkt" is a > pointer.
IMO the types should be enforced by the compiler such that no one could ever confuse the struct and pointers to it. Whereas having a "Packet *" that outlives the DisasContext or whose lifetime relative to the DC's is not always clear - that does set us up for confusion. > > Thanks, > Taylor >
