RFR: 8369322: runtime/jni/nativeStack/TestNativeStack.java fails on Windows AArch64

David Holmes dholmes at openjdk.org
Wed Oct 8 00:55:11 UTC 2025


On Tue, 7 Oct 2025 22:19:47 GMT, Saint Wesonga <duke at openjdk.org> wrote:

> HAVE_PLATFORM_PRINT_NATIVE_STACK is not defined on Windows AArch64. Consequently, Windows AArch64 uses the [implementation of os::platform_print_native_stack that returns false](https://github.com/openjdk/jdk/blob/b50c11f9077f071cf5639de7e82ec261e0338532/src/hotspot/share/runtime/os.inline.hpp#L36-L41). This results in [NativeStackPrinter::print_stack](https://github.com/openjdk/jdk/blob/b50c11f9077f071cf5639de7e82ec261e0338532/src/hotspot/share/utilities/nativeStackPrinter.cpp#L32) having to call [NativeStackPrinter::print_stack_from_frame](https://github.com/openjdk/jdk/blob/b50c11f9077f071cf5639de7e82ec261e0338532/src/hotspot/share/utilities/nativeStackPrinter.hpp#L99-L106) instead. However, the context is null in that case. As a result, the [frame used for printing the stack](https://github.com/openjdk/jdk/blob/b50c11f9077f071cf5639de7e82ec261e0338532/src/hotspot/share/utilities/nativeStackPrinter.hpp#L103) is obtained from [os::current_frame()](https://github.com/openjdk/jdk/b
 lob/b50c11f9077f071cf5639de7e82ec261e0338532/src/hotspot/os_cpu/windows_aarch64/os_windows_aarch64.cpp#L165-L168), which returns an empty frame. The frame's pc() method returns `nullptr` and `Native frames: <unavailable>` is printed.
> 
> This change defines the `os::platform_print_native_stack` method for Windows AArch64 and adapts the implementation of the Windows x64 `os::win32::platform_print_native_stack` method to support Windows AArch64.

May I suggest changing the JBS issue title to "Implement native stack printing for Windows-Aarch64" and make it an enhancement.

I can't speak to the aarch64 specifics but the overall change looks good to me. A couple of minor nits.

Thanks

src/hotspot/os/windows/os_windows.cpp line 6298:

> 6296:  */
> 6297: bool os::win32::platform_print_native_stack(outputStream* st, const void* context,
> 6298:                                             char *buf, int buf_size, address& lastpc)

Suggestion:

                                            char* buf, int buf_size, address& lastpc)

src/hotspot/os/windows/os_windows.cpp line 6363:

> 6361: 
> 6362:     PVOID p = WindowsDbgHelp::symFunctionTableAccess64(GetCurrentProcess(), stk.AddrPC.Offset);
> 6363:     if (!p) {

Suggestion:

    if (p == nullptr) {

Style nit: no implicit booleans
EDIT: I see this is pre-existing, but please fix. Thanks

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

Marked as reviewed by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/27680#pullrequestreview-3312424960
PR Review Comment: https://git.openjdk.org/jdk/pull/27680#discussion_r2412252089
PR Review Comment: https://git.openjdk.org/jdk/pull/27680#discussion_r2412254795


More information about the hotspot-runtime-dev mailing list