RFR: 8361712: Improve ShenandoahAsserts printing [v2]

Thomas Stuefe stuefe at openjdk.org
Thu Jul 17 17:15:50 UTC 2025


On Thu, 17 Jul 2025 16:42:33 GMT, Roman Kennke <rkennke at openjdk.org> wrote:

>> Thomas Stuefe has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains eight additional commits since the last revision:
>> 
>>  - Merge branch 'openjdk:master' into harden-shenandoah-asserts
>>  - small revert
>>  - cosmetics
>>  - wip
>>  - wip
>>  - wip
>>  - wip
>>  - assert_correct
>
> src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp line 97:
> 
>> 95:   }
>> 96:   const_address loc = cast_from_oop<const_address>(obj);
>> 97:   os::print_hex_dump(&ss, loc, loc + 64, 4, true, 32, loc);
> 
> Does this need to check for heap-end boundary? Otherwise it may crash trying to print bytes from after the heap, which may not be mapped?

No, that function is safe to use on any memory. It uses SafeFetch and prints dots for unreadable parts.

> src/hotspot/share/utilities/ostream.hpp line 185:
> 
>> 183: 
>> 184:  public:
>> 185:   StreamIndentor(outputStream* os, int indentation = 2) :
> 
> Why do we need/want a default value here?

Ease of use, and less code. And it softly enforces 2 as a standard.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26237#discussion_r2213878925
PR Review Comment: https://git.openjdk.org/jdk/pull/26237#discussion_r2213881467


More information about the shenandoah-dev mailing list