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

Zoran Zaric via Gdb-patches
2021-04-29T15:56:04Z

On 4/29/21 4:49 PM, Simon Marchi wrote:
> [CAUTION: External Email]
>
> 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
>

Well it is used by other methods as well, but maybe those are not called
too many times so I could grab it on top of each one.

I don't mind doing that way really.

Zoran