From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Helge Deller <deller@kernel.org>,
Richard Henderson <richard.henderson@linaro.org>,
Laurent Vivier <laurent@vivier.eu>,
qemu-devel@nongnu.org
Subject: Re: [PATCH v2] target/hppa: Speed up hppa_is_pa20()
Date: Sun, 29 Dec 2024 18:24:01 +0100 [thread overview]
Message-ID: <e491caff-6b3b-4e59-955c-cccd2a7f6510@linaro.org> (raw)
In-Reply-To: <Z3BouGUFFP87PJyx@p100>
On 28/12/24 22:08, Helge Deller wrote:
> Although the hppa_is_pa20() helper is costly due to string comparisms in
"comparisms" -> "comparison"?
> object_dynamic_cast(), it is called quite often during memory lookups
> and at each start of a block of instruction translations.
> Speed hppa_is_pa20() up by calling object_dynamic_cast() only once at
> CPU creation and store the result in the is_pa20 of struct CPUArchState.
>
> Signed-off-by: Helge Deller <deller@gmx.de>
>
> v2:
> - moved init to hppa_cpu_initfn() and is_pa20 to end of CPUArchState struct
> (feedback by Richard)
>
> diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
> index b908cf65c6..05de952a87 100644
> --- a/target/hppa/cpu.c
> +++ b/target/hppa/cpu.c
> @@ -199,6 +199,7 @@ static void hppa_cpu_initfn(Object *obj)
> CPUHPPAState *env = &cpu->env;
>
> cs->exception_index = -1;
> + env->is_pa20 = object_dynamic_cast(obj, TYPE_HPPA64_CPU);
Personally I find explicit casts to boolean clearer:
env->is_pa20 = !!object_dynamic_cast(obj, TYPE_HPPA64_CPU);
> cpu_hppa_loaded_fr0(env);
> cpu_hppa_put_psw(env, PSW_W);
> }
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
prev parent reply other threads:[~2024-12-29 17:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-28 21:08 [PATCH v2] target/hppa: Speed up hppa_is_pa20() Helge Deller
2024-12-28 22:54 ` Richard Henderson
2024-12-29 17:24 ` Philippe Mathieu-Daudé [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e491caff-6b3b-4e59-955c-cccd2a7f6510@linaro.org \
--to=philmd@linaro.org \
--cc=deller@kernel.org \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.