RFR: 8364103: Convert existing sprintf-chains to stringStream [v2]
Paul Hübner
phubner at openjdk.org
Thu Sep 4 13:12:36 UTC 2025
On Fri, 22 Aug 2025 18:24:13 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> Paul Hübner has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains three commits:
>>
>> - Incorporate reviewer feedback.
>> - Merge branch 'master' into JDK-8364103
>> - Refactor stack trace printing to use stringStream.
>
> Why are we printing to a buffer first?
>
> Originally this function was `java_lang_Throwable::print_stack_element_to_buffer()` and returns a buffer. Hence the anachronistic comment "// Print stack trace element to resource allocated buffer" which is no longer correct.
>
> I can't find any information from the history of this file:
>
> https://github.com/openjdk/jdk/blame/68f3dd76c92ce3b0219ac2cc346718dd865645d9/hotspot/src/share/vm/classfile/javaClasses.cpp#L1161
>
> I am guessing the reason is to avoid interleaving with other threads. I think the above comment should be updated to reflect this.
@iklam thanks for the feedback, I've addressed your remarks. Thanks also @kimbarrett and @dholmes-ora for notifying me about your change, I've superseded those with the stringBuilder.
I hope I've addressed the comments satisfactorily, if not please do let me know and I'll do another iteration of changes.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26894#issuecomment-3253639901
More information about the hotspot-runtime-dev
mailing list