On Wed, 23 Oct 2019 at 18:06, Richard Henderson
<richard.hender...@linaro.org> wrote:
>
> Using a variable that is declared "const" for this tells the
> compiler that it may read the value once and assume that it
> does not change across function calls.
>
> For target_page_size, this means we have only one assert per
> function, and one read of the variable.
>
> This reduces the size of qemu-system-aarch64 by 8k.
>
> Reviewed-by: Paolo Bonzini <pbonz...@redhat.com>
> Signed-off-by: Richard Henderson <richard.hender...@linaro.org>


> + * We want to declare the "target_page" variable as const, which tells
> + * the compiler that it can cache any value that it reads across calls.
> + * This avoids multiple assertions and multiple reads within any one user.
> + *
> + * This works because we initialize the target_page data very early, in a
> + * location far removed from the functions that require the final results.

I have to say that this feels like a worryingly large amount
of magic. Is this actually guaranteed to work by the compiler?

thanks
-- PMM

Reply via email to