[master] RFR: OMWorld: ObjectMonitor:enter [v2]

Axel Boldt-Christmas aboldtch at openjdk.org
Mon Apr 22 13:33:01 UTC 2024


> 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.

Axel Boldt-Christmas has updated the pull request incrementally with one additional commit since the last revision:

  Fix missed lock change

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

Changes:
  - all: https://git.openjdk.org/lilliput/pull/159/files
  - new: https://git.openjdk.org/lilliput/pull/159/files/6a26947a..24ed7d73

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=lilliput&pr=159&range=01
 - incr: https://webrevs.openjdk.org/?repo=lilliput&pr=159&range=00-01

  Stats: 6 lines in 1 file changed: 4 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/lilliput/pull/159.diff
  Fetch: git fetch https://git.openjdk.org/lilliput.git pull/159/head:pull/159

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


More information about the lilliput-dev mailing list