Re: [PATCH 16/43] Simplify dwarf_expr_context class interface

Simon Marchi via Gdb-patches
2021-04-29T15:49:30Z

On 2021-04-28 9:15 a.m., Zoran Zaric wrote:
>
>>>   /* Create a new context for the expression evaluator.  */
>>>
>>> -dwarf_expr_context::dwarf_expr_context (dwarf2_per_objfile *per_objfile)
>>> -: per_objfile (per_objfile)
>>> +dwarf_expr_context::dwarf_expr_context (dwarf2_per_objfile *per_objfile,
>>> +                                     int addr_size)
>>> +: gdbarch (per_objfile->objfile->arch ()),
>>
>> If gdbarch is always obtained from the objfile, we could maybe avoid
>> storing it.
>
> Sure, but it is used so many times (often as a few times per operation) so we currently cut off two indirection per each use.
>
> I think having one pointer as a class member that cuts through all that is worth it.
But there's no need to store it in a member of the class AFAIK, it
could be fetched once at the top of the "evaluate" method.

Simon