RFR: 8361712: Improve ShenandoahAsserts printing [v2]
Thomas Stuefe
stuefe at openjdk.org
Fri Jul 25 05:04:55 UTC 2025
On Thu, 24 Jul 2025 20:27:52 GMT, Ashutosh Mehra <asmehra 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 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.
> 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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26237#discussion_r2230143357
PR Review Comment: https://git.openjdk.org/jdk/pull/26237#discussion_r2230140139
More information about the shenandoah-dev
mailing list