RFR: 8266845: Shenandoah: Simplify SBS::load_reference_barrier implementation
Aleksey Shipilev
shade at openjdk.java.net
Tue May 11 06:44:55 UTC 2021
On Mon, 10 May 2021 20:14:14 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:
> Early return on null obj simplifies implementation and makes code more readable.
>
> Test:
> - [x] hotspot_gc_shenandoah
Changes requested by shade (Reviewer).
src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp line 105:
> 103: if (obj == nullptr) {
> 104: return nullptr;
> 105: }
Let's use `NULL` consistently? Yes, it is an old style, but it is consistent with the code in the same file.
src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp line 131:
> 129: oop fwd = load_reference_barrier(obj);
> 130: assert(fwd != nullptr, "Sanity");
> 131: if (ShenandoahSelfFixing && load_addr != NULL) {
I think dropping `fwd != obj` is not about the null-check. It is about not doing the CAS when evacuation fails. It is a minor performance optimization: do not try to perform obviously no-op update. Let's leave it as is.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3956
More information about the hotspot-gc-dev
mailing list