RFR: 8373595: A new ObjectMonitorTable implementation [v2]
Fredrik Bredberg
fbredberg at openjdk.org
Mon Feb 16 16:26:01 UTC 2026
On Sat, 7 Feb 2026 04:04:33 GMT, Fei Yang <fyang at openjdk.org> wrote:
>> Fredrik Bredberg has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Updated all platforms after review comments
>
> src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp line 480:
>
>> 478: __ beqz(obj, done);
>> 479:
>> 480: assert(obj != tmp, "need tmp");
>
> Seems better if we move this `assert` to entry of this assembler routine and replace it with: `assert_different_registers(obj, tmp);`. Also `ZBarrierSetAssembler::try_resolve_weak_handle_in_c2` could be improved. So I am suggesting following add-on changes:
>
>
> diff --git a/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp b/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp
> index fcb5fa512ec..8d530d15ee5 100644
> --- a/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp
> +++ b/src/hotspot/cpu/riscv/gc/shenandoah/shenandoahBarrierSetAssembler_riscv.cpp
> @@ -465,6 +465,8 @@ void ShenandoahBarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler
> #ifdef COMPILER2
> void ShenandoahBarrierSetAssembler::try_resolve_weak_handle_in_c2(MacroAssembler *masm, Register obj,
> Register tmp, Label& slow_path) {
> + assert_different_registers(obj, tmp);
> +
> Label done;
>
> // Resolve weak handle using the standard implementation.
> @@ -473,7 +475,6 @@ void ShenandoahBarrierSetAssembler::try_resolve_weak_handle_in_c2(MacroAssembler
> // Check if the reference is null, and if it is, take the fast path.
> __ beqz(obj, done);
>
> - assert(obj != tmp, "need tmp");
> Address gc_state(xthread, ShenandoahThreadLocalData::gc_state_offset());
> __ lbu(tmp, gc_state);
>
> diff --git a/src/hotspot/cpu/riscv/gc/z/zBarrierSetAssembler_riscv.cpp b/src/hotspot/cpu/riscv/gc/z/zBarrierSetAssembler_riscv.cpp
> index f2453af19d7..163271a2f11 100644
> --- a/src/hotspot/cpu/riscv/gc/z/zBarrierSetAssembler_riscv.cpp
> +++ b/src/hotspot/cpu/riscv/gc/z/zBarrierSetAssembler_riscv.cpp
> @@ -610,7 +610,9 @@ void ZBarrierSetAssembler::try_resolve_weak_handle_in_c2(MacroAssembler* masm, R
> BarrierSetAssembler::try_resolve_weak_handle_in_c2(masm, obj, tmp, slow_path);
>
> // Check if the oop is bad, in which case we need to take the slow path.
> - __ ld(tmp, mark_bad_mask_from_thread(xthread));
> + __ relocate(barrier_Relocation::spec(), [&] {
> + __ li16u(tmp, barrier_Relocation::unpatched);
> + }, ZBarrierRelocationFormatMarkBadMask);
> __ andr(tmp, obj, tmp);
> __ bnez(tmp, slow_path);
Fixed
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29383#discussion_r2813206165
More information about the shenandoah-dev
mailing list