Mercurial > hg > truffle
diff src/os/linux/vm/os_linux.cpp @ 8124:5fc51c1ecdeb
Merge.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Tue, 05 Mar 2013 23:44:54 +0100 |
parents | 3ac7d10a6572 4c1d8002ffb1 |
children | b8f261ba79c6 |
line wrap: on
line diff
--- a/src/os/linux/vm/os_linux.cpp Tue Mar 05 21:58:51 2013 +0100 +++ b/src/os/linux/vm/os_linux.cpp Tue Mar 05 23:44:54 2013 +0100 @@ -1155,13 +1155,9 @@ // for initial thread if its stack size exceeds 6M. Cap it at 2M, // in case other parts in glibc still assumes 2M max stack size. // FIXME: alt signal stack is gone, maybe we can relax this constraint? -#ifndef IA64 - if (stack_size > 2 * K * K) stack_size = 2 * K * K; -#else // Problem still exists RH7.2 (IA64 anyway) but 2MB is a little small - if (stack_size > 4 * K * K) stack_size = 4 * K * K; -#endif - + if (stack_size > 2 * K * K IA64_ONLY(*2)) + stack_size = 2 * K * K IA64_ONLY(*2); // Try to figure out where the stack base (top) is. This is harder. // // When an application is started, glibc saves the initial stack pointer in @@ -3657,14 +3653,9 @@ void signalHandler(int sig, siginfo_t* info, void* uc) { assert(info != NULL && uc != NULL, "it must be old kernel"); - ResourceMark rm; - if (TraceSignals) { - tty->print_cr(err_msg("signal received: code=%d errno=%d signo=%d thread=%s address=%x", info->si_code, info->si_errno, info->si_signo, Thread::current()->name(), info->si_addr)); - } + int orig_errno = errno; // Preserve errno value over signal handler. JVM_handle_linux_signal(sig, info, uc, true); - if (TraceSignals) { - tty->print_cr("signal handled"); - } + errno = orig_errno; } @@ -4374,16 +4365,12 @@ if (is_NPTL()) { return pthread_cond_timedwait(_cond, _mutex, _abstime); } else { -#ifndef IA64 // 6292965: LinuxThreads pthread_cond_timedwait() resets FPU control // word back to default 64bit precision if condvar is signaled. Java // wants 53bit precision. Save and restore current value. int fpu = get_fpu_control_word(); -#endif // IA64 int status = pthread_cond_timedwait(_cond, _mutex, _abstime); -#ifndef IA64 set_fpu_control_word(fpu); -#endif // IA64 return status; } } @@ -4756,49 +4743,26 @@ // static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) { - static bool proc_pid_cpu_avail = true; static bool proc_task_unchecked = true; static const char *proc_stat_path = "/proc/%d/stat"; pid_t tid = thread->osthread()->thread_id(); - int i; char *s; char stat[2048]; int statlen; char proc_name[64]; int count; long sys_time, user_time; - char string[64]; char cdummy; int idummy; long ldummy; FILE *fp; - // We first try accessing /proc/<pid>/cpu since this is faster to - // process. If this file is not present (linux kernels 2.5 and above) - // then we open /proc/<pid>/stat. - if ( proc_pid_cpu_avail ) { - sprintf(proc_name, "/proc/%d/cpu", tid); - fp = fopen(proc_name, "r"); - if ( fp != NULL ) { - count = fscanf( fp, "%s %lu %lu\n", string, &user_time, &sys_time); - fclose(fp); - if ( count != 3 ) return -1; - - if (user_sys_cpu_time) { - return ((jlong)sys_time + (jlong)user_time) * (1000000000 / clock_tics_per_sec); - } else { - return (jlong)user_time * (1000000000 / clock_tics_per_sec); - } - } - else proc_pid_cpu_avail = false; - } - // The /proc/<tid>/stat aggregates per-process usage on // new Linux kernels 2.6+ where NPTL is supported. // The /proc/self/task/<tid>/stat still has the per-thread usage. // See bug 6328462. - // There can be no directory /proc/self/task on kernels 2.4 with NPTL - // and possibly in some other cases, so we check its availability. + // There possibly can be cases where there is no directory + // /proc/self/task, so we check its availability. if (proc_task_unchecked && os::Linux::is_NPTL()) { // This is executed only once proc_task_unchecked = false; @@ -4823,7 +4787,6 @@ // We don't really need to know the command string, just find the last // occurrence of ")" and then start parsing from there. See bug 4726580. s = strrchr(stat, ')'); - i = 0; if (s == NULL ) return -1; // Skip blank chars