On Fri, 7 Aug 2026 14:14:32 GMT, Fredrik Bredberg <[email protected]> wrote:

> The main objectives for this PR are:
>  1) Compact Object Headers needs the Object Monitor Table to work.
>  2) Both Compact Object Headers 
> ([JDK-8360700](https://bugs.openjdk.org/browse/JDK-8360700)) and Object 
> Monitor Table ([JDK-8379782](https://bugs.openjdk.org/browse/JDK-8379782)) 
> are now enabled by default.
>  3) If we always use the Object Monitor Table, we will free up lots of bits 
> in the markword, that could be of use to others (read GC).
>  4) If we don't need to maintain any "monitor pointer in the mark word" code, 
> we will simplify the code base.
> 
> Therefore this PR will remove the `UseObjectMonitorTable` flag and related 
> code.
> 
> Note that this PR only removes the most obvious use of the 
> `UseObjectMonitorTable` in the code base. This is to ease the burden on the 
> reviewers. [JDK-8389938](https://bugs.openjdk.org/browse/JDK-8389938) has 
> been created to finalize the work by removing the less obvious code, like no 
> longer used mark word code in different GCs. 
> 
> The code has passed tier1-7 testing on supported platforms and smoke testing 
> using QEMU on `RISC-V`, `PowerPC` and `s390`.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Looks good.

There are a few nits in the patch, but I would be OK if you addressed those as 
a separate RFE.

src/hotspot/share/gc/shenandoah/shenandoahHeap.inline.hpp line 4:

> 2:  * Copyright (c) 2015, 2020, Red Hat, Inc. All rights reserved.
> 3:  * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
> 4:  * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved.

Shouldn't this be:

Suggestion:

 * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.

src/hotspot/share/runtime/arguments.cpp line 3445:

> 3443: }
> 3444: 
> 3445: void Arguments::set_compact_headers_flags() {

Should this be removed?

src/hotspot/share/runtime/objectMonitor.cpp line 352:

> 350:          ", encoded this=" INTPTR_FORMAT, object()->mark().value(),      
>       \
> 351:          markWord::encode(this).value());
> 352: 

Hmm. Was this assert wrong before. Should it have been 
`assert(!UseObjectMonitorTable || ...`? Would that mean that the assert would 
still be useful?

src/hotspot/share/runtime/objectMonitor.hpp line 158:

> 156: 
> 157:   // Because of frequent access, the metadata field is at offset zero 
> (0).
> 158:   // Enforced by the assert() in metadata_addr() contains the _object's 
> hashCode.

This sentence seems off, or is lacking some punctuation.

src/hotspot/share/runtime/objectMonitor.inline.hpp line 78:

> 76: 
> 77: inline markWord ObjectMonitor::header() const {
> 78:   guarantee(false, "Locking with OM table does not use header");

Like Aleksey's earlier comment: Remove?

src/hotspot/share/runtime/synchronizer.cpp line 687:

> 685:     markWord mark = obj->mark_acquire();
> 686:     // The hash can simply be installed in the object header when
> 687:     // using the Object Monitor Table.

The comment makes it sound like the Object Monitor Table is still optional. 
Maybe completely remove this comment?

src/hotspot/share/runtime/synchronizer.cpp line 2217:

> 2215: 
> 2216: ObjectMonitor* ObjectSynchronizer::read_monitor(oop obj, markWord mark) 
> {
> 2217:   return ObjectSynchronizer::get_monitor_from_table(obj);

The `markWord mark` parameter should probably be removed.

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

Marked as reviewed by stefank (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/32257#pullrequestreview-4886182539
PR Review Comment: https://git.openjdk.org/jdk/pull/32257#discussion_r3738443699
PR Review Comment: https://git.openjdk.org/jdk/pull/32257#discussion_r3738459803
PR Review Comment: https://git.openjdk.org/jdk/pull/32257#discussion_r3738476153
PR Review Comment: https://git.openjdk.org/jdk/pull/32257#discussion_r3738483617
PR Review Comment: https://git.openjdk.org/jdk/pull/32257#discussion_r3738488975
PR Review Comment: https://git.openjdk.org/jdk/pull/32257#discussion_r3738499140
PR Review Comment: https://git.openjdk.org/jdk/pull/32257#discussion_r3738512668

Reply via email to