RFR: 8291555: Replace stack-locking with fast-locking

John R Rose jrose at openjdk.org
Mon Nov 14 23:03:01 UTC 2022


On Fri, 28 Oct 2022 01:47:23 GMT, David Holmes <dholmes at openjdk.org> wrote:

> So the data structure for lock records (per thread) could consist of a series of distinct values [ A B C ] and each of the values could be repeated, but only adjacently: [ A A A B C C ] for example.
> @rose00 why only adjacently? Nested locking can be interleaved on different monitors.

Yes it can; you can have nesting A, B, A.  But the thread-based fast-locking list might not cover that case.  If it were restricted to only adjacent records in the way I sketched, it would need to use a different, slower technique for the A, B, A case.  The trade-off is that if you only allow adjacent recursive locks on the list, you don't need to search the list beyond the first element, to detect re-locking.  Dunno if that pencils out to a real advantage, though, since the fallback is slow.

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

PR: https://git.openjdk.org/jdk/pull/10590


More information about the hotspot-dev mailing list