RFR: 8373595: A new ObjectMonitorTable implementation
Martin Doerr
mdoerr at openjdk.org
Wed Feb 4 16:26:13 UTC 2026
On Wed, 4 Feb 2026 14:49:28 GMT, Fredrik Bredberg <fbredberg at openjdk.org> wrote:
> Thank you for the reviews. I might not have done exactly as you suggested, but I have tried to incorporate them one way or the other.
That's fine. Thanks a lot for overworking it!
> **First:** Thank you for pointing out that the comparison with `below_is_special` should be unsigned. That problem also lured its way into the AArch64 port. I'll be more careful not mixing up "Lower" with "Less Than" in the future, promise!
>
> **Second:** I liked the optimization idea for the om_cache loop, so I adopted it for all platforms.
>
Nice!
> **Third:** The registers for mark and monitor are the same (unfortunately), so I need to take a copy of the mark word before the om_cache code. This is because I speculatively set the monitor value in the om_cache code, and thereby overwrites the mark value.
Good catch! Alternatively, you could move the hash code extraction up like this:
diff --git a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
index 819599126b2..72ca5caa1c1 100644
--- a/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
+++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
@@ -2760,8 +2760,8 @@ void MacroAssembler::compiler_fast_lock_object(ConditionRegister flag, Register
const Register tmp2_hash = tmp2;
Label monitor_found;
- // Save the mark, we might need it to extract the hash.
- mr(tmp2_hash, mark);
+ // Get the hash code here, because mark will be killed.
+ srdi(tmp2_hash, mark, markWord::hash_shift);
// Look for the monitor in the om_cache.
@@ -2778,9 +2778,6 @@ void MacroAssembler::compiler_fast_lock_object(ConditionRegister flag, Register
// Look for the monitor in the table.
- // Get the hash code.
- srdi(tmp2_hash, tmp2_hash, markWord::hash_shift);
-
// Get the table and calculate the bucket's address
int simm16_rest = load_const_optimized(tmp3, ObjectMonitorTable::current_table_address(), R0, true);
ld_ptr(tmp3, simm16_rest, tmp3);
-------------
PR Comment: https://git.openjdk.org/jdk/pull/29383#issuecomment-3848424901
More information about the shenandoah-dev
mailing list