RFR: 8311542: Consolidate the native stack printing code [v2]

David Holmes dholmes at openjdk.org
Sun Dec 8 23:41:58 UTC 2024


> We now print native stacks in a number of contexts, not just VMError reporting, and we have to try `os::platform_print_native_stack` else fall back to `VMError::print_native stack`. 
> 
> The refactoring adds a new `NativeStackPrinter` (NSP) helper class which can be constructed with some of the context information for the printing that will follow. This avoids the need for the print functions to have a large number of parameters. We have to expose both the top-level printing functionality and the "lower-level" frame-based stack walk as the error reporter needs access to that directly. To maintain the exact same format of output the NSP has to be aware of some error reporter usage requirements.
> 
> I also had to expose a direct `frame` taking print function for the Debug.cpp `pns` case.
> 
> Testing:
>  - tiers 1 - 4
> 
> Some frame management code was also moved from `VMError` to the `frame` class.

David Holmes 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 five additional commits since the last revision:

 - Change from frame& parameter back to frame to ensure we match pre-existing logic for copying frames
 - Merge branch 'master' into 8311542-native-stack
 - Remove unused constructor
 - Missing file header
 - 8311542: Consolidate the native stack printing code

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/22472/files
  - new: https://git.openjdk.org/jdk/pull/22472/files/29dbd620..3228fb48

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=22472&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=22472&range=00-01

  Stats: 85777 lines in 1272 files changed: 69632 ins; 11002 del; 5143 mod
  Patch: https://git.openjdk.org/jdk/pull/22472.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/22472/head:pull/22472

PR: https://git.openjdk.org/jdk/pull/22472


More information about the hotspot-runtime-dev mailing list