Re: [PATCH] target/arm: Use cpu_env in cpu_untagged_addr

2024-07-02 Thread Richard Henderson

On 7/2/24 08:58, Alex Bennée wrote:

Richard Henderson  writes:


In a completely artifical memset benchmark object_dynamic_cast_assert
dominates the profile, even above guest address resolution and
the underlying host memset.


We seem to use ARM_CPU() quite liberally for a number of helpers so I
wonder if its worth codifying this anywhere? At least all the direct TCG
op helpers take CPUARMState *env directly.


For things that are akin to virtual method calls, i.e. the function pointer comes from a 
table within the object or class, I think we can trust the lookup.  Therefore no dynamic 
check required on entry to those functions.


That said, cpu_env() is relatively new and we haven't made a concerted effort to use it 
everywhere that it might make sense.



r~



Re: [PATCH] target/arm: Use cpu_env in cpu_untagged_addr

2024-07-02 Thread Alex Bennée
Richard Henderson  writes:

> In a completely artifical memset benchmark object_dynamic_cast_assert
> dominates the profile, even above guest address resolution and
> the underlying host memset.

We seem to use ARM_CPU() quite liberally for a number of helpers so I
wonder if its worth codifying this anywhere? At least all the direct TCG
op helpers take CPUARMState *env directly.

>
> Signed-off-by: Richard Henderson 
> ---
>  target/arm/cpu.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/target/arm/cpu.h b/target/arm/cpu.h
> index d8eb986a04..ccfb9349a3 100644
> --- a/target/arm/cpu.h
> +++ b/target/arm/cpu.h
> @@ -3309,8 +3309,8 @@ extern const uint64_t pred_esz_masks[5];
>   */
>  static inline target_ulong cpu_untagged_addr(CPUState *cs, target_ulong x)
>  {
> -ARMCPU *cpu = ARM_CPU(cs);
> -if (cpu->env.tagged_addr_enable) {
> +CPUARMState *env = cpu_env(cs);
> +if (env->tagged_addr_enable) {
>  /*
>   * TBI is enabled for userspace but not kernelspace addresses.
>   * Only clear the tag if bit 55 is clear.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro



Re: [PATCH] target/arm: Use cpu_env in cpu_untagged_addr

2024-07-02 Thread Philippe Mathieu-Daudé

On 2/7/24 17:49, Richard Henderson wrote:

In a completely artifical memset benchmark object_dynamic_cast_assert
dominates the profile, even above guest address resolution and
the underlying host memset.

Signed-off-by: Richard Henderson 
---
  target/arm/cpu.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé