mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-21 03:24:38 +02:00
8140645
: Recent Developments for AIX
Port recent developments from SAP for AIX to the OpenJDK Reviewed-by: goetz
This commit is contained in:
parent
e3e3e02480
commit
c230209787
8 changed files with 592 additions and 359 deletions
|
@ -40,6 +40,7 @@
|
|||
#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"
|
||||
|
@ -159,23 +160,10 @@ typedef stackslot_t* stackptr_t;
|
|||
#define PV_8_Compat 0x308000 /* Power PC 8 */
|
||||
#endif
|
||||
|
||||
#define trcVerbose(fmt, ...) { /* PPC port */ \
|
||||
if (Verbose) { \
|
||||
fprintf(stderr, fmt, ##__VA_ARGS__); \
|
||||
fputc('\n', stderr); fflush(stderr); \
|
||||
} \
|
||||
}
|
||||
#define trc(fmt, ...) /* PPC port */
|
||||
|
||||
#define ERRBYE(s) { \
|
||||
trcVerbose(s); \
|
||||
return -1; \
|
||||
}
|
||||
|
||||
// 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
|
||||
// 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;
|
||||
|
@ -189,7 +177,7 @@ inline bool is_valid_stackpointer(stackptr_t sp, stackptr_t stack_base, size_t s
|
|||
return true;
|
||||
}
|
||||
|
||||
// returns true if function is a valid codepointer
|
||||
// Returns true if function is a valid codepointer.
|
||||
inline bool is_valid_codepointer(codeptr_t p) {
|
||||
if (!p) {
|
||||
return false;
|
||||
|
@ -197,7 +185,7 @@ inline bool is_valid_codepointer(codeptr_t p) {
|
|||
if (((uintptr_t)p) & 0x3) {
|
||||
return false;
|
||||
}
|
||||
if (LoadedLibraries::find_for_text_address((address)p) == NULL) {
|
||||
if (!LoadedLibraries::find_for_text_address(p, NULL)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -1387,26 +1375,15 @@ 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;
|
||||
}
|
||||
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 {
|
||||
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;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Resolve an AIX function descriptor literal to a code pointer.
|
||||
|
@ -1418,21 +1395,18 @@ bool os::address_is_in_vm(address addr) {
|
|||
// 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
|
||||
if (LoadedLibraries::find_for_text_address(p, NULL) != NULL) {
|
||||
// It is 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;
|
||||
}
|
||||
} 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) {
|
||||
// It is a function descriptor.
|
||||
return code_entry;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1461,7 +1435,6 @@ static int getModuleName(codeptr_t pc, // [in] program counte
|
|||
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';
|
||||
}
|
||||
|
@ -1469,16 +1442,15 @@ static int getModuleName(codeptr_t pc, // [in] program counte
|
|||
*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());
|
||||
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;
|
||||
}
|
||||
|
||||
trcVerbose("pc outside any module");
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -3781,18 +3753,11 @@ 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);
|
||||
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;
|
||||
} else {
|
||||
lib = LoadedLibraries::find_for_data_address(addr);
|
||||
if (lib) {
|
||||
lib->print(st);
|
||||
return true;
|
||||
} else {
|
||||
st->print_cr("(outside any module)");
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue