RFR: 8315884: New Object to ObjectMonitor mapping [v9]

Axel Boldt-Christmas aboldtch at openjdk.org
Mon Aug 12 14:41:23 UTC 2024


On Tue, 23 Jul 2024 13:20:27 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> src/hotspot/share/runtime/lightweightSynchronizer.cpp line 77:
>> 
>>> 75:   using ConcurrentTable = ConcurrentHashTable<Config, MEMFLAGS::mtObjectMonitor>;
>>> 76: 
>>> 77:   ConcurrentTable* _table;
>> 
>> So you have a class ObjectMonitorWorld, which references the ConcurrentTable, which, internally also has its actual table. This is 3 dereferences to get to the actual table, if I counted correctly. I'd try to eliminate the outermost ObjectMonitorWorld class, or at least make it a global flat structure instead of a reference to a heap-allocated object. I think, because this is a structure that is global and would exist throughout the lifetime of the Java program anyway, it might be worth figuring out how to do the actual ConcurrentHashTable flat in the global structure, too.
>
> This is a really good suggestion and might help a lot with the performance problems that we see with the table with heavily contended locking.  I think we should change this in a follow-on patch (which I'll work on).

I inlined the table in the surrounding object as it is a trivial change. 

Removing both indirections and creating static storage I would require more work (some conditional deferred creation, similar to an optional).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20067#discussion_r1713909990


More information about the core-libs-dev mailing list