From 26c3390421f4888eb59017cadb2bf21a15e25b5e Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Fri, 24 Nov 2023 07:56:40 +0000 Subject: [PATCH] 8320383: refresh libraries cache on AIX in VMError::report Reviewed-by: stuefe, mdoerr --- src/hotspot/os/aix/os_aix.cpp | 4 ++++ src/hotspot/os/bsd/os_bsd.cpp | 3 +++ src/hotspot/os/linux/os_linux.cpp | 3 +++ src/hotspot/os/windows/os_windows.cpp | 3 +++ src/hotspot/share/runtime/os.hpp | 2 ++ src/hotspot/share/utilities/vmError.cpp | 11 ++++++----- 6 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp index bfff8fc86b5..54c538cf367 100644 --- a/src/hotspot/os/aix/os_aix.cpp +++ b/src/hotspot/os/aix/os_aix.cpp @@ -1017,6 +1017,10 @@ int os::current_process_id() { // directory not the java application's temp directory, ala java.io.tmpdir. const char* os::get_temp_directory() { return "/tmp"; } +void os::prepare_native_symbols() { + LoadedLibraries::reload(); +} + // Check if addr is inside libjvm.so. bool os::address_is_in_vm(address addr) { diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index c1cfb9a1717..fc8e0da1a69 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -895,6 +895,9 @@ bool os::address_is_in_vm(address addr) { return false; } +void os::prepare_native_symbols() { +} + bool os::dll_address_to_function_name(address addr, char *buf, int buflen, int *offset, bool demangle) { diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index 0608831a7dc..7bde97de907 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -1470,6 +1470,9 @@ bool os::address_is_in_vm(address addr) { return false; } +void os::prepare_native_symbols() { +} + bool os::dll_address_to_function_name(address addr, char *buf, int buflen, int *offset, bool demangle) { diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index 646fe7206a1..56301fe2e87 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -1398,6 +1398,9 @@ const char* os::get_current_directory(char *buf, size_t buflen) { return _getcwd(buf, n); } +void os::prepare_native_symbols() { +} + //----------------------------------------------------------- // Helper functions for fatal error handler #ifdef _WIN64 diff --git a/src/hotspot/share/runtime/os.hpp b/src/hotspot/share/runtime/os.hpp index 2f0b589c4e8..094fd2509a0 100644 --- a/src/hotspot/share/runtime/os.hpp +++ b/src/hotspot/share/runtime/os.hpp @@ -671,6 +671,8 @@ class os: AllStatic { static const char* get_temp_directory(); static const char* get_current_directory(char *buf, size_t buflen); + static void prepare_native_symbols(); + // Builds the platform-specific name of a library. // Returns false if the buffer is too small. static bool dll_build_name(char* buffer, size_t size, diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp index 34372701f6e..d586c6f4eea 100644 --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -74,10 +74,6 @@ #include "jvmci/jvmci.hpp" #endif -#ifdef AIX -#include "loadlib_aix.hpp" -#endif - #ifndef PRODUCT #include #endif // PRODUCT @@ -725,6 +721,11 @@ void VMError::report(outputStream* st, bool _verbose) { "Runtime Environment to continue."); } + // avoid the cache update for malloc/mmap errors + if (should_report_bug(_id)) { + os::prepare_native_symbols(); + } + #ifdef ASSERT // Error handler self tests // Meaning of codes passed through in the tests. @@ -1347,7 +1348,7 @@ void VMError::report(outputStream* st, bool _verbose) { void VMError::print_vm_info(outputStream* st) { char buf[O_BUFLEN]; - AIX_ONLY(LoadedLibraries::reload()); + os::prepare_native_symbols(); report_vm_version(st, buf, sizeof(buf));