< prev index next >
src/os/aix/vm/os_aix.cpp
Print this page
rev 7507 : 8066964: ppc64: argument and return type profiling, fix problem with popframe
*** 122,158 ****
tid64_t* IndexPointer,
int Count);
}
#endif
- // Excerpts from systemcfg.h definitions newer than AIX 5.3
- #ifndef PV_7
- # define PV_7 0x200000 // Power PC 7
- # define PV_7_Compat 0x208000 // Power PC 7
- #endif
-
#define MAX_PATH (2 * K)
// for timer info max values which include all bits
#define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
// for multipage initialization error analysis (in 'g_multipage_error')
#define ERROR_MP_OS_TOO_OLD 100
#define ERROR_MP_EXTSHM_ACTIVE 101
#define ERROR_MP_VMGETINFO_FAILED 102
#define ERROR_MP_VMGETINFO_CLAIMS_NO_SUPPORT_FOR_64K 103
! // the semantics in this file are thus that codeptr_t is a *real code ptr*
// This means that any function taking codeptr_t as arguments will assume
// a real codeptr and won't handle function descriptors (eg getFuncName),
// whereas functions taking address as args will deal with function
! // descriptors (eg os::dll_address_to_library_name)
typedef unsigned int* codeptr_t;
! // typedefs for stackslots, stack pointers, pointers to op codes
typedef unsigned long stackslot_t;
typedef stackslot_t* stackptr_t;
// query dimensions of the stack of the calling thread
static void 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) {
--- 122,175 ----
tid64_t* IndexPointer,
int Count);
}
#endif
#define MAX_PATH (2 * K)
// for timer info max values which include all bits
#define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
// for multipage initialization error analysis (in 'g_multipage_error')
#define ERROR_MP_OS_TOO_OLD 100
#define ERROR_MP_EXTSHM_ACTIVE 101
#define ERROR_MP_VMGETINFO_FAILED 102
#define ERROR_MP_VMGETINFO_CLAIMS_NO_SUPPORT_FOR_64K 103
! // The semantics in this file are thus that codeptr_t is a *real code ptr*.
// This means that any function taking codeptr_t as arguments will assume
// a real codeptr and won't handle function descriptors (eg getFuncName),
// whereas functions taking address as args will deal with function
! // descriptors (eg os::dll_address_to_library_name).
typedef unsigned int* codeptr_t;
! // Typedefs for stackslots, stack pointers, pointers to op codes.
typedef unsigned long stackslot_t;
typedef stackslot_t* stackptr_t;
+ // Excerpts from systemcfg.h definitions newer than AIX 5.3.
+ #ifndef PV_7
+ #define PV_7 0x200000 /* Power PC 7 */
+ #define PV_7_Compat 0x208000 /* Power PC 7 */
+ #endif
+ #ifndef PV_8
+ #define PV_8 0x300000 /* Power PC 8 */
+ #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 void 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) {
*** 180,195 ****
return false;
}
return true;
}
! // macro to check a given stack pointer against given stack limits and to die if test fails
#define CHECK_STACK_PTR(sp, stack_base, stack_size) { \
guarantee(is_valid_stackpointer((stackptr_t)(sp), (stackptr_t)(stack_base), stack_size), "Stack Pointer Invalid"); \
}
! // macro to check the current stack pointer against given stacklimits
#define CHECK_CURRENT_STACK_PTR(stack_base, stack_size) { \
address sp; \
sp = os::current_stack_pointer(); \
CHECK_STACK_PTR(sp, stack_base, stack_size); \
}
--- 197,212 ----
return false;
}
return true;
}
! // Macro to check a given stack pointer against given stack limits and to die if test fails.
#define CHECK_STACK_PTR(sp, stack_base, stack_size) { \
guarantee(is_valid_stackpointer((stackptr_t)(sp), (stackptr_t)(stack_base), stack_size), "Stack Pointer Invalid"); \
}
! // Macro to check the current stack pointer against given stacklimits.
#define CHECK_CURRENT_STACK_PTR(stack_base, stack_size) { \
address sp; \
sp = os::current_stack_pointer(); \
CHECK_STACK_PTR(sp, stack_base, stack_size); \
}
*** 219,229 ****
static sigset_t check_signal_done; // For diagnostics to print a message once (see run_periodic_checks)
static bool check_signals = true;
static pid_t _initial_pid = 0;
static int SR_signum = SIGUSR2; // Signal used to suspend/resume a thread (must be > SIGSEGV, see 4355769)
static sigset_t SR_sigset;
! static pthread_mutex_t dl_mutex; // Used to protect dlsym() calls */
julong os::available_memory() {
return Aix::available_memory();
}
--- 236,246 ----
static sigset_t check_signal_done; // For diagnostics to print a message once (see run_periodic_checks)
static bool check_signals = true;
static pid_t _initial_pid = 0;
static int SR_signum = SIGUSR2; // Signal used to suspend/resume a thread (must be > SIGSEGV, see 4355769)
static sigset_t SR_sigset;
! static pthread_mutex_t dl_mutex; // Used to protect dlsym() calls.
julong os::available_memory() {
return Aix::available_memory();
}
*** 251,261 ****
}
if (len > 0) buf[0] = 0; // return a null string
return false;
}
-
// Return true if user is running as root.
bool os::have_special_privileges() {
static bool init = false;
static bool privileges = false;
--- 268,277 ----
*** 282,302 ****
char* p = addr;
for (int i = 0; i < numFullDisclaimsNeeded; i ++) {
if (::disclaim(p, maxDisclaimSize, DISCLAIM_ZEROMEM) != 0) {
! //if (Verbose)
! fprintf(stderr, "Cannot disclaim %p - %p (errno %d)\n", p, p + maxDisclaimSize, errno);
return false;
}
p += maxDisclaimSize;
}
if (lastDisclaimSize > 0) {
if (::disclaim(p, lastDisclaimSize, DISCLAIM_ZEROMEM) != 0) {
! //if (Verbose)
! fprintf(stderr, "Cannot disclaim %p - %p (errno %d)\n", p, p + lastDisclaimSize, errno);
return false;
}
}
return true;
--- 298,316 ----
char* p = addr;
for (int i = 0; i < numFullDisclaimsNeeded; i ++) {
if (::disclaim(p, maxDisclaimSize, DISCLAIM_ZEROMEM) != 0) {
! trc("Cannot disclaim %p - %p (errno %d)\n", p, p + maxDisclaimSize, errno);
return false;
}
p += maxDisclaimSize;
}
if (lastDisclaimSize > 0) {
if (::disclaim(p, lastDisclaimSize, DISCLAIM_ZEROMEM) != 0) {
! trc("Cannot disclaim %p - %p (errno %d)\n", p, p + lastDisclaimSize, errno);
return false;
}
}
return true;
*** 332,346 ****
return (pid_t) thread_self();
}
void os::Aix::initialize_system_info() {
! // get the number of online(logical) cpus instead of configured
os::_processor_count = sysconf(_SC_NPROCESSORS_ONLN);
assert(_processor_count > 0, "_processor_count must be > 0");
! // retrieve total physical storage
os::Aix::meminfo_t mi;
if (!os::Aix::get_meminfo(&mi)) {
fprintf(stderr, "os::Aix::get_meminfo failed.\n"); fflush(stderr);
assert(false, "os::Aix::get_meminfo failed.");
}
--- 346,360 ----
return (pid_t) thread_self();
}
void os::Aix::initialize_system_info() {
! // Get the number of online(logical) cpus instead of configured.
os::_processor_count = sysconf(_SC_NPROCESSORS_ONLN);
assert(_processor_count > 0, "_processor_count must be > 0");
! // Retrieve total physical storage.
os::Aix::meminfo_t mi;
if (!os::Aix::get_meminfo(&mi)) {
fprintf(stderr, "os::Aix::get_meminfo failed.\n"); fflush(stderr);
assert(false, "os::Aix::get_meminfo failed.");
}
*** 511,521 ****
fprintf(stderr, "Multipage error details: %d\n", g_multipage_error);
}
} // end os::Aix::query_multipage_support()
- // The code for this method was initially derived from the version in os_linux.cpp.
void os::init_system_properties_values() {
#define DEFAULT_LIBPATH "/usr/lib:/lib"
#define EXTENSIONS_DIR "/lib/ext"
#define ENDORSED_DIR "/lib/endorsed"
--- 525,534 ----
*** 608,621 ****
bool os::Aix::is_sig_ignored(int sig) {
struct sigaction oact;
sigaction(sig, (struct sigaction*)NULL, &oact);
void* ohlr = oact.sa_sigaction ? CAST_FROM_FN_PTR(void*, oact.sa_sigaction)
: CAST_FROM_FN_PTR(void*, oact.sa_handler);
! if (ohlr == CAST_FROM_FN_PTR(void*, SIG_IGN))
return true;
! else
return false;
}
void os::Aix::signal_sets_init() {
// Should also have an assertion stating we are still single-threaded.
assert(!signal_sets_initialized, "Already initialized");
--- 621,635 ----
bool os::Aix::is_sig_ignored(int sig) {
struct sigaction oact;
sigaction(sig, (struct sigaction*)NULL, &oact);
void* ohlr = oact.sa_sigaction ? CAST_FROM_FN_PTR(void*, oact.sa_sigaction)
: CAST_FROM_FN_PTR(void*, oact.sa_handler);
! if (ohlr == CAST_FROM_FN_PTR(void*, SIG_IGN)) {
return true;
! } else {
return false;
+ }
}
void os::Aix::signal_sets_init() {
// Should also have an assertion stating we are still single-threaded.
assert(!signal_sets_initialized, "Already initialized");
*** 785,794 ****
--- 799,811 ----
pci->loadavg[i] = (double) psct.loadavg[i] / (1 << SBITS);
}
// get the processor version from _system_configuration
switch (_system_configuration.version) {
+ case PV_8:
+ strcpy(pci->version, "Power PC 8");
+ break;
case PV_7:
strcpy(pci->version, "Power PC 7");
break;
case PV_6_1:
strcpy(pci->version, "Power PC 6 DD1.x");
*** 812,821 ****
--- 829,841 ----
strcpy(pci->version, "PV_6_Compat");
break;
case PV_7_Compat:
strcpy(pci->version, "PV_7_Compat");
break;
+ case PV_8_Compat:
+ strcpy(pci->version, "PV_8_Compat");
+ break;
default:
strcpy(pci->version, "unknown");
}
return true;
*** 947,957 ****
pthread_t tid;
int ret = pthread_create(&tid, &attr, (void* (*)(void*)) java_start, thread);
pthread_attr_destroy(&attr);
! if (ret != 0) {
if (PrintMiscellaneous && (Verbose || WizardMode)) {
perror("pthread_create()");
}
// Need to clean up stuff we've allocated so far
thread->set_osthread(NULL);
--- 967,979 ----
pthread_t tid;
int ret = pthread_create(&tid, &attr, (void* (*)(void*)) java_start, thread);
pthread_attr_destroy(&attr);
! if (ret == 0) {
! // PPC port traceOsMisc(("Created New Thread : pthread-id %u", tid));
! } else {
if (PrintMiscellaneous && (Verbose || WizardMode)) {
perror("pthread_create()");
}
// Need to clean up stuff we've allocated so far
thread->set_osthread(NULL);
*** 1108,1119 ****
jlong os::javaTimeNanos() {
if (os::Aix::on_pase()) {
Unimplemented();
return 0;
! }
! else {
// On AIX use the precision of processors real time clock
// or time base registers.
timebasestruct_t time;
int rc;
--- 1130,1140 ----
jlong os::javaTimeNanos() {
if (os::Aix::on_pase()) {
Unimplemented();
return 0;
! } else {
// On AIX use the precision of processors real time clock
// or time base registers.
timebasestruct_t time;
int rc;
*** 1157,1167 ****
return true;
}
}
-
char * os::local_time_string(char *buf, size_t buflen) {
struct tm t;
time_t long_time;
time(&long_time);
localtime_r(&long_time, &t);
--- 1178,1187 ----
*** 1195,1205 ****
// Check for abort hook
abort_hook_t abort_hook = Arguments::abort_hook();
if (abort_hook != NULL) {
abort_hook();
}
-
}
// Note: os::abort() might be called very early during initialization, or
// called from signal handler. Before adding something to os::abort(), make
// sure it is async-safe and can handle partially initialized VM.
--- 1215,1224 ----
*** 1227,1237 ****
// This method is a copy of JDK's sysGetLastErrorString
// from src/solaris/hpi/src/system_md.c
size_t os::lasterror(char *buf, size_t len) {
-
if (errno == 0) return 0;
const char *s = ::strerror(errno);
size_t n = ::strlen(s);
if (n >= len) {
--- 1246,1255 ----
*** 1241,1250 ****
--- 1259,1269 ----
buf[n] = '\0';
return n;
}
intx os::current_thread_id() { return (intx)pthread_self(); }
+
int os::current_process_id() {
// This implementation returns a unique pid, the pid of the
// launcher thread that starts the vm 'process'.
*** 1377,1389 ****
bool os::dll_address_to_function_name(address addr, char *buf,
int buflen, int *offset) {
if (offset) {
*offset = -1;
}
! if (buf) {
buf[0] = '\0';
- }
// Resolve function ptr literals first.
addr = resolve_function_descriptor_to_code_pointer(addr);
if (!addr) {
return false;
--- 1396,1408 ----
bool os::dll_address_to_function_name(address addr, char *buf,
int buflen, int *offset) {
if (offset) {
*offset = -1;
}
! // Buf is not optional, but offset is optional.
! assert(buf != NULL, "sanity check");
buf[0] = '\0';
// Resolve function ptr literals first.
addr = resolve_function_descriptor_to_code_pointer(addr);
if (!addr) {
return false;
*** 1412,1437 ****
sprintf(p_name, "%.*s", namelen, lib->get_shortname());
}
return 0;
}
! if (Verbose) {
! fprintf(stderr, "pc outside any module");
! }
return -1;
-
}
bool os::dll_address_to_library_name(address addr, char* buf,
int buflen, int* offset) {
if (offset) {
*offset = -1;
}
! if (buf) {
buf[0] = '\0';
- }
// Resolve function ptr literals first.
addr = resolve_function_descriptor_to_code_pointer(addr);
if (!addr) {
return false;
--- 1431,1453 ----
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) {
if (offset) {
*offset = -1;
}
! // Buf is not optional, but offset is optional.
! assert(buf != NULL, "sanity check");
buf[0] = '\0';
// Resolve function ptr literals first.
addr = resolve_function_descriptor_to_code_pointer(addr);
if (!addr) {
return false;
*** 1442,1452 ****
}
return false;
}
// Loads .dll/.so and in case of error it checks if .dll/.so was built
! // for the same architecture as Hotspot is running on
void *os::dll_load(const char *filename, char *ebuf, int ebuflen) {
if (ebuf && ebuflen > 0) {
ebuf[0] = '\0';
ebuf[ebuflen - 1] = '\0';
--- 1458,1468 ----
}
return false;
}
// Loads .dll/.so and in case of error it checks if .dll/.so was built
! // for the same architecture as Hotspot is running on.
void *os::dll_load(const char *filename, char *ebuf, int ebuflen) {
if (ebuf && ebuflen > 0) {
ebuf[0] = '\0';
ebuf[ebuflen - 1] = '\0';
*** 1605,1615 ****
// Use common posix version.
os::Posix::print_siginfo_brief(st, (const siginfo_t*) siginfo);
st->cr();
}
-
static void print_signal_handler(outputStream* st, int sig,
char* buf, size_t buflen);
void os::print_signal_handlers(outputStream* st, char* buf, size_t buflen) {
st->print_cr("Signal Handlers:");
--- 1621,1630 ----
*** 1629,1639 ****
print_signal_handler(st, SIGDANGER, buf, buflen);
}
static char saved_jvm_path[MAXPATHLEN] = {0};
! // Find the full path to the current module, libjvm.so or libjvm_g.so
void os::jvm_path(char *buf, jint buflen) {
// Error checking.
if (buflen < MAXPATHLEN) {
assert(false, "must use a large-enough buffer");
buf[0] = '\0';
--- 1644,1654 ----
print_signal_handler(st, SIGDANGER, buf, buflen);
}
static char saved_jvm_path[MAXPATHLEN] = {0};
! // Find the full path to the current module, libjvm.so.
void os::jvm_path(char *buf, jint buflen) {
// Error checking.
if (buflen < MAXPATHLEN) {
assert(false, "must use a large-enough buffer");
buf[0] = '\0';
*** 2862,2879 ****
int policy = SCHED_OTHER;
struct sched_param param;
param.sched_priority = newpri;
int ret = pthread_setschedparam(thr, policy, ¶m);
! if (Verbose) {
! if (ret == 0) {
! fprintf(stderr, "changed priority of thread %d to %d\n", (int)thr, newpri);
! } else {
! fprintf(stderr, "Could not changed priority for thread %d to %d (error %d, %s)\n",
(int)thr, newpri, ret, strerror(ret));
}
- }
return (ret == 0) ? OS_OK : OS_ERR;
}
OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) {
if (!UseThreadPriorities) {
--- 2877,2890 ----
int policy = SCHED_OTHER;
struct sched_param param;
param.sched_priority = newpri;
int ret = pthread_setschedparam(thr, policy, ¶m);
! if (ret != 0) {
! trcVerbose("Could not change priority for thread %d to %d (error %d, %s)",
(int)thr, newpri, ret, strerror(ret));
}
return (ret == 0) ? OS_OK : OS_ERR;
}
OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) {
if (!UseThreadPriorities) {
*** 2989,2999 ****
}
errno = old_errno;
}
-
static int SR_initialize() {
struct sigaction act;
char *s;
// Get signal number to use for suspend/resume
if ((s = ::getenv("_JAVA_SR_SIGNUM")) != 0) {
--- 3000,3009 ----
*** 3188,3198 ****
unblock_program_error_signals();
JVM_handle_aix_signal(sig, info, uc, true);
}
-
// This boolean allows users to forward their own non-matching signals
// to JVM_handle_aix_signal, harmlessly.
bool os::Aix::signal_handlers_are_installed = false;
// For signal-chaining
--- 3198,3207 ----
*** 3382,3392 ****
set_signal_handler(SIGTRAP, true);
set_signal_handler(SIGXFSZ, true);
set_signal_handler(SIGDANGER, true);
if (libjsig_is_loaded) {
! // Tell libjsig jvm finishes setting signal handlers
(*end_signal_setting)();
}
// We don't activate signal checker if libjsig is in place, we trust ourselves
// and if UserSignalHandler is installed all bets are off.
--- 3391,3401 ----
set_signal_handler(SIGTRAP, true);
set_signal_handler(SIGXFSZ, true);
set_signal_handler(SIGDANGER, true);
if (libjsig_is_loaded) {
! // Tell libjsig jvm finishes setting signal handlers.
(*end_signal_setting)();
}
// We don't activate signal checker if libjsig is in place, we trust ourselves
// and if UserSignalHandler is installed all bets are off.
*** 3398,3408 ****
}
if (AllowUserSignalHandlers) {
tty->print_cr("Info: AllowUserSignalHandlers is activated, all active signal checking is disabled");
check_signals = false;
}
! // need to initialize check_signal_done
::sigemptyset(&check_signal_done);
}
}
}
--- 3407,3417 ----
}
if (AllowUserSignalHandlers) {
tty->print_cr("Info: AllowUserSignalHandlers is activated, all active signal checking is disabled");
check_signals = false;
}
! // Need to initialize check_signal_done.
::sigemptyset(&check_signal_done);
}
}
}
*** 3472,3482 ****
}
}
st->cr();
}
-
#define DO_SIGNAL_CHECK(sig) \
if (!sigismember(&check_signal_done, sig)) \
os::Aix::check_signal_handler(sig)
// This method is a periodic task to check for misbehaving JNI applications
--- 3481,3490 ----
*** 3533,3543 ****
address thisHandler = (act.sa_flags & SA_SIGINFO)
? CAST_FROM_FN_PTR(address, act.sa_sigaction)
: CAST_FROM_FN_PTR(address, act.sa_handler);
-
switch(sig) {
case SIGSEGV:
case SIGBUS:
case SIGFPE:
case SIGPIPE:
--- 3541,3550 ----
*** 3686,3704 ****
initial_time_count = os::elapsed_counter();
pthread_mutex_init(&dl_mutex, NULL);
}
! // this is called _after_ the global arguments have been parsed
jint os::init_2(void) {
! if (Verbose) {
! fprintf(stderr, "processor count: %d\n", os::_processor_count);
! fprintf(stderr, "physical memory: %lu\n", Aix::_physical_memory);
! }
! // initially build up the loaded dll map
LoadedLibraries::reload();
const int page_size = Aix::page_size();
const int map_size = page_size;
--- 3693,3709 ----
initial_time_count = os::elapsed_counter();
pthread_mutex_init(&dl_mutex, NULL);
}
! // This is called _after_ the global arguments have been parsed.
jint os::init_2(void) {
! trcVerbose("processor count: %d", os::_processor_count);
! trcVerbose("physical memory: %lu", Aix::_physical_memory);
! // Initially build up the loaded dll map.
LoadedLibraries::reload();
const int page_size = Aix::page_size();
const int map_size = page_size;
*** 3744,3754 ****
// map succeeded and map_address is at wished address, exit loop.
break;
}
if (map_address != (address) MAP_FAILED) {
! // map succeeded, but polling_page is not at wished address, unmap and continue.
::munmap(map_address, map_size);
map_address = (address) MAP_FAILED;
}
// map failed, continue loop.
}
--- 3749,3759 ----
// map succeeded and map_address is at wished address, exit loop.
break;
}
if (map_address != (address) MAP_FAILED) {
! // Map succeeded, but polling_page is not at wished address, unmap and continue.
::munmap(map_address, map_size);
map_address = (address) MAP_FAILED;
}
// map failed, continue loop.
}
*** 3798,3808 ****
return JNI_ERR;
}
// Make the stack size a multiple of the page size so that
// the yellow/red zones can be guarded.
! // note that this can be 0, if no default stacksize was set
JavaThread::set_stack_size_at_create(round_to(threadStackSizeInBytes, vm_page_size()));
Aix::libpthread_init();
if (MaxFDLimit) {
--- 3803,3813 ----
return JNI_ERR;
}
// Make the stack size a multiple of the page size so that
// the yellow/red zones can be guarded.
! // Note that this can be 0, if no default stacksize was set.
JavaThread::set_stack_size_at_create(round_to(threadStackSizeInBytes, vm_page_size()));
Aix::libpthread_init();
if (MaxFDLimit) {
*** 4089,4099 ****
#endif
return fd;
}
-
// create binary file, rewriting existing file if required
int os::create_binary_file(const char* path, bool rewrite_existing) {
int oflags = O_WRONLY | O_CREAT;
if (!rewrite_existing) {
oflags |= O_EXCL;
--- 4094,4103 ----
*** 4149,4159 ****
bool allow_exec) {
Unimplemented();
return NULL;
}
-
// Remap a block of memory.
char* os::pd_remap_memory(int fd, const char* file_name, size_t file_offset,
char *addr, size_t bytes, bool read_only,
bool allow_exec) {
// same as map_memory() on this OS
--- 4153,4162 ----
*** 4197,4214 ****
bool error = false;
jlong sys_time = 0;
jlong user_time = 0;
! // reimplemented using getthrds64().
//
! // goes like this:
// For the thread in question, get the kernel thread id. Then get the
// kernel thread statistics using that id.
//
// This only works of course when no pthread scheduling is used,
! // ie there is a 1:1 relationship to kernel threads.
// On AIX, see AIXTHREAD_SCOPE variable.
pthread_t pthtid = thread->osthread()->pthread_id();
// retrieve kernel thread id for the pthread:
--- 4200,4217 ----
bool error = false;
jlong sys_time = 0;
jlong user_time = 0;
! // Reimplemented using getthrds64().
//
! // Works like this:
// For the thread in question, get the kernel thread id. Then get the
// kernel thread statistics using that id.
//
// This only works of course when no pthread scheduling is used,
! // i.e. there is a 1:1 relationship to kernel threads.
// On AIX, see AIXTHREAD_SCOPE variable.
pthread_t pthtid = thread->osthread()->pthread_id();
// retrieve kernel thread id for the pthread:
*** 4351,4368 ****
struct utsname uts;
memset(&uts, 0, sizeof(uts));
strcpy(uts.sysname, "?");
if (::uname(&uts) == -1) {
! fprintf(stderr, "uname failed (%d)\n", errno);
guarantee(0, "Could not determine whether we run on AIX or PASE");
} else {
! if (Verbose) {
! fprintf(stderr,"uname says: sysname \"%s\" version \"%s\" release \"%s\" "
"node \"%s\" machine \"%s\"\n",
uts.sysname, uts.version, uts.release, uts.nodename, uts.machine);
- }
const int major = atoi(uts.version);
assert(major > 0, "invalid OS version");
const int minor = atoi(uts.release);
assert(minor > 0, "invalid OS release");
_os_version = (major << 8) | minor;
--- 4354,4369 ----
struct utsname uts;
memset(&uts, 0, sizeof(uts));
strcpy(uts.sysname, "?");
if (::uname(&uts) == -1) {
! trc("uname failed (%d)", errno);
guarantee(0, "Could not determine whether we run on AIX or PASE");
} else {
! trcVerbose("uname says: sysname \"%s\" version \"%s\" release \"%s\" "
"node \"%s\" machine \"%s\"\n",
uts.sysname, uts.version, uts.release, uts.nodename, uts.machine);
const int major = atoi(uts.version);
assert(major > 0, "invalid OS version");
const int minor = atoi(uts.release);
assert(minor > 0, "invalid OS release");
_os_version = (major << 8) | minor;
*** 4370,4393 ****
Unimplemented();
} else if (strcmp(uts.sysname, "AIX") == 0) {
// We run on AIX. We do not support versions older than AIX 5.3.
_on_pase = 0;
if (_os_version < 0x0503) {
! fprintf(stderr, "AIX release older than AIX 5.3 not supported.\n");
assert(false, "AIX release too old.");
} else {
! if (Verbose) {
! fprintf(stderr, "We run on AIX %d.%d\n", major, minor);
! }
}
} else {
assert(false, "unknown OS");
}
}
guarantee(_on_pase != -1 && _os_version, "Could not determine AIX/OS400 release");
-
} // end: os::Aix::initialize_os_info()
// Scan environment for important settings which might effect the VM.
// Trace out settings. Warn about invalid settings and/or correct them.
//
--- 4371,4391 ----
Unimplemented();
} else if (strcmp(uts.sysname, "AIX") == 0) {
// We run on AIX. We do not support versions older than AIX 5.3.
_on_pase = 0;
if (_os_version < 0x0503) {
! trc("AIX release older than AIX 5.3 not supported.");
assert(false, "AIX release too old.");
} else {
! trcVerbose("We run on AIX %d.%d\n", major, minor);
}
} else {
assert(false, "unknown OS");
}
}
guarantee(_on_pase != -1 && _os_version, "Could not determine AIX/OS400 release");
} // end: os::Aix::initialize_os_info()
// Scan environment for important settings which might effect the VM.
// Trace out settings. Warn about invalid settings and/or correct them.
//
*** 4421,4436 ****
// get useful return codes for mprotect.
//
// Note: Setting XPG_SUS_ENV in the process is too late. Must be set earlier (before
// exec() ? before loading the libjvm ? ....)
p = ::getenv("XPG_SUS_ENV");
! if (Verbose) {
! fprintf(stderr, "XPG_SUS_ENV=%s.\n", p ? p : "<unset>");
! }
if (p && strcmp(p, "ON") == 0) {
_xpg_sus_mode = 1;
! fprintf(stderr, "Unsupported setting: XPG_SUS_ENV=ON\n");
// This is not supported. Worst of all, it changes behaviour of mmap MAP_FIXED to
// clobber address ranges. If we ever want to support that, we have to do some
// testing first.
guarantee(false, "XPG_SUS_ENV=ON not supported");
} else {
--- 4419,4432 ----
// get useful return codes for mprotect.
//
// Note: Setting XPG_SUS_ENV in the process is too late. Must be set earlier (before
// exec() ? before loading the libjvm ? ....)
p = ::getenv("XPG_SUS_ENV");
! trcVerbose("XPG_SUS_ENV=%s.", p ? p : "<unset>");
if (p && strcmp(p, "ON") == 0) {
_xpg_sus_mode = 1;
! trc("Unsupported setting: XPG_SUS_ENV=ON");
// This is not supported. Worst of all, it changes behaviour of mmap MAP_FIXED to
// clobber address ranges. If we ever want to support that, we have to do some
// testing first.
guarantee(false, "XPG_SUS_ENV=ON not supported");
} else {
*** 4438,4451 ****
}
// Switch off AIX internal (pthread) guard pages. This has
// immediate effect for any pthread_create calls which follow.
p = ::getenv("AIXTHREAD_GUARDPAGES");
! if (Verbose) {
! fprintf(stderr, "AIXTHREAD_GUARDPAGES=%s.\n", p ? p : "<unset>");
! fprintf(stderr, "setting AIXTHREAD_GUARDPAGES=0.\n");
! }
rc = ::putenv("AIXTHREAD_GUARDPAGES=0");
guarantee(rc == 0, "");
} // end: os::Aix::scan_environment()
--- 4434,4444 ----
}
// Switch off AIX internal (pthread) guard pages. This has
// immediate effect for any pthread_create calls which follow.
p = ::getenv("AIXTHREAD_GUARDPAGES");
! trcVerbose("AIXTHREAD_GUARDPAGES=%s.", p ? p : "<unset>");
rc = ::putenv("AIXTHREAD_GUARDPAGES=0");
guarantee(rc == 0, "");
} // end: os::Aix::scan_environment()
*** 4459,4469 ****
void os::Aix::initialize_libperfstat() {
assert(os::Aix::on_aix(), "AIX only");
if (!libperfstat::init()) {
! fprintf(stderr, "libperfstat initialization failed.\n");
assert(false, "libperfstat initialization failed");
} else {
if (Verbose) {
fprintf(stderr, "libperfstat initialized.\n");
}
--- 4452,4462 ----
void os::Aix::initialize_libperfstat() {
assert(os::Aix::on_aix(), "AIX only");
if (!libperfstat::init()) {
! trc("libperfstat initialization failed.");
assert(false, "libperfstat initialization failed");
} else {
if (Verbose) {
fprintf(stderr, "libperfstat initialized.\n");
}
*** 4631,4641 ****
}
abstime->tv_nsec = usec * 1000;
return abstime;
}
-
// Test-and-clear _Event, always leaves _Event set to 0, returns immediately.
// Conceptually TryPark() should be equivalent to park(0).
int os::PlatformEvent::TryPark() {
for (;;) {
--- 4624,4633 ----
*** 4870,4880 ****
}
if (time > 0) {
unpackTime(&absTime, isAbsolute, time);
}
-
// Enter safepoint region
// Beware of deadlocks such as 6317397.
// The per-thread Parker:: mutex is a classic leaf-lock.
// In particular a thread must never block on the Threads_lock while
// holding the Parker:: mutex. If safepoints are pending both the
--- 4862,4871 ----
*** 4958,4968 ****
pthread_mutex_unlock(_mutex);
assert (status == 0, "invariant");
}
}
-
extern char** environ;
// Run the specified command in a separate process. Return its exit value,
// or -1 on failure (e.g. can't fork a new process).
// Unlike system(), this function can be called from signal handler. It
--- 4949,4958 ----
*** 4977,4987 ****
return -1;
} else if (pid == 0) {
// child process
! // try to be consistent with system(), which uses "/usr/bin/sh" on AIX
execve("/usr/bin/sh", argv, environ);
// execve failed
_exit(-1);
--- 4967,4977 ----
return -1;
} else if (pid == 0) {
// child process
! // Try to be consistent with system(), which uses "/usr/bin/sh" on AIX.
execve("/usr/bin/sh", argv, environ);
// execve failed
_exit(-1);
*** 5003,5024 ****
if (WIFEXITED(status)) {
// The child exited normally; get its exit code.
return WEXITSTATUS(status);
} else if (WIFSIGNALED(status)) {
! // The child exited because of a signal
// The best value to return is 0x80 + signal number,
// because that is what all Unix shells do, and because
// it allows callers to distinguish between process exit and
// process death by signal.
return 0x80 + WTERMSIG(status);
} else {
! // Unknown exit code; pass it through
return status;
}
}
- // Remove warning.
return -1;
}
// is_headless_jre()
//
--- 4993,5013 ----
if (WIFEXITED(status)) {
// The child exited normally; get its exit code.
return WEXITSTATUS(status);
} else if (WIFSIGNALED(status)) {
! // The child exited because of a signal.
// The best value to return is 0x80 + signal number,
// because that is what all Unix shells do, and because
// it allows callers to distinguish between process exit and
// process death by signal.
return 0x80 + WTERMSIG(status);
} else {
! // Unknown exit code; pass it through.
return status;
}
}
return -1;
}
// is_headless_jre()
//
< prev index next >