RFR: 8311542: Consolidate the native stack printing code

Stefan Karlsson stefank at openjdk.org
Fri Dec 6 07:57:39 UTC 2024


On Fri, 6 Dec 2024 04:23:13 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> src/hotspot/share/utilities/nativeStackPrinter.cpp line 44:
>> 
>>> 42: }
>>> 43: 
>>> 44: void NativeStackPrinter::print_stack_from_frame(outputStream* st, frame& fr,
>> 
>> Why is `frame` passed by non-const reference?  This doesn't seem like a function that should be modifying
>> it?  Though changing this might also run afoul of const-correctness issues when accessing the frame, so
>> feel free to defer to a followup if that's a problem.
>
> I passed by reference here just to avoid adding in an additional level of copying in the new code as I was unsure if an additional copy might have an adverse impact. I never considered applying const and I also suspect it will have a significant flow-on effect if I try.

Note that the contents in fr is overwritten in this function. All callers of this function must be careful because of that. I vote for fixing it before pushing this.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22472#discussion_r1872747826


More information about the hotspot-runtime-dev mailing list