RFR: 8333236: Test java/foreign/TestAccessModes.java is timing out after passing

Maurizio Cimadamore mcimadamore at openjdk.org
Thu May 30 16:26:40 UTC 2024


On Thu, 30 May 2024 16:15:22 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> This PR restores a var handle cache in `Utils::makeSegmentViewVarHandle`. The cache was moved to `ValueLayouts::varHandle` as part of [pull/19251](https://git.openjdk.org/jdk/pull/19251), on the basis that we want to optimize the common case like:
> 
> 
> ValueLayout layout = ...
> layout.varHandle().get(...)
> 
> 
> And that caching more complex var handles didn't seem to add value, given that, for these var handles, the logic in `LayoutPath` needs to adapt the returned var handle anyways.
> 
> But, `TestAccessModes` revealed a different picture - w/o any cache in `Utils` the test end up allocating 8963 var handle instances (instead of just 4), in each of the 4 runs the test includes. While this is admittedly a stress test, it seems nice to restore the level of sharing we had before [pull/19251](https://git.openjdk.org/jdk/pull/19251).

A different approach could be to find a way to add a per-layout cache. E.g. if the root layout is a group layout, that layout could have a cache for all the different var handles generated from it. The key would be the path element used to retrieve the var handle.

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

PR Comment: https://git.openjdk.org/jdk/pull/19485#issuecomment-2140148973


More information about the core-libs-dev mailing list