[master] Integrated: OMWorld: ObjectMonitor:enter

Axel Boldt-Christmas aboldtch at openjdk.org
Tue Apr 23 11:54:40 UTC 2024


On Mon, 22 Apr 2024 12:44:38 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:

> This restructures `ObjectMonitor:enter` to fit better with the `LightweightSynchronizer`. Some parts of this could be upstreamed separately. 
> 
> This effectively splits up `ObjectMonitor::enter` into three parts. Which LightweightSynchronizer can weave into its `inflate_and_enter`. 
> 
> ```c++
> bool ObjectMonitor::enter(JavaThread* current) {
>   // 1. Spinning without blocking out deflation
>   if (spin_enter(current)) {
>     return true;
>   }
> 
>   // 2. Try to block deflation
>   ObjectMonitorContentionMark contention_mark(this);
>   if (enter_is_async_deflating()) {
>     return false;
>   }
> 
>   // 3. Enter while blocking out deflation
>   enter_with_contention_mark(current, contention_mark);
>   return true;
> }
> 
> 
> It may be worth the effort to document these new methods, and also add better documentation to `inflate_and_enter` which describes the invariants and how `ObjectMonitorContentionMark`, markWord transitions and ObjectMonitor::_owner field (on newly inserted monitors) plays together to guarantee correctness and works. 
> 
> This commit is currently based on ffc4c2fd5ba1c28432a5d5e84b8ada95fba7eeb8 without a merge. So GHA is not tested with lilliput. As long as this is mergable without conflicts (and no manual merge is performed) it will also be possible to move this commit down below lilliput on-top of OMWorld directly.

This pull request has now been integrated.

Changeset: 44f1b602
Author:    Axel Boldt-Christmas <aboldtch at openjdk.org>
URL:       https://git.openjdk.org/lilliput/commit/44f1b602e4750f3ad3ec137b0eadbfb7a4d88e24
Stats:     292 lines in 6 files changed: 141 ins; 73 del; 78 mod

OMWorld: ObjectMonitor:enter

Reviewed-by: rkennke

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

PR: https://git.openjdk.org/lilliput/pull/159


More information about the lilliput-dev mailing list