RFR: 8371854: Shenandoah: Simplify WALK_FORWARD_IN_BLOCK_START use

Aleksey Shipilev shade at openjdk.org
Mon Nov 17 09:34:41 UTC 2025


On Fri, 14 Nov 2025 21:40:42 GMT, Nityanand Rai <duke at openjdk.org> wrote:

> Replace define/undefine pattern with #ifdef ASSERT block

This looks fine to me, but I think we want to go a bit further.

src/hotspot/share/gc/shenandoah/shenandoahScanRemembered.cpp line 383:

> 381:   oop obj = cast_to_oop(p);
> 382:   assert(oopDesc::is_oop(obj), "Should be an object");
> 383: #ifdef ASSERT

Minor: Move `#ifdef ASSERT` before `oop obj = ...` assignment. I am fairly certain that load would be folded in product configuration, but there is no point in risking it. Same with `#endif` below, move it just before return. Plus, change `guarantee(false, "...")` to `fatal("...")`.

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

PR Review: https://git.openjdk.org/jdk/pull/28333#pullrequestreview-3471823341
PR Review Comment: https://git.openjdk.org/jdk/pull/28333#discussion_r2533354653


More information about the hotspot-gc-dev mailing list