RFR: 8361712: Improve ShenandoahAsserts printing [v2]

Ashutosh Mehra asmehra at openjdk.org
Fri Jul 25 13:10:57 UTC 2025


On Fri, 25 Jul 2025 05:01:46 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp line 63:
>> 
>>> 61:   ResourceMark rm;
>>> 62:   stringStream ss;
>>> 63:   StreamIndentor si(&ss);
>> 
>> This seems redundant.
>
> Why?
> 
> StreamIndentor indents the future output of the associated stream. We place them wherever we need indentation. We want indentation here - that avoids having to write out manual indentation like the code before did.

right, I missed the print statement at line 74.

>> src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp line 140:
>> 
>>> 138: 
>>> 139:   if (!os::is_readable_pointer(obj)) {
>>> 140:     level = _safe_unknown;
>> 
>> Correct me if I am wrong - shouldn't the caller be responsible for passing correct `level` to `print_failure`? If the caller passes a potentially invalid obj with, say level = _safe_oop, then the caller should be updated.
>
> The caller may have erred. Seeing how many callers there are, there are many places that can bitrot. This is just an added safety feature.

okay

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26237#discussion_r2231040821
PR Review Comment: https://git.openjdk.org/jdk/pull/26237#discussion_r2231041847


More information about the shenandoah-dev mailing list