On Mon, 26 Feb 2024 13:24:05 GMT, Emanuel Peter <epe...@openjdk.org> wrote:

>> To avoid invariant initializations to happen within the loop, compiler will 
>> unroll this small loop and will forward the initializations, if it does not 
>> then we can save redundant allocation within loop.
>
> At the risk of becoming too nit-picky: which allocations are you talking 
> about? Given you only have a single src and a single dst for this label/jump. 
> So you won't use `_patch_overflow`. And therefore, all allocations are on the 
> stack. The way you do it now, it seems you would allocate 4x the stack memory 
> here, compared to doing it locally in the loop, where the stack space could 
> potentially be reused between the iterations.
> It seems to me this is an optimization at the cost of code-style. Having them 
> local makes it more clear that you are only jumping inside a iteration, and 
> not between iterations.

I could not find any other case with the same pattern, of initializing a list 
of Labels.

On the other hand, I can find cases where we already do what I am saying:
`C2_MacroAssembler::rtm_counters_update`

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16354#discussion_r1502617942

Reply via email to