RFR: Unreachable assert in ShenandoahCodeRoots::acquire_lock
Roman Kennke
rkennke at redhat.com
Wed Sep 5 08:45:38 UTC 2018
Oops. Good catch! Go!
Am 5. September 2018 10:41:37 MESZ schrieb Aleksey Shipilev <shade at redhat.com>:
>Static analysis says that assert is unreachable. Indeed it is, because
>the loop exits with return.
>Not only that, the assert itself is incorrect.
>
>diff -r b67a4350c0b0
>src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.hpp
>--- a/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.hpp Tue Sep
>04 12:47:36 2018 -0400
>+++ b/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.hpp Wed Sep
>05 09:37:45 2018 +0200
>@@ -151,16 +151,16 @@
> while (true) {
> int cur = OrderAccess::load_acquire(loc);
> if (cur >= 0) {
> if (Atomic::cmpxchg(cur + 1, loc, cur) == cur) {
> // Success!
>+ assert (*loc > 0, "acquired for read");
> return;
> }
> }
> SpinPause();
> }
>- assert (*loc > 1, "acquired for read");
> }
> }
>
> static void release_lock(bool write) {
> volatile int* loc = &ShenandoahCodeRoots::_recorded_nms_lock;
>
>
>Testing: tier3_gc_shenandoah
>
>Thanks,
>-Aleksey
More information about the shenandoah-dev
mailing list