Fri, 01 Mar 2013 15:59:10 -0800
Merge
1.1 --- a/agent/src/os/linux/LinuxDebuggerLocal.c Fri Mar 01 04:58:31 2013 -0800 1.2 +++ b/agent/src/os/linux/LinuxDebuggerLocal.c Fri Mar 01 15:59:10 2013 -0800 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -25,6 +25,13 @@ 1.11 #include <jni.h> 1.12 #include "libproc.h" 1.13 1.14 +#include <elf.h> 1.15 +#include <sys/types.h> 1.16 +#include <sys/stat.h> 1.17 +#include <fcntl.h> 1.18 +#include <string.h> 1.19 +#include <limits.h> 1.20 + 1.21 #if defined(x86_64) && !defined(amd64) 1.22 #define amd64 1 1.23 #endif 1.24 @@ -154,6 +161,39 @@ 1.25 } 1.26 } 1.27 1.28 + 1.29 +/* 1.30 + * Verify that a named ELF binary file (core or executable) has the same 1.31 + * bitness as ourselves. 1.32 + * Throw an exception if there is a mismatch or other problem. 1.33 + * 1.34 + * If we proceed using a mismatched debugger/debuggee, the best to hope 1.35 + * for is a missing symbol, the worst is a crash searching for debug symbols. 1.36 + */ 1.37 +void verifyBitness(JNIEnv *env, const char *binaryName) { 1.38 + int fd = open(binaryName, O_RDONLY); 1.39 + if (fd < 0) { 1.40 + THROW_NEW_DEBUGGER_EXCEPTION("cannot open binary file"); 1.41 + } 1.42 + unsigned char elf_ident[EI_NIDENT]; 1.43 + int i = read(fd, &elf_ident, sizeof(elf_ident)); 1.44 + close(fd); 1.45 + 1.46 + if (i < 0) { 1.47 + THROW_NEW_DEBUGGER_EXCEPTION("cannot read binary file"); 1.48 + } 1.49 +#ifndef _LP64 1.50 + if (elf_ident[EI_CLASS] == ELFCLASS64) { 1.51 + THROW_NEW_DEBUGGER_EXCEPTION("debuggee is 64 bit, use 64-bit java for debugger"); 1.52 + } 1.53 +#else 1.54 + if (elf_ident[EI_CLASS] != ELFCLASS64) { 1.55 + THROW_NEW_DEBUGGER_EXCEPTION("debuggee is 32 bit, use 32 bit java for debugger"); 1.56 + } 1.57 +#endif 1.58 +} 1.59 + 1.60 + 1.61 /* 1.62 * Class: sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal 1.63 * Method: attach0 1.64 @@ -162,6 +202,12 @@ 1.65 JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_linux_LinuxDebuggerLocal_attach0__I 1.66 (JNIEnv *env, jobject this_obj, jint jpid) { 1.67 1.68 + // For bitness checking, locate binary at /proc/jpid/exe 1.69 + char buf[PATH_MAX]; 1.70 + snprintf((char *) &buf, PATH_MAX, "/proc/%d/exe", jpid); 1.71 + verifyBitness(env, (char *) &buf); 1.72 + CHECK_EXCEPTION; 1.73 + 1.74 struct ps_prochandle* ph; 1.75 if ( (ph = Pgrab(jpid)) == NULL) { 1.76 THROW_NEW_DEBUGGER_EXCEPTION("Can't attach to the process"); 1.77 @@ -187,6 +233,9 @@ 1.78 coreName_cstr = (*env)->GetStringUTFChars(env, coreName, &isCopy); 1.79 CHECK_EXCEPTION; 1.80 1.81 + verifyBitness(env, execName_cstr); 1.82 + CHECK_EXCEPTION; 1.83 + 1.84 if ( (ph = Pgrab_core(execName_cstr, coreName_cstr)) == NULL) { 1.85 (*env)->ReleaseStringUTFChars(env, execName, execName_cstr); 1.86 (*env)->ReleaseStringUTFChars(env, coreName, coreName_cstr);
2.1 --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java Fri Mar 01 04:58:31 2013 -0800 2.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java Fri Mar 01 15:59:10 2013 -0800 2.3 @@ -60,8 +60,13 @@ 2.4 return null; 2.5 } 2.6 2.7 + // Check alignment of rbp 2.8 + if ( dbg.getAddressValue(rbp) % ADDRESS_SIZE != 0) { 2.9 + return null; 2.10 + } 2.11 + 2.12 Address nextRBP = rbp.getAddressAt( 0 * ADDRESS_SIZE); 2.13 - if (nextRBP == null) { 2.14 + if (nextRBP == null || nextRBP.lessThanOrEqual(rbp)) { 2.15 return null; 2.16 } 2.17 Address nextPC = rbp.getAddressAt( 1 * ADDRESS_SIZE);
3.1 --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/x86/LinuxX86CFrame.java Fri Mar 01 04:58:31 2013 -0800 3.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/x86/LinuxX86CFrame.java Fri Mar 01 15:59:10 2013 -0800 3.3 @@ -61,8 +61,13 @@ 3.4 return null; 3.5 } 3.6 3.7 + // Check alignment of ebp 3.8 + if ( dbg.getAddressValue(ebp) % ADDRESS_SIZE != 0) { 3.9 + return null; 3.10 + } 3.11 + 3.12 Address nextEBP = ebp.getAddressAt( 0 * ADDRESS_SIZE); 3.13 - if (nextEBP == null) { 3.14 + if (nextEBP == null || nextEBP.lessThanOrEqual(ebp)) { 3.15 return null; 3.16 } 3.17 Address nextPC = ebp.getAddressAt( 1 * ADDRESS_SIZE);
4.1 --- a/src/os/bsd/vm/os_bsd.cpp Fri Mar 01 04:58:31 2013 -0800 4.2 +++ b/src/os/bsd/vm/os_bsd.cpp Fri Mar 01 15:59:10 2013 -0800 4.3 @@ -2695,7 +2695,7 @@ 4.4 assert(thread->is_VM_thread(), "Must be VMThread"); 4.5 // read current suspend action 4.6 int action = osthread->sr.suspend_action(); 4.7 - if (action == SR_SUSPEND) { 4.8 + if (action == os::Bsd::SuspendResume::SR_SUSPEND) { 4.9 suspend_save_context(osthread, siginfo, context); 4.10 4.11 // Notify the suspend action is about to be completed. do_suspend() 4.12 @@ -2717,12 +2717,12 @@ 4.13 do { 4.14 sigsuspend(&suspend_set); 4.15 // ignore all returns until we get a resume signal 4.16 - } while (osthread->sr.suspend_action() != SR_CONTINUE); 4.17 + } while (osthread->sr.suspend_action() != os::Bsd::SuspendResume::SR_CONTINUE); 4.18 4.19 resume_clear_context(osthread); 4.20 4.21 } else { 4.22 - assert(action == SR_CONTINUE, "unexpected sr action"); 4.23 + assert(action == os::Bsd::SuspendResume::SR_CONTINUE, "unexpected sr action"); 4.24 // nothing special to do - just leave the handler 4.25 } 4.26 4.27 @@ -2776,7 +2776,7 @@ 4.28 // but this seems the normal response to library errors 4.29 static bool do_suspend(OSThread* osthread) { 4.30 // mark as suspended and send signal 4.31 - osthread->sr.set_suspend_action(SR_SUSPEND); 4.32 + osthread->sr.set_suspend_action(os::Bsd::SuspendResume::SR_SUSPEND); 4.33 int status = pthread_kill(osthread->pthread_id(), SR_signum); 4.34 assert_status(status == 0, status, "pthread_kill"); 4.35 4.36 @@ -2785,18 +2785,18 @@ 4.37 for (int i = 0; !osthread->sr.is_suspended(); i++) { 4.38 os::yield_all(i); 4.39 } 4.40 - osthread->sr.set_suspend_action(SR_NONE); 4.41 + osthread->sr.set_suspend_action(os::Bsd::SuspendResume::SR_NONE); 4.42 return true; 4.43 } 4.44 else { 4.45 - osthread->sr.set_suspend_action(SR_NONE); 4.46 + osthread->sr.set_suspend_action(os::Bsd::SuspendResume::SR_NONE); 4.47 return false; 4.48 } 4.49 } 4.50 4.51 static void do_resume(OSThread* osthread) { 4.52 assert(osthread->sr.is_suspended(), "thread should be suspended"); 4.53 - osthread->sr.set_suspend_action(SR_CONTINUE); 4.54 + osthread->sr.set_suspend_action(os::Bsd::SuspendResume::SR_CONTINUE); 4.55 4.56 int status = pthread_kill(osthread->pthread_id(), SR_signum); 4.57 assert_status(status == 0, status, "pthread_kill"); 4.58 @@ -2806,7 +2806,7 @@ 4.59 os::yield_all(i); 4.60 } 4.61 } 4.62 - osthread->sr.set_suspend_action(SR_NONE); 4.63 + osthread->sr.set_suspend_action(os::Bsd::SuspendResume::SR_NONE); 4.64 } 4.65 4.66 ////////////////////////////////////////////////////////////////////////////////
5.1 --- a/src/os/bsd/vm/os_bsd.hpp Fri Mar 01 04:58:31 2013 -0800 5.2 +++ b/src/os/bsd/vm/os_bsd.hpp Fri Mar 01 15:59:10 2013 -0800 5.3 @@ -1,5 +1,5 @@ 5.4 /* 5.5 - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 5.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 5.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.8 * 5.9 * This code is free software; you can redistribute it and/or modify it 5.10 @@ -151,36 +151,25 @@ 5.11 // for BsdThreads are no longer needed. 5.12 class SuspendResume { 5.13 private: 5.14 - volatile int _suspend_action; 5.15 + volatile int _suspend_action; 5.16 + volatile jint _state; 5.17 + public: 5.18 // values for suspend_action: 5.19 - #define SR_NONE (0x00) 5.20 - #define SR_SUSPEND (0x01) // suspend request 5.21 - #define SR_CONTINUE (0x02) // resume request 5.22 + enum { 5.23 + SR_NONE = 0x00, 5.24 + SR_SUSPEND = 0x01, // suspend request 5.25 + SR_CONTINUE = 0x02, // resume request 5.26 + SR_SUSPENDED = 0x20 // values for _state: + SR_NONE 5.27 + }; 5.28 5.29 - volatile jint _state; 5.30 - // values for _state: + SR_NONE 5.31 - #define SR_SUSPENDED (0x20) 5.32 - public: 5.33 SuspendResume() { _suspend_action = SR_NONE; _state = SR_NONE; } 5.34 5.35 int suspend_action() const { return _suspend_action; } 5.36 void set_suspend_action(int x) { _suspend_action = x; } 5.37 5.38 // atomic updates for _state 5.39 - void set_suspended() { 5.40 - jint temp, temp2; 5.41 - do { 5.42 - temp = _state; 5.43 - temp2 = Atomic::cmpxchg(temp | SR_SUSPENDED, &_state, temp); 5.44 - } while (temp2 != temp); 5.45 - } 5.46 - void clear_suspended() { 5.47 - jint temp, temp2; 5.48 - do { 5.49 - temp = _state; 5.50 - temp2 = Atomic::cmpxchg(temp & ~SR_SUSPENDED, &_state, temp); 5.51 - } while (temp2 != temp); 5.52 - } 5.53 + inline void set_suspended(); 5.54 + inline void clear_suspended(); 5.55 bool is_suspended() { return _state & SR_SUSPENDED; } 5.56 5.57 #undef SR_SUSPENDED
6.1 --- a/src/os/bsd/vm/os_bsd.inline.hpp Fri Mar 01 04:58:31 2013 -0800 6.2 +++ b/src/os/bsd/vm/os_bsd.inline.hpp Fri Mar 01 15:59:10 2013 -0800 6.3 @@ -25,7 +25,6 @@ 6.4 #ifndef OS_BSD_VM_OS_BSD_INLINE_HPP 6.5 #define OS_BSD_VM_OS_BSD_INLINE_HPP 6.6 6.7 -#include "runtime/atomic.hpp" 6.8 #include "runtime/atomic.inline.hpp" 6.9 #include "runtime/os.hpp" 6.10 6.11 @@ -286,4 +285,21 @@ 6.12 const char* optval, socklen_t optlen) { 6.13 return ::setsockopt(fd, level, optname, optval, optlen); 6.14 } 6.15 + 6.16 +inline void os::Bsd::SuspendResume::set_suspended() { 6.17 + jint temp, temp2; 6.18 + do { 6.19 + temp = _state; 6.20 + temp2 = Atomic::cmpxchg(temp | SR_SUSPENDED, &_state, temp); 6.21 + } while (temp2 != temp); 6.22 +} 6.23 + 6.24 +inline void os::Bsd::SuspendResume::clear_suspended() { 6.25 + jint temp, temp2; 6.26 + do { 6.27 + temp = _state; 6.28 + temp2 = Atomic::cmpxchg(temp & ~SR_SUSPENDED, &_state, temp); 6.29 + } while (temp2 != temp); 6.30 +} 6.31 + 6.32 #endif // OS_BSD_VM_OS_BSD_INLINE_HPP
7.1 --- a/src/os/linux/vm/os_linux.cpp Fri Mar 01 04:58:31 2013 -0800 7.2 +++ b/src/os/linux/vm/os_linux.cpp Fri Mar 01 15:59:10 2013 -0800 7.3 @@ -3461,7 +3461,7 @@ 7.4 assert(thread->is_VM_thread(), "Must be VMThread"); 7.5 // read current suspend action 7.6 int action = osthread->sr.suspend_action(); 7.7 - if (action == SR_SUSPEND) { 7.8 + if (action == os::Linux::SuspendResume::SR_SUSPEND) { 7.9 suspend_save_context(osthread, siginfo, context); 7.10 7.11 // Notify the suspend action is about to be completed. do_suspend() 7.12 @@ -3483,12 +3483,12 @@ 7.13 do { 7.14 sigsuspend(&suspend_set); 7.15 // ignore all returns until we get a resume signal 7.16 - } while (osthread->sr.suspend_action() != SR_CONTINUE); 7.17 + } while (osthread->sr.suspend_action() != os::Linux::SuspendResume::SR_CONTINUE); 7.18 7.19 resume_clear_context(osthread); 7.20 7.21 } else { 7.22 - assert(action == SR_CONTINUE, "unexpected sr action"); 7.23 + assert(action == os::Linux::SuspendResume::SR_CONTINUE, "unexpected sr action"); 7.24 // nothing special to do - just leave the handler 7.25 } 7.26 7.27 @@ -3542,7 +3542,7 @@ 7.28 // but this seems the normal response to library errors 7.29 static bool do_suspend(OSThread* osthread) { 7.30 // mark as suspended and send signal 7.31 - osthread->sr.set_suspend_action(SR_SUSPEND); 7.32 + osthread->sr.set_suspend_action(os::Linux::SuspendResume::SR_SUSPEND); 7.33 int status = pthread_kill(osthread->pthread_id(), SR_signum); 7.34 assert_status(status == 0, status, "pthread_kill"); 7.35 7.36 @@ -3551,18 +3551,18 @@ 7.37 for (int i = 0; !osthread->sr.is_suspended(); i++) { 7.38 os::yield_all(i); 7.39 } 7.40 - osthread->sr.set_suspend_action(SR_NONE); 7.41 + osthread->sr.set_suspend_action(os::Linux::SuspendResume::SR_NONE); 7.42 return true; 7.43 } 7.44 else { 7.45 - osthread->sr.set_suspend_action(SR_NONE); 7.46 + osthread->sr.set_suspend_action(os::Linux::SuspendResume::SR_NONE); 7.47 return false; 7.48 } 7.49 } 7.50 7.51 static void do_resume(OSThread* osthread) { 7.52 assert(osthread->sr.is_suspended(), "thread should be suspended"); 7.53 - osthread->sr.set_suspend_action(SR_CONTINUE); 7.54 + osthread->sr.set_suspend_action(os::Linux::SuspendResume::SR_CONTINUE); 7.55 7.56 int status = pthread_kill(osthread->pthread_id(), SR_signum); 7.57 assert_status(status == 0, status, "pthread_kill"); 7.58 @@ -3572,7 +3572,7 @@ 7.59 os::yield_all(i); 7.60 } 7.61 } 7.62 - osthread->sr.set_suspend_action(SR_NONE); 7.63 + osthread->sr.set_suspend_action(os::Linux::SuspendResume::SR_NONE); 7.64 } 7.65 7.66 ////////////////////////////////////////////////////////////////////////////////
8.1 --- a/src/os/linux/vm/os_linux.hpp Fri Mar 01 04:58:31 2013 -0800 8.2 +++ b/src/os/linux/vm/os_linux.hpp Fri Mar 01 15:59:10 2013 -0800 8.3 @@ -1,5 +1,5 @@ 8.4 /* 8.5 - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 8.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 8.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.8 * 8.9 * This code is free software; you can redistribute it and/or modify it 8.10 @@ -209,39 +209,27 @@ 8.11 // for LinuxThreads are no longer needed. 8.12 class SuspendResume { 8.13 private: 8.14 - volatile int _suspend_action; 8.15 + volatile int _suspend_action; 8.16 + volatile jint _state; 8.17 + public: 8.18 // values for suspend_action: 8.19 - #define SR_NONE (0x00) 8.20 - #define SR_SUSPEND (0x01) // suspend request 8.21 - #define SR_CONTINUE (0x02) // resume request 8.22 + enum { 8.23 + SR_NONE = 0x00, 8.24 + SR_SUSPEND = 0x01, // suspend request 8.25 + SR_CONTINUE = 0x02, // resume request 8.26 + SR_SUSPENDED = 0x20 // values for _state: + SR_NONE 8.27 + }; 8.28 8.29 - volatile jint _state; 8.30 - // values for _state: + SR_NONE 8.31 - #define SR_SUSPENDED (0x20) 8.32 - public: 8.33 SuspendResume() { _suspend_action = SR_NONE; _state = SR_NONE; } 8.34 8.35 int suspend_action() const { return _suspend_action; } 8.36 void set_suspend_action(int x) { _suspend_action = x; } 8.37 8.38 // atomic updates for _state 8.39 - void set_suspended() { 8.40 - jint temp, temp2; 8.41 - do { 8.42 - temp = _state; 8.43 - temp2 = Atomic::cmpxchg(temp | SR_SUSPENDED, &_state, temp); 8.44 - } while (temp2 != temp); 8.45 - } 8.46 - void clear_suspended() { 8.47 - jint temp, temp2; 8.48 - do { 8.49 - temp = _state; 8.50 - temp2 = Atomic::cmpxchg(temp & ~SR_SUSPENDED, &_state, temp); 8.51 - } while (temp2 != temp); 8.52 - } 8.53 + inline void set_suspended(); 8.54 + inline void clear_suspended(); 8.55 bool is_suspended() { return _state & SR_SUSPENDED; } 8.56 8.57 - #undef SR_SUSPENDED 8.58 }; 8.59 8.60 private:
9.1 --- a/src/os/linux/vm/os_linux.inline.hpp Fri Mar 01 04:58:31 2013 -0800 9.2 +++ b/src/os/linux/vm/os_linux.inline.hpp Fri Mar 01 15:59:10 2013 -0800 9.3 @@ -25,7 +25,6 @@ 9.4 #ifndef OS_LINUX_VM_OS_LINUX_INLINE_HPP 9.5 #define OS_LINUX_VM_OS_LINUX_INLINE_HPP 9.6 9.7 -#include "runtime/atomic.hpp" 9.8 #include "runtime/atomic.inline.hpp" 9.9 #include "runtime/os.hpp" 9.10 9.11 @@ -288,4 +287,21 @@ 9.12 const char* optval, socklen_t optlen) { 9.13 return ::setsockopt(fd, level, optname, optval, optlen); 9.14 } 9.15 + 9.16 +inline void os::Linux::SuspendResume::set_suspended() { 9.17 + jint temp, temp2; 9.18 + do { 9.19 + temp = _state; 9.20 + temp2 = Atomic::cmpxchg(temp | SR_SUSPENDED, &_state, temp); 9.21 + } while (temp2 != temp); 9.22 +} 9.23 + 9.24 +inline void os::Linux::SuspendResume::clear_suspended() { 9.25 + jint temp, temp2; 9.26 + do { 9.27 + temp = _state; 9.28 + temp2 = Atomic::cmpxchg(temp & ~SR_SUSPENDED, &_state, temp); 9.29 + } while (temp2 != temp); 9.30 +} 9.31 + 9.32 #endif // OS_LINUX_VM_OS_LINUX_INLINE_HPP
10.1 --- a/src/os/solaris/vm/os_solaris.inline.hpp Fri Mar 01 04:58:31 2013 -0800 10.2 +++ b/src/os/solaris/vm/os_solaris.inline.hpp Fri Mar 01 15:59:10 2013 -0800 10.3 @@ -25,7 +25,6 @@ 10.4 #ifndef OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP 10.5 #define OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP 10.6 10.7 -#include "runtime/atomic.hpp" 10.8 #include "runtime/atomic.inline.hpp" 10.9 #include "runtime/os.hpp" 10.10
11.1 --- a/src/os/windows/vm/decoder_windows.cpp Fri Mar 01 04:58:31 2013 -0800 11.2 +++ b/src/os/windows/vm/decoder_windows.cpp Fri Mar 01 15:59:10 2013 -0800 11.3 @@ -1,5 +1,5 @@ 11.4 /* 11.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 11.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 11.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 11.8 * 11.9 * This code is free software; you can redistribute it and/or modify it 11.10 @@ -24,6 +24,7 @@ 11.11 11.12 #include "precompiled.hpp" 11.13 #include "prims/jvm.h" 11.14 +#include "runtime/arguments.hpp" 11.15 #include "decoder_windows.hpp" 11.16 11.17 WindowsDecoder::WindowsDecoder() {
12.1 --- a/src/os/windows/vm/os_windows.inline.hpp Fri Mar 01 04:58:31 2013 -0800 12.2 +++ b/src/os/windows/vm/os_windows.inline.hpp Fri Mar 01 15:59:10 2013 -0800 12.3 @@ -25,7 +25,6 @@ 12.4 #ifndef OS_WINDOWS_VM_OS_WINDOWS_INLINE_HPP 12.5 #define OS_WINDOWS_VM_OS_WINDOWS_INLINE_HPP 12.6 12.7 -#include "runtime/atomic.hpp" 12.8 #include "runtime/atomic.inline.hpp" 12.9 #include "runtime/os.hpp" 12.10
13.1 --- a/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp Fri Mar 01 04:58:31 2013 -0800 13.2 +++ b/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp Fri Mar 01 15:59:10 2013 -0800 13.3 @@ -1,5 +1,5 @@ 13.4 /* 13.5 - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 13.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 13.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 13.8 * 13.9 * This code is free software; you can redistribute it and/or modify it 13.10 @@ -25,7 +25,6 @@ 13.11 #ifndef OS_CPU_BSD_X86_VM_ATOMIC_BSD_X86_INLINE_HPP 13.12 #define OS_CPU_BSD_X86_VM_ATOMIC_BSD_X86_INLINE_HPP 13.13 13.14 -#include "orderAccess_bsd_x86.inline.hpp" 13.15 #include "runtime/atomic.hpp" 13.16 #include "runtime/os.hpp" 13.17 #include "vm_version_x86.hpp"
14.1 --- a/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp Fri Mar 01 04:58:31 2013 -0800 14.2 +++ b/src/os_cpu/bsd_x86/vm/orderAccess_bsd_x86.inline.hpp Fri Mar 01 15:59:10 2013 -0800 14.3 @@ -1,5 +1,5 @@ 14.4 /* 14.5 - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 14.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 14.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 14.8 * 14.9 * This code is free software; you can redistribute it and/or modify it 14.10 @@ -25,8 +25,9 @@ 14.11 #ifndef OS_CPU_BSD_X86_VM_ORDERACCESS_BSD_X86_INLINE_HPP 14.12 #define OS_CPU_BSD_X86_VM_ORDERACCESS_BSD_X86_INLINE_HPP 14.13 14.14 -#include "runtime/atomic.hpp" 14.15 +#include "runtime/atomic.inline.hpp" 14.16 #include "runtime/orderAccess.hpp" 14.17 +#include "runtime/os.hpp" 14.18 #include "vm_version_x86.hpp" 14.19 14.20 // Implementation of class OrderAccess.
15.1 --- a/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp Fri Mar 01 04:58:31 2013 -0800 15.2 +++ b/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.inline.hpp Fri Mar 01 15:59:10 2013 -0800 15.3 @@ -1,5 +1,5 @@ 15.4 /* 15.5 - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 15.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 15.7 * Copyright 2007, 2008, 2011 Red Hat, Inc. 15.8 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 15.9 * 15.10 @@ -26,7 +26,6 @@ 15.11 #ifndef OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_INLINE_HPP 15.12 #define OS_CPU_BSD_ZERO_VM_ATOMIC_BSD_ZERO_INLINE_HPP 15.13 15.14 -#include "orderAccess_bsd_zero.inline.hpp" 15.15 #include "runtime/atomic.hpp" 15.16 #include "runtime/os.hpp" 15.17 #include "vm_version_zero.hpp"
16.1 --- a/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp Fri Mar 01 04:58:31 2013 -0800 16.2 +++ b/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.inline.hpp Fri Mar 01 15:59:10 2013 -0800 16.3 @@ -1,5 +1,5 @@ 16.4 /* 16.5 - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 16.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 16.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.8 * 16.9 * This code is free software; you can redistribute it and/or modify it 16.10 @@ -25,7 +25,6 @@ 16.11 #ifndef OS_CPU_LINUX_SPARC_VM_ATOMIC_LINUX_SPARC_INLINE_HPP 16.12 #define OS_CPU_LINUX_SPARC_VM_ATOMIC_LINUX_SPARC_INLINE_HPP 16.13 16.14 -#include "orderAccess_linux_sparc.inline.hpp" 16.15 #include "runtime/atomic.hpp" 16.16 #include "runtime/os.hpp" 16.17 #include "vm_version_sparc.hpp"
17.1 --- a/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp Fri Mar 01 04:58:31 2013 -0800 17.2 +++ b/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp Fri Mar 01 15:59:10 2013 -0800 17.3 @@ -1,5 +1,5 @@ 17.4 /* 17.5 - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 17.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 17.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 17.8 * 17.9 * This code is free software; you can redistribute it and/or modify it 17.10 @@ -25,7 +25,6 @@ 17.11 #ifndef OS_CPU_LINUX_X86_VM_ATOMIC_LINUX_X86_INLINE_HPP 17.12 #define OS_CPU_LINUX_X86_VM_ATOMIC_LINUX_X86_INLINE_HPP 17.13 17.14 -#include "orderAccess_linux_x86.inline.hpp" 17.15 #include "runtime/atomic.hpp" 17.16 #include "runtime/os.hpp" 17.17 #include "vm_version_x86.hpp"
18.1 --- a/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp Fri Mar 01 04:58:31 2013 -0800 18.2 +++ b/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp Fri Mar 01 15:59:10 2013 -0800 18.3 @@ -1,5 +1,5 @@ 18.4 /* 18.5 - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 18.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 18.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.8 * 18.9 * This code is free software; you can redistribute it and/or modify it 18.10 @@ -25,8 +25,9 @@ 18.11 #ifndef OS_CPU_LINUX_X86_VM_ORDERACCESS_LINUX_X86_INLINE_HPP 18.12 #define OS_CPU_LINUX_X86_VM_ORDERACCESS_LINUX_X86_INLINE_HPP 18.13 18.14 -#include "runtime/atomic.hpp" 18.15 +#include "runtime/atomic.inline.hpp" 18.16 #include "runtime/orderAccess.hpp" 18.17 +#include "runtime/os.hpp" 18.18 #include "vm_version_x86.hpp" 18.19 18.20 // Implementation of class OrderAccess.
19.1 --- a/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp Fri Mar 01 04:58:31 2013 -0800 19.2 +++ b/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp Fri Mar 01 15:59:10 2013 -0800 19.3 @@ -1,5 +1,5 @@ 19.4 /* 19.5 - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 19.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 19.7 * Copyright 2007, 2008, 2011 Red Hat, Inc. 19.8 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 19.9 * 19.10 @@ -26,7 +26,6 @@ 19.11 #ifndef OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_INLINE_HPP 19.12 #define OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_INLINE_HPP 19.13 19.14 -#include "orderAccess_linux_zero.inline.hpp" 19.15 #include "runtime/atomic.hpp" 19.16 #include "runtime/os.hpp" 19.17 #include "vm_version_zero.hpp"
20.1 --- a/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp Fri Mar 01 04:58:31 2013 -0800 20.2 +++ b/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp Fri Mar 01 15:59:10 2013 -0800 20.3 @@ -1,5 +1,5 @@ 20.4 /* 20.5 - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 20.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 20.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 20.8 * 20.9 * This code is free software; you can redistribute it and/or modify it 20.10 @@ -25,7 +25,6 @@ 20.11 #ifndef OS_CPU_SOLARIS_SPARC_VM_ATOMIC_SOLARIS_SPARC_INLINE_HPP 20.12 #define OS_CPU_SOLARIS_SPARC_VM_ATOMIC_SOLARIS_SPARC_INLINE_HPP 20.13 20.14 -#include "orderAccess_solaris_sparc.inline.hpp" 20.15 #include "runtime/atomic.hpp" 20.16 #include "runtime/os.hpp" 20.17 #include "vm_version_sparc.hpp"
21.1 --- a/src/os_cpu/solaris_sparc/vm/orderAccess_solaris_sparc.inline.hpp Fri Mar 01 04:58:31 2013 -0800 21.2 +++ b/src/os_cpu/solaris_sparc/vm/orderAccess_solaris_sparc.inline.hpp Fri Mar 01 15:59:10 2013 -0800 21.3 @@ -1,5 +1,5 @@ 21.4 /* 21.5 - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 21.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 21.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 21.8 * 21.9 * This code is free software; you can redistribute it and/or modify it 21.10 @@ -25,6 +25,7 @@ 21.11 #ifndef OS_CPU_SOLARIS_SPARC_VM_ORDERACCESS_SOLARIS_SPARC_INLINE_HPP 21.12 #define OS_CPU_SOLARIS_SPARC_VM_ORDERACCESS_SOLARIS_SPARC_INLINE_HPP 21.13 21.14 +#include "runtime/atomic.inline.hpp" 21.15 #include "runtime/orderAccess.hpp" 21.16 #include "vm_version_sparc.hpp" 21.17
22.1 --- a/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp Fri Mar 01 04:58:31 2013 -0800 22.2 +++ b/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp Fri Mar 01 15:59:10 2013 -0800 22.3 @@ -1,5 +1,5 @@ 22.4 /* 22.5 - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 22.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 22.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 22.8 * 22.9 * This code is free software; you can redistribute it and/or modify it 22.10 @@ -25,7 +25,6 @@ 22.11 #ifndef OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_INLINE_HPP 22.12 #define OS_CPU_SOLARIS_X86_VM_ATOMIC_SOLARIS_X86_INLINE_HPP 22.13 22.14 -#include "orderAccess_solaris_x86.inline.hpp" 22.15 #include "runtime/atomic.hpp" 22.16 #include "runtime/os.hpp" 22.17 #include "vm_version_x86.hpp"
23.1 --- a/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp Fri Mar 01 04:58:31 2013 -0800 23.2 +++ b/src/os_cpu/solaris_x86/vm/orderAccess_solaris_x86.inline.hpp Fri Mar 01 15:59:10 2013 -0800 23.3 @@ -1,5 +1,5 @@ 23.4 /* 23.5 - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 23.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 23.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 23.8 * 23.9 * This code is free software; you can redistribute it and/or modify it 23.10 @@ -25,7 +25,7 @@ 23.11 #ifndef OS_CPU_SOLARIS_X86_VM_ORDERACCESS_SOLARIS_X86_INLINE_HPP 23.12 #define OS_CPU_SOLARIS_X86_VM_ORDERACCESS_SOLARIS_X86_INLINE_HPP 23.13 23.14 -#include "runtime/atomic.hpp" 23.15 +#include "runtime/atomic.inline.hpp" 23.16 #include "runtime/orderAccess.hpp" 23.17 #include "runtime/os.hpp" 23.18 #include "vm_version_x86.hpp"
24.1 --- a/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp Fri Mar 01 04:58:31 2013 -0800 24.2 +++ b/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp Fri Mar 01 15:59:10 2013 -0800 24.3 @@ -1,5 +1,5 @@ 24.4 /* 24.5 - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 24.6 + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 24.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 24.8 * 24.9 * This code is free software; you can redistribute it and/or modify it 24.10 @@ -25,7 +25,6 @@ 24.11 #ifndef OS_CPU_WINDOWS_X86_VM_ATOMIC_WINDOWS_X86_INLINE_HPP 24.12 #define OS_CPU_WINDOWS_X86_VM_ATOMIC_WINDOWS_X86_INLINE_HPP 24.13 24.14 -#include "orderAccess_windows_x86.inline.hpp" 24.15 #include "runtime/atomic.hpp" 24.16 #include "runtime/os.hpp" 24.17 #include "vm_version_x86.hpp"
25.1 --- a/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp Fri Mar 01 04:58:31 2013 -0800 25.2 +++ b/src/os_cpu/windows_x86/vm/orderAccess_windows_x86.inline.hpp Fri Mar 01 15:59:10 2013 -0800 25.3 @@ -1,5 +1,5 @@ 25.4 /* 25.5 - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 25.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 25.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 25.8 * 25.9 * This code is free software; you can redistribute it and/or modify it 25.10 @@ -25,12 +25,11 @@ 25.11 #ifndef OS_CPU_WINDOWS_X86_VM_ORDERACCESS_WINDOWS_X86_INLINE_HPP 25.12 #define OS_CPU_WINDOWS_X86_VM_ORDERACCESS_WINDOWS_X86_INLINE_HPP 25.13 25.14 -#include "runtime/atomic.hpp" 25.15 +#include "runtime/atomic.inline.hpp" 25.16 #include "runtime/orderAccess.hpp" 25.17 +#include "runtime/os.hpp" 25.18 #include "vm_version_x86.hpp" 25.19 25.20 -#pragma warning(disable: 4035) // Disables warnings reporting missing return statement 25.21 - 25.22 // Implementation of class OrderAccess. 25.23 25.24 inline void OrderAccess::loadload() { acquire(); } 25.25 @@ -214,6 +213,4 @@ 25.26 #endif // AMD64 25.27 } 25.28 25.29 -#pragma warning(default: 4035) // Enables warnings reporting missing return statement 25.30 - 25.31 #endif // OS_CPU_WINDOWS_X86_VM_ORDERACCESS_WINDOWS_X86_INLINE_HPP
26.1 --- a/src/share/vm/c1/c1_FrameMap.cpp Fri Mar 01 04:58:31 2013 -0800 26.2 +++ b/src/share/vm/c1/c1_FrameMap.cpp Fri Mar 01 15:59:10 2013 -0800 26.3 @@ -308,27 +308,6 @@ 26.4 return sp_offset_for_monitor_base(index) + in_ByteSize(BasicObjectLock::obj_offset_in_bytes()); 26.5 } 26.6 26.7 -void FrameMap::print_frame_layout() const { 26.8 - int svar; 26.9 - tty->print_cr("#####################################"); 26.10 - tty->print_cr("Frame size in words %d", framesize()); 26.11 - 26.12 - if( _num_monitors > 0) { 26.13 - tty->print_cr("monitor [0]:%d | [%2d]:%d", 26.14 - in_bytes(sp_offset_for_monitor_base(0)), 26.15 - in_bytes(sp_offset_for_monitor_base(_num_monitors))); 26.16 - } 26.17 - if( _num_spills > 0) { 26.18 - svar = _num_spills - 1; 26.19 - if(svar == 0) 26.20 - tty->print_cr("spill [0]:%d", in_bytes(sp_offset_for_spill(0))); 26.21 - else 26.22 - tty->print_cr("spill [0]:%d | [%2d]:%d", in_bytes(sp_offset_for_spill(0)), 26.23 - svar, 26.24 - in_bytes(sp_offset_for_spill(svar))); 26.25 - } 26.26 -} 26.27 - 26.28 26.29 // For OopMaps, map a local variable or spill index to an VMReg. 26.30 // This is the offset from sp() in the frame of the slot for the index,
27.1 --- a/src/share/vm/c1/c1_FrameMap.hpp Fri Mar 01 04:58:31 2013 -0800 27.2 +++ b/src/share/vm/c1/c1_FrameMap.hpp Fri Mar 01 15:59:10 2013 -0800 27.3 @@ -226,8 +226,6 @@ 27.4 return make_new_address(sp_offset_for_monitor_object(monitor_index)); 27.5 } 27.6 27.7 - void print_frame_layout() const; 27.8 - 27.9 // Creates Location describing desired slot and returns it via pointer 27.10 // to Location object. Returns true if the stack frame offset was legal 27.11 // (as defined by Location::legal_offset_in_bytes()), false otherwise.
28.1 --- a/src/share/vm/classfile/classLoaderData.hpp Fri Mar 01 04:58:31 2013 -0800 28.2 +++ b/src/share/vm/classfile/classLoaderData.hpp Fri Mar 01 15:59:10 2013 -0800 28.3 @@ -234,6 +234,7 @@ 28.4 void add_to_deallocate_list(Metadata* m); 28.5 28.6 static ClassLoaderData* class_loader_data(oop loader); 28.7 + static ClassLoaderData* class_loader_data_or_null(oop loader); 28.8 static ClassLoaderData* anonymous_class_loader_data(oop loader, TRAPS); 28.9 static void print_loader(ClassLoaderData *loader_data, outputStream *out); 28.10
29.1 --- a/src/share/vm/classfile/classLoaderData.inline.hpp Fri Mar 01 04:58:31 2013 -0800 29.2 +++ b/src/share/vm/classfile/classLoaderData.inline.hpp Fri Mar 01 15:59:10 2013 -0800 29.3 @@ -25,9 +25,15 @@ 29.4 #include "classfile/classLoaderData.hpp" 29.5 #include "classfile/javaClasses.hpp" 29.6 29.7 +inline ClassLoaderData* ClassLoaderData::class_loader_data_or_null(oop loader) { 29.8 + if (loader == NULL) { 29.9 + return ClassLoaderData::the_null_class_loader_data(); 29.10 + } 29.11 + return java_lang_ClassLoader::loader_data(loader); 29.12 +} 29.13 + 29.14 inline ClassLoaderData* ClassLoaderData::class_loader_data(oop loader) { 29.15 - if (loader == NULL) return ClassLoaderData::the_null_class_loader_data(); 29.16 - ClassLoaderData* loader_data = java_lang_ClassLoader::loader_data(loader); 29.17 + ClassLoaderData* loader_data = class_loader_data_or_null(loader); 29.18 assert(loader_data != NULL, "Must be"); 29.19 return loader_data; 29.20 }
30.1 --- a/src/share/vm/classfile/dictionary.cpp Fri Mar 01 04:58:31 2013 -0800 30.2 +++ b/src/share/vm/classfile/dictionary.cpp Fri Mar 01 15:59:10 2013 -0800 30.3 @@ -347,6 +347,7 @@ 30.4 assert_locked_or_safepoint(SystemDictionary_lock); 30.5 assert(obj() != NULL, "adding NULL obj"); 30.6 assert(obj()->name() == class_name, "sanity check on name"); 30.7 + assert(loader_data != NULL, "Must be non-NULL"); 30.8 30.9 unsigned int hash = compute_hash(class_name, loader_data); 30.10 int index = hash_to_index(hash);
31.1 --- a/src/share/vm/classfile/systemDictionary.cpp Fri Mar 01 04:58:31 2013 -0800 31.2 +++ b/src/share/vm/classfile/systemDictionary.cpp Fri Mar 01 15:59:10 2013 -0800 31.3 @@ -866,16 +866,22 @@ 31.4 // the new entry. 31.5 31.6 Klass* SystemDictionary::find(Symbol* class_name, 31.7 - Handle class_loader, 31.8 - Handle protection_domain, 31.9 - TRAPS) { 31.10 + Handle class_loader, 31.11 + Handle protection_domain, 31.12 + TRAPS) { 31.13 31.14 // UseNewReflection 31.15 // The result of this call should be consistent with the result 31.16 // of the call to resolve_instance_class_or_null(). 31.17 // See evaluation 6790209 and 4474172 for more details. 31.18 class_loader = Handle(THREAD, java_lang_ClassLoader::non_reflection_class_loader(class_loader())); 31.19 - ClassLoaderData* loader_data = register_loader(class_loader, CHECK_NULL); 31.20 + ClassLoaderData* loader_data = ClassLoaderData::class_loader_data_or_null(class_loader()); 31.21 + 31.22 + if (loader_data == NULL) { 31.23 + // If the ClassLoaderData has not been setup, 31.24 + // then the class loader has no entries in the dictionary. 31.25 + return NULL; 31.26 + } 31.27 31.28 unsigned int d_hash = dictionary()->compute_hash(class_name, loader_data); 31.29 int d_index = dictionary()->hash_to_index(d_hash);
32.1 --- a/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp Fri Mar 01 04:58:31 2013 -0800 32.2 +++ b/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp Fri Mar 01 15:59:10 2013 -0800 32.3 @@ -373,6 +373,8 @@ 32.4 " does not exceed used.end() = " PTR_FORMAT "," 32.5 " yet last_chunk_index_to_check " INTPTR_FORMAT 32.6 " exceeds last_chunk_index " INTPTR_FORMAT, 32.7 + last_block, last_block + last_block_size, 32.8 + used.end(), 32.9 last_chunk_index_to_check, last_chunk_index)); 32.10 assert(sp->used_region().end() > used.end(), 32.11 err_msg("Expansion did not happen: "
33.1 --- a/src/share/vm/memory/allocation.inline.hpp Fri Mar 01 04:58:31 2013 -0800 33.2 +++ b/src/share/vm/memory/allocation.inline.hpp Fri Mar 01 15:59:10 2013 -0800 33.3 @@ -1,5 +1,5 @@ 33.4 /* 33.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 33.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 33.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 33.8 * 33.9 * This code is free software; you can redistribute it and/or modify it 33.10 @@ -25,6 +25,7 @@ 33.11 #ifndef SHARE_VM_MEMORY_ALLOCATION_INLINE_HPP 33.12 #define SHARE_VM_MEMORY_ALLOCATION_INLINE_HPP 33.13 33.14 +#include "runtime/atomic.inline.hpp" 33.15 #include "runtime/os.hpp" 33.16 33.17 // Explicit C-heap memory management
34.1 --- a/src/share/vm/memory/cardTableModRefBS.cpp Fri Mar 01 04:58:31 2013 -0800 34.2 +++ b/src/share/vm/memory/cardTableModRefBS.cpp Fri Mar 01 15:59:10 2013 -0800 34.3 @@ -694,7 +694,7 @@ 34.4 if (failed) { 34.5 if (!failures) { 34.6 tty->cr(); 34.7 - tty->print_cr("== CT verification failed: ["PTR_FORMAT","PTR_FORMAT"]"); 34.8 + tty->print_cr("== CT verification failed: ["PTR_FORMAT","PTR_FORMAT"]", start, end); 34.9 tty->print_cr("== %sexpecting value: %d", 34.10 (val_equals) ? "" : "not ", val); 34.11 failures = true;
35.1 --- a/src/share/vm/memory/cardTableRS.cpp Fri Mar 01 04:58:31 2013 -0800 35.2 +++ b/src/share/vm/memory/cardTableRS.cpp Fri Mar 01 15:59:10 2013 -0800 35.3 @@ -353,7 +353,7 @@ 35.4 assert(jp >= _begin && jp < _end, 35.5 err_msg("Error: jp " PTR_FORMAT " should be within " 35.6 "[_begin, _end) = [" PTR_FORMAT "," PTR_FORMAT ")", 35.7 - _begin, _end)); 35.8 + jp, _begin, _end)); 35.9 oop obj = oopDesc::load_decode_heap_oop(p); 35.10 guarantee(obj == NULL || (HeapWord*)obj >= _boundary, 35.11 err_msg("pointer " PTR_FORMAT " at " PTR_FORMAT " on "
36.1 --- a/src/share/vm/oops/symbol.cpp Fri Mar 01 04:58:31 2013 -0800 36.2 +++ b/src/share/vm/oops/symbol.cpp Fri Mar 01 15:59:10 2013 -0800 36.3 @@ -1,5 +1,5 @@ 36.4 /* 36.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 36.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 36.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 36.8 * 36.9 * This code is free software; you can redistribute it and/or modify it 36.10 @@ -27,6 +27,7 @@ 36.11 #include "classfile/altHashing.hpp" 36.12 #include "classfile/classLoaderData.hpp" 36.13 #include "oops/symbol.hpp" 36.14 +#include "runtime/atomic.inline.hpp" 36.15 #include "runtime/os.hpp" 36.16 #include "memory/allocation.inline.hpp" 36.17 #include "memory/resourceArea.hpp" 36.18 @@ -210,6 +211,28 @@ 36.19 return AltHashing::murmur3_32(seed, (const jbyte*)as_C_string(), utf8_length()); 36.20 } 36.21 36.22 +void Symbol::increment_refcount() { 36.23 + // Only increment the refcount if positive. If negative either 36.24 + // overflow has occurred or it is a permanent symbol in a read only 36.25 + // shared archive. 36.26 + if (_refcount >= 0) { 36.27 + Atomic::inc(&_refcount); 36.28 + NOT_PRODUCT(Atomic::inc(&_total_count);) 36.29 + } 36.30 +} 36.31 + 36.32 +void Symbol::decrement_refcount() { 36.33 + if (_refcount >= 0) { 36.34 + Atomic::dec(&_refcount); 36.35 +#ifdef ASSERT 36.36 + if (_refcount < 0) { 36.37 + print(); 36.38 + assert(false, "reference count underflow for symbol"); 36.39 + } 36.40 +#endif 36.41 + } 36.42 +} 36.43 + 36.44 void Symbol::print_on(outputStream* st) const { 36.45 if (this == NULL) { 36.46 st->print_cr("NULL");
37.1 --- a/src/share/vm/oops/symbol.hpp Fri Mar 01 04:58:31 2013 -0800 37.2 +++ b/src/share/vm/oops/symbol.hpp Fri Mar 01 15:59:10 2013 -0800 37.3 @@ -1,5 +1,5 @@ 37.4 /* 37.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 37.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 37.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 37.8 * 37.9 * This code is free software; you can redistribute it and/or modify it 37.10 @@ -27,7 +27,6 @@ 37.11 37.12 #include "utilities/utf8.hpp" 37.13 #include "memory/allocation.hpp" 37.14 -#include "runtime/atomic.hpp" 37.15 37.16 // A Symbol is a canonicalized string. 37.17 // All Symbols reside in global SymbolTable and are reference counted. 37.18 @@ -150,8 +149,8 @@ 37.19 37.20 // Reference counting. See comments above this class for when to use. 37.21 int refcount() const { return _refcount; } 37.22 - inline void increment_refcount(); 37.23 - inline void decrement_refcount(); 37.24 + void increment_refcount(); 37.25 + void decrement_refcount(); 37.26 37.27 int byte_at(int index) const { 37.28 assert(index >=0 && index < _length, "symbol index overflow"); 37.29 @@ -232,26 +231,4 @@ 37.30 return (((uintptr_t)this < (uintptr_t)other) ? -1 37.31 : ((uintptr_t)this == (uintptr_t) other) ? 0 : 1); 37.32 } 37.33 - 37.34 -inline void Symbol::increment_refcount() { 37.35 - // Only increment the refcount if positive. If negative either 37.36 - // overflow has occurred or it is a permanent symbol in a read only 37.37 - // shared archive. 37.38 - if (_refcount >= 0) { 37.39 - Atomic::inc(&_refcount); 37.40 - NOT_PRODUCT(Atomic::inc(&_total_count);) 37.41 - } 37.42 -} 37.43 - 37.44 -inline void Symbol::decrement_refcount() { 37.45 - if (_refcount >= 0) { 37.46 - Atomic::dec(&_refcount); 37.47 -#ifdef ASSERT 37.48 - if (_refcount < 0) { 37.49 - print(); 37.50 - assert(false, "reference count underflow for symbol"); 37.51 - } 37.52 -#endif 37.53 - } 37.54 -} 37.55 #endif // SHARE_VM_OOPS_SYMBOL_HPP
38.1 --- a/src/share/vm/prims/jvmtiEnter.xsl Fri Mar 01 04:58:31 2013 -0800 38.2 +++ b/src/share/vm/prims/jvmtiEnter.xsl Fri Mar 01 15:59:10 2013 -0800 38.3 @@ -773,7 +773,7 @@ 38.4 </xsl:text> 38.5 <xsl:apply-templates select=".." mode="traceError"> 38.6 <xsl:with-param name="err">JVMTI_ERROR_INVALID_THREAD</xsl:with-param> 38.7 - <xsl:with-param name="comment"> - jthread resolved to NULL - jthread = %0x%x</xsl:with-param> 38.8 + <xsl:with-param name="comment"> - jthread resolved to NULL - jthread = 0x%x</xsl:with-param> 38.9 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param> 38.10 </xsl:apply-templates> 38.11 <xsl:text> 38.12 @@ -782,7 +782,7 @@ 38.13 </xsl:text> 38.14 <xsl:apply-templates select=".." mode="traceError"> 38.15 <xsl:with-param name="err">JVMTI_ERROR_INVALID_THREAD</xsl:with-param> 38.16 - <xsl:with-param name="comment"> - oop is not a thread - jthread = %0x%x</xsl:with-param> 38.17 + <xsl:with-param name="comment"> - oop is not a thread - jthread = 0x%x</xsl:with-param> 38.18 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param> 38.19 </xsl:apply-templates> 38.20 <xsl:text> 38.21 @@ -794,7 +794,7 @@ 38.22 <xsl:with-param name="err"> 38.23 <xsl:text>JVMTI_ERROR_THREAD_NOT_ALIVE</xsl:text> 38.24 </xsl:with-param> 38.25 - <xsl:with-param name="comment"> - not a Java thread - jthread = %0x%x</xsl:with-param> 38.26 + <xsl:with-param name="comment"> - not a Java thread - jthread = 0x%x</xsl:with-param> 38.27 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param> 38.28 </xsl:apply-templates> 38.29 <xsl:text> 38.30 @@ -838,7 +838,7 @@ 38.31 </xsl:text> 38.32 <xsl:apply-templates select=".." mode="traceError"> 38.33 <xsl:with-param name="err">JVMTI_ERROR_ILLEGAL_ARGUMENT</xsl:with-param> 38.34 - <xsl:with-param name="comment"> - negative depth - jthread = %0x%x</xsl:with-param> 38.35 + <xsl:with-param name="comment"> - negative depth - jthread = 0x%x</xsl:with-param> 38.36 <xsl:with-param name="extraValue">, <xsl:value-of select="$name"/></xsl:with-param> 38.37 </xsl:apply-templates> 38.38 <xsl:text>
39.1 --- a/src/share/vm/prims/jvmtiEnvBase.cpp Fri Mar 01 04:58:31 2013 -0800 39.2 +++ b/src/share/vm/prims/jvmtiEnvBase.cpp Fri Mar 01 15:59:10 2013 -0800 39.3 @@ -997,13 +997,19 @@ 39.4 // move our object at this point. However, our owner value is safe 39.5 // since it is either the Lock word on a stack or a JavaThread *. 39.6 owning_thread = Threads::owning_thread_from_monitor_owner(owner, !at_safepoint); 39.7 - assert(owning_thread != NULL, "sanity check"); 39.8 - if (owning_thread != NULL) { // robustness 39.9 + // Cannot assume (owning_thread != NULL) here because this function 39.10 + // may not have been called at a safepoint and the owning_thread 39.11 + // might not be suspended. 39.12 + if (owning_thread != NULL) { 39.13 // The monitor's owner either has to be the current thread, at safepoint 39.14 // or it has to be suspended. Any of these conditions will prevent both 39.15 // contending and waiting threads from modifying the state of 39.16 // the monitor. 39.17 if (!at_safepoint && !JvmtiEnv::is_thread_fully_suspended(owning_thread, true, &debug_bits)) { 39.18 + // Don't worry! This return of JVMTI_ERROR_THREAD_NOT_SUSPENDED 39.19 + // will not make it back to the JVM/TI agent. The error code will 39.20 + // get intercepted in JvmtiEnv::GetObjectMonitorUsage() which 39.21 + // will retry the call via a VM_GetObjectMonitorUsage VM op. 39.22 return JVMTI_ERROR_THREAD_NOT_SUSPENDED; 39.23 } 39.24 HandleMark hm;
40.1 --- a/src/share/vm/runtime/synchronizer.cpp Fri Mar 01 04:58:31 2013 -0800 40.2 +++ b/src/share/vm/runtime/synchronizer.cpp Fri Mar 01 15:59:10 2013 -0800 40.3 @@ -813,6 +813,7 @@ 40.4 } 40.5 40.6 if (owner != NULL) { 40.7 + // owning_thread_from_monitor_owner() may also return NULL here 40.8 return Threads::owning_thread_from_monitor_owner(owner, doLock); 40.9 } 40.10
41.1 --- a/src/share/vm/runtime/thread.cpp Fri Mar 01 04:58:31 2013 -0800 41.2 +++ b/src/share/vm/runtime/thread.cpp Fri Mar 01 15:59:10 2013 -0800 41.3 @@ -4285,7 +4285,9 @@ 41.4 if (owner == (address)p) return p; 41.5 } 41.6 } 41.7 - assert(UseHeavyMonitors == false, "Did not find owning Java thread with UseHeavyMonitors enabled"); 41.8 + // Cannot assert on lack of success here since this function may be 41.9 + // used by code that is trying to report useful problem information 41.10 + // like deadlock detection. 41.11 if (UseHeavyMonitors) return NULL; 41.12 41.13 // 41.14 @@ -4303,7 +4305,7 @@ 41.15 } 41.16 } 41.17 } 41.18 - assert(the_owner != NULL, "Did not find owning Java thread for lock word address"); 41.19 + // cannot assert on lack of success here; see above comment 41.20 return the_owner; 41.21 } 41.22
42.1 --- a/src/share/vm/services/memReporter.cpp Fri Mar 01 04:58:31 2013 -0800 42.2 +++ b/src/share/vm/services/memReporter.cpp Fri Mar 01 15:59:10 2013 -0800 42.3 @@ -419,7 +419,7 @@ 42.4 _output->print_cr("[" PTR_FORMAT "] %s+0x%x", pc, buf, offset); 42.5 _output->print("%28s", " "); 42.6 } else { 42.7 - _output->print("[" PTR_FORMAT "]%18s", " "); 42.8 + _output->print("[" PTR_FORMAT "]%18s", pc, " "); 42.9 } 42.10 42.11 _output->print_cr("(mmap: reserved=%d%s, committed=%d%s)", 42.12 @@ -596,7 +596,7 @@ 42.13 _output->print_cr("[" PTR_FORMAT "] %s+0x%x", pc, buf, offset); 42.14 _output->print("%28s", " "); 42.15 } else { 42.16 - _output->print("[" PTR_FORMAT "]%18s", " "); 42.17 + _output->print("[" PTR_FORMAT "]%18s", pc, " "); 42.18 } 42.19 } 42.20
43.1 --- a/src/share/vm/services/threadService.cpp Fri Mar 01 04:58:31 2013 -0800 43.2 +++ b/src/share/vm/services/threadService.cpp Fri Mar 01 15:59:10 2013 -0800 43.3 @@ -1,5 +1,5 @@ 43.4 /* 43.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. 43.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 43.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 43.8 * 43.9 * This code is free software; you can redistribute it and/or modify it 43.10 @@ -327,8 +327,28 @@ 43.11 while (waitingToLockMonitor != NULL || waitingToLockBlocker != NULL) { 43.12 cycle->add_thread(currentThread); 43.13 if (waitingToLockMonitor != NULL) { 43.14 - currentThread = Threads::owning_thread_from_monitor_owner((address)waitingToLockMonitor->owner(), 43.15 - false /* no locking needed */); 43.16 + currentThread = Threads::owning_thread_from_monitor_owner( 43.17 + (address)waitingToLockMonitor->owner(), 43.18 + false /* no locking needed */); 43.19 + if (currentThread == NULL) { 43.20 + // This function is called at a safepoint so the JavaThread 43.21 + // that owns waitingToLockMonitor should be findable, but 43.22 + // if it is not findable, then the previous currentThread is 43.23 + // blocked permanently. We record this as a deadlock. 43.24 + num_deadlocks++; 43.25 + 43.26 + cycle->set_deadlock(true); 43.27 + 43.28 + // add this cycle to the deadlocks list 43.29 + if (deadlocks == NULL) { 43.30 + deadlocks = cycle; 43.31 + } else { 43.32 + last->set_next(cycle); 43.33 + } 43.34 + last = cycle; 43.35 + cycle = new DeadlockCycle(); 43.36 + break; 43.37 + } 43.38 } else { 43.39 if (concurrent_locks) { 43.40 if (waitingToLockBlocker->is_a(SystemDictionary::abstract_ownable_synchronizer_klass())) { 43.41 @@ -841,7 +861,17 @@ 43.42 owner_desc = " (JVMTI raw monitor),\n which is held by"; 43.43 } 43.44 currentThread = Threads::owning_thread_from_monitor_owner( 43.45 - (address)waitingToLockMonitor->owner(), false /* no locking needed */); 43.46 + (address)waitingToLockMonitor->owner(), 43.47 + false /* no locking needed */); 43.48 + if (currentThread == NULL) { 43.49 + // The deadlock was detected at a safepoint so the JavaThread 43.50 + // that owns waitingToLockMonitor should be findable, but 43.51 + // if it is not findable, then the previous currentThread is 43.52 + // blocked permanently. 43.53 + st->print("%s UNKNOWN_owner_addr=" PTR_FORMAT, owner_desc, 43.54 + (address)waitingToLockMonitor->owner()); 43.55 + continue; 43.56 + } 43.57 } else { 43.58 st->print(" waiting for ownable synchronizer " INTPTR_FORMAT ", (a %s)", 43.59 (address)waitingToLockBlocker,
44.1 --- a/src/share/vm/utilities/numberSeq.cpp Fri Mar 01 04:58:31 2013 -0800 44.2 +++ b/src/share/vm/utilities/numberSeq.cpp Fri Mar 01 15:59:10 2013 -0800 44.3 @@ -245,7 +245,7 @@ 44.4 44.5 void NumberSeq::dump_on(outputStream* s) { 44.6 AbsSeq::dump_on(s); 44.7 - s->print_cr("\t\t _last = %7.3f, _maximum = %7.3f"); 44.8 + s->print_cr("\t\t _last = %7.3f, _maximum = %7.3f", _last, _maximum); 44.9 } 44.10 44.11 void TruncatedSeq::dump_on(outputStream* s) {