On Fri, 25 Oct 2019 at 21:43, Richard Henderson <richard.hender...@linaro.org> wrote: > > On 10/25/19 10:51 AM, Peter Maydell wrote: > >> + * 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? > > Yes.
I'm curious to know how the compiler engineers define "very early" and "far removed" -- in my experience they usually prefer to be more precise than that :-) thanks -- PMM