< prev index next >
src/os/aix/vm/os_aix.cpp
Print this page
rev 9211 : 8140645: Recent Developments for AIX
Summary: Port recent developments from SAP for AIX to the OpenJDK
*** 38,47 ****
--- 38,48 ----
#include "jvm_aix.h"
#include "libperfstat_aix.hpp"
#include "loadlib_aix.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/filemap.hpp"
+ #include "misc_aix.hpp"
#include "mutex_aix.inline.hpp"
#include "oops/oop.inline.hpp"
#include "os_aix.inline.hpp"
#include "os_share_aix.hpp"
#include "porting_aix.hpp"
*** 173,183 ****
}
// Query dimensions of the stack of the calling thread.
static bool query_stack_dimensions(address* p_stack_base, size_t* p_stack_size);
! // function to check a given stack pointer against given stack limits
inline bool is_valid_stackpointer(stackptr_t sp, stackptr_t stack_base, size_t stack_size) {
if (((uintptr_t)sp) & 0x7) {
return false;
}
if (sp > stack_base) {
--- 174,184 ----
}
// Query dimensions of the stack of the calling thread.
static bool query_stack_dimensions(address* p_stack_base, size_t* p_stack_size);
! // Function to check a given stack pointer against given stack limits
inline bool is_valid_stackpointer(stackptr_t sp, stackptr_t stack_base, size_t stack_size) {
if (((uintptr_t)sp) & 0x7) {
return false;
}
if (sp > stack_base) {
*** 187,205 ****
return false;
}
return true;
}
! // returns true if function is a valid codepointer
inline bool is_valid_codepointer(codeptr_t p) {
if (!p) {
return false;
}
if (((uintptr_t)p) & 0x3) {
return false;
}
! if (LoadedLibraries::find_for_text_address((address)p) == NULL) {
return false;
}
return true;
}
--- 188,206 ----
return false;
}
return true;
}
! // Returns true if function is a valid codepointer
inline bool is_valid_codepointer(codeptr_t p) {
if (!p) {
return false;
}
if (((uintptr_t)p) & 0x3) {
return false;
}
! if (!LoadedLibraries::find_for_text_address(p, NULL)) {
return false;
}
return true;
}
*** 1385,1414 ****
// Check if addr is inside libjvm.so.
bool os::address_is_in_vm(address addr) {
// Input could be a real pc or a function pointer literal. The latter
// would be a function descriptor residing in the data segment of a module.
!
! const LoadedLibraryModule* lib = LoadedLibraries::find_for_text_address(addr);
! if (lib) {
! if (strcmp(lib->get_shortname(), "libjvm.so") == 0) {
! return true;
! } else {
! return false;
! }
! } else {
! lib = LoadedLibraries::find_for_data_address(addr);
! if (lib) {
! if (strcmp(lib->get_shortname(), "libjvm.so") == 0) {
! return true;
! } else {
! return false;
! }
} else {
return false;
}
! }
}
// Resolve an AIX function descriptor literal to a code pointer.
// If the input is a valid code pointer to a text segment of a loaded module,
// it is returned unchanged.
--- 1386,1404 ----
// Check if addr is inside libjvm.so.
bool os::address_is_in_vm(address addr) {
// Input could be a real pc or a function pointer literal. The latter
// would be a function descriptor residing in the data segment of a module.
! loaded_module_t lm;
! if (LoadedLibraries::find_for_text_address(addr, &lm) != NULL) {
! return lm.is_in_vm;
! } else if (LoadedLibraries::find_for_data_address(addr, &lm) != NULL) {
! return lm.is_in_vm;
} else {
return false;
}
!
}
// Resolve an AIX function descriptor literal to a code pointer.
// If the input is a valid code pointer to a text segment of a loaded module,
// it is returned unchanged.
*** 1416,1440 ****
// code entry point.
// If the input is neither a valid function descriptor nor a valid code pointer,
// NULL is returned.
static address resolve_function_descriptor_to_code_pointer(address p) {
! const LoadedLibraryModule* lib = LoadedLibraries::find_for_text_address(p);
! if (lib) {
// its a real code pointer
return p;
! } else {
! lib = LoadedLibraries::find_for_data_address(p);
! if (lib) {
// pointer to data segment, potential function descriptor
address code_entry = (address)(((FunctionDescriptor*)p)->entry());
! if (LoadedLibraries::find_for_text_address(code_entry)) {
// Its a function descriptor
return code_entry;
}
}
! }
return NULL;
}
bool os::dll_address_to_function_name(address addr, char *buf,
int buflen, int *offset,
--- 1406,1427 ----
// code entry point.
// If the input is neither a valid function descriptor nor a valid code pointer,
// NULL is returned.
static address resolve_function_descriptor_to_code_pointer(address p) {
! if (LoadedLibraries::find_for_text_address(p, NULL) != NULL) {
// its a real code pointer
return p;
! } else if (LoadedLibraries::find_for_data_address(p, NULL) != NULL) {
// pointer to data segment, potential function descriptor
address code_entry = (address)(((FunctionDescriptor*)p)->entry());
! if (LoadedLibraries::find_for_text_address(code_entry, NULL) != NULL) {
// Its a function descriptor
return code_entry;
}
}
!
return NULL;
}
bool os::dll_address_to_function_name(address addr, char *buf,
int buflen, int *offset,
*** 1459,1486 ****
static int getModuleName(codeptr_t pc, // [in] program counter
char* p_name, size_t namelen, // [out] optional: function name
char* p_errmsg, size_t errmsglen // [out] optional: user provided buffer for error messages
) {
- // initialize output parameters
if (p_name && namelen > 0) {
*p_name = '\0';
}
if (p_errmsg && errmsglen > 0) {
*p_errmsg = '\0';
}
- const LoadedLibraryModule* const lib = LoadedLibraries::find_for_text_address((address)pc);
- if (lib) {
if (p_name && namelen > 0) {
! sprintf(p_name, "%.*s", namelen, lib->get_shortname());
}
return 0;
}
- trcVerbose("pc outside any module");
-
return -1;
}
bool os::dll_address_to_library_name(address addr, char* buf,
int buflen, int* offset) {
--- 1446,1471 ----
static int getModuleName(codeptr_t pc, // [in] program counter
char* p_name, size_t namelen, // [out] optional: function name
char* p_errmsg, size_t errmsglen // [out] optional: user provided buffer for error messages
) {
if (p_name && namelen > 0) {
*p_name = '\0';
}
if (p_errmsg && errmsglen > 0) {
*p_errmsg = '\0';
}
if (p_name && namelen > 0) {
! loaded_module_t lm;
! if (LoadedLibraries::find_for_text_address(pc, &lm) != NULL) {
! strncpy(p_name, lm.shortname, namelen);
! p_name[namelen - 1] = '\0';
}
return 0;
}
return -1;
}
bool os::dll_address_to_library_name(address addr, char* buf,
int buflen, int* offset) {
*** 3785,3806 ****
bool os::find(address addr, outputStream* st) {
st->print(PTR_FORMAT ": ", addr);
! const LoadedLibraryModule* lib = LoadedLibraries::find_for_text_address(addr);
! if (lib) {
! lib->print(st);
! return true;
! } else {
! lib = LoadedLibraries::find_for_data_address(addr);
! if (lib) {
! lib->print(st);
return true;
- } else {
- st->print_cr("(outside any module)");
- }
}
return false;
}
--- 3770,3784 ----
bool os::find(address addr, outputStream* st) {
st->print(PTR_FORMAT ": ", addr);
! loaded_module_t lm;
! if ( LoadedLibraries::find_for_text_address(addr, &lm) != NULL ||
! LoadedLibraries::find_for_data_address(addr, &lm) != NULL) {
! st->print("%s", lm.path);
return true;
}
return false;
}
< prev index next >