-
Bug
-
Resolution: Fixed
-
P4
-
22, 23
-
b13
-
riscv
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8327659 | 22.0.2 | Gui Cao | P4 | Resolved | Fixed | b01 |
JDK-8330639 | 21.0.4 | Gui Cao | P4 | Resolved | Fixed | b01 |
JDK-8330635 | 17.0.12 | Gui Cao | P4 | Resolved | Fixed | b01 |
With compressed oops enabled, Shenandoah GC crashes in the concurrent marking phase due to some incorrect atomic memory operations. This resulted in the failure of multiple related tests, including `gc/shenandoah/TestSmallHeap.java`, `gc/metaspace/TestMetaspacePerfCounters.java#Shenandoah-64`, and so on, tested on XuanTie C910 and QEMU.
This failure is related to a GCC bug we recently discovered: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114130.
In detail, there's a pattern in method `ShenandoahHeap::conc_update_with_forwarded`:
```cpp
if (in_collection_set(obj)) {
// Dereferences `obj` without explicit null check.
oop fwd = ShenandoahBarrierSet::resolve_forwarded_not_null(obj);
// Then calls atomic built-in.
atomic_update_oop(fwd, p, obj);
}
```
`atomic_update_oop` then compresses `obj` into a 32-bit word and calls the built-in `__atomic_compare_exchange`. The latter produces incorrect assembly that comparing this unsigned 32-bit word with the sign-extended result of `lr.w` instructions.
This bug can be bypassed by adding an explicit null check (like `if (obj && in_collection_set(obj))`), or adding compiler flag `-fno-delete-null-pointer-checks`.
In previous commits,
- backported by
-
JDK-8327659 RISC-V: Shenandoah GC crashes due to incorrect atomic memory operations
- Resolved
-
JDK-8330635 RISC-V: Shenandoah GC crashes due to incorrect atomic memory operations
- Resolved
-
JDK-8330639 RISC-V: Shenandoah GC crashes due to incorrect atomic memory operations
- Resolved
- relates to
-
JDK-8330242 RISC-V: Simplify and remove CORRECT_COMPILER_ATOMIC_SUPPORT in atomic_linux_riscv.hpp
- Resolved
- links to
-
Commit openjdk/jdk17u-dev/30a9a217
-
Commit openjdk/jdk21u-dev/f0f2e70f
-
Commit openjdk/jdk22u/cffdef15
-
Commit openjdk/jdk/a089ed2b
-
Review openjdk/jdk17u-dev/2417
-
Review openjdk/jdk21u-dev/507
-
Review openjdk/jdk22u/90
-
Review openjdk/jdk/18039