RFR: 8255401: Shenandoah: Allow oldval and newval registers to overlap in cmpxchg_oop()
Roman Kennke
rkennke at openjdk.java.net
Mon Oct 26 20:58:25 UTC 2020
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).
-------------
Commit messages:
- 8255401: Shenandoah: Allow oldval and newval registers to overlap in cmpxchg_oop()
Changes: https://git.openjdk.java.net/jdk/pull/871/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=871&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8255401
Stats: 4 lines in 2 files changed: 2 ins; 0 del; 2 mod
Patch: https://git.openjdk.java.net/jdk/pull/871.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/871/head:pull/871
PR: https://git.openjdk.java.net/jdk/pull/871
More information about the shenandoah-dev
mailing list