RFR: 8320649: C2: Optimize scoped values [v4]

Emanuel Peter epeter at openjdk.org
Thu Jan 25 15:59:30 UTC 2024


On Thu, 25 Jan 2024 14:59:52 GMT, Roland Westrelin <roland at openjdk.org> wrote:

> > > In its simplest form, a ScopedValue get will have a test (to check it's indeed in the cache) and a load so I don't think vectorization is possible.
> > 
> > 
> > So you think this could not be predicated and hoisted out of the loop? That would also be a sad limitation 😞
> 
> Even if that was possible, ScopedValue get loads are from the cache indexed by a hash stored as a field in the ScopedValue object. I'm not sure how you would be able to tell which of the loads from several get() calls are contiguous in memory.

A simple example would be to add/multiply it to every element in an array.

Imagine we stream over a container (some array or memory segment). And some "map" method is applied to every element, which adds in the scoped value. If everything is inlined, then this might come to be a loop, where inside the loop we add every element to the `scopedValue.get()`, and we would hope the `get` floats out of the loop completely, so we can broadcast that value, and vectorize the loop.

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

PR Comment: https://git.openjdk.org/jdk/pull/16966#issuecomment-1910493248


More information about the hotspot-compiler-dev mailing list