Integrated: 8255401: Shenandoah: Allow oldval and newval registers to overlap in cmpxchg_oop()

Roman Kennke rkennke at openjdk.java.net
Mon Nov 2 16:08:56 UTC 2020


On Mon, 26 Oct 2020 20:50:40 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

> We encountered a failure in testing:
> 
> Internal Error (/home/jenkins/workspace/nightly/jdk-jdk/src/hotspot/share/asm/register.hpp:141), pid=15470, tid=15611
> assert(a != b && a != c && a != d && b != c && b != d && c != d) failed: registers must be different: a=0x0000000000000000, b=0x0000000000000000, c=0x000000000000000b, d=0x000000000000000a
> 
> in:
> 
> Stack: [0x00007fb8fa2e3000,0x00007fb8fa3e4000], sp=0x00007fb8fa3deca0, free space=1007k
> Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
> V [libjvm.so+0x156890e] ShenandoahBarrierSetAssembler::cmpxchg_oop(MacroAssembler*, RegisterImpl*, Address, RegisterImpl*, RegisterImpl*, bool, RegisterImpl*, RegisterImpl*)+0xde
> V [libjvm.so+0x3ec1d1] compareAndSwapN_shenandoahNode::emit(CodeBuffer&, PhaseRegAlloc*) const+0x571 
> 
> It seems to appear very rarely.
> 
> The failure is that both newval and oldval are the same register (rax). I believe it is ok for the two registers to overlap:
> - It is not expected that newval is preserved across the cmpxchg
> - The CAS will override newval, but:
>   - The first CAS is unaffected by the overlap
>   - The retry-loop is only entered when previous-value == old-value, and thus newval will still hold the same value
> 
> For aarch64 it matters even less, because newval is never overridden.
> 
> Testing: hotspot_gc_shenandoah (x86 & aarch64).

This pull request has now been integrated.

Changeset: 0e19ded9
Author:    Roman Kennke <rkennke at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/0e19ded9
Stats:     4 lines in 2 files changed: 2 ins; 0 del; 2 mod

8255401: Shenandoah: Allow oldval and newval registers to overlap in cmpxchg_oop()

Reviewed-by: roland

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

PR: https://git.openjdk.java.net/jdk/pull/871


More information about the shenandoah-dev mailing list