changeset 7184:5505fbbae3d3

Merge
author cjplummer
date Thu, 29 Nov 2012 13:55:49 -0800
parents c24f778e9401 (diff) b2dbd323c668 (current diff)
children 5fafdef522c6
files src/cpu/sparc/vm/interp_masm_sparc.cpp src/share/vm/oops/method.cpp src/share/vm/oops/method.hpp src/share/vm/runtime/vmStructs.cpp
diffstat 158 files changed, 765 insertions(+), 967 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/sparc/vm/frame_sparc.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/cpu/sparc/vm/frame_sparc.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -648,7 +648,7 @@
   Method* m = *interpreter_frame_method_addr();
 
   // validate the method we'd find in this potential sender
-  if (!Universe::heap()->is_valid_method(m)) return false;
+  if (!m->is_valid_method()) return false;
 
   // stack frames shouldn't be much larger than max_stack elements
 
--- a/src/cpu/sparc/vm/interp_masm_sparc.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/cpu/sparc/vm/interp_masm_sparc.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -36,12 +36,7 @@
 #include "runtime/basicLock.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/sharedRuntime.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
+#include "runtime/thread.inline.hpp"
 
 #ifndef CC_INTERP
 #ifndef FAST_DISPATCH
--- a/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -37,13 +37,8 @@
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubCodeGenerator.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
 #include "utilities/top.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
 #ifdef COMPILER2
 #include "opto/runtime.hpp"
 #endif
--- a/src/cpu/sparc/vm/stubRoutines_sparc.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/cpu/sparc/vm/stubRoutines_sparc.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -26,12 +26,7 @@
 #include "runtime/deoptimization.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/stubRoutines.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
+#include "runtime/thread.inline.hpp"
 
 // Implementation of the platform-specific part of StubRoutines - for
 // a description of how to extend it, see the stubRoutines.hpp file.
--- a/src/cpu/x86/vm/frame_x86.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/cpu/x86/vm/frame_x86.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -534,7 +534,7 @@
   Method* m = *interpreter_frame_method_addr();
 
   // validate the method we'd find in this potential sender
-  if (!Universe::heap()->is_valid_method(m)) return false;
+  if (!m->is_valid_method()) return false;
 
   // stack frames shouldn't be much larger than max_stack elements
 
--- a/src/cpu/x86/vm/interp_masm_x86_32.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/cpu/x86/vm/interp_masm_x86_32.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -36,18 +36,7 @@
 #include "runtime/basicLock.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/sharedRuntime.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
+#include "runtime/thread.inline.hpp"
 
 
 // Implementation of InterpreterMacroAssembler
--- a/src/cpu/x86/vm/interp_masm_x86_64.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/cpu/x86/vm/interp_masm_x86_64.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -36,18 +36,7 @@
 #include "runtime/basicLock.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/sharedRuntime.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
+#include "runtime/thread.inline.hpp"
 
 
 // Implementation of InterpreterMacroAssembler
--- a/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -37,19 +37,8 @@
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubCodeGenerator.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
 #include "utilities/top.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 #ifdef COMPILER2
 #include "opto/runtime.hpp"
 #endif
--- a/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -37,19 +37,8 @@
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubCodeGenerator.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
 #include "utilities/top.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 #ifdef COMPILER2
 #include "opto/runtime.hpp"
 #endif
--- a/src/cpu/x86/vm/stubRoutines_x86_32.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/cpu/x86/vm/stubRoutines_x86_32.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -26,18 +26,7 @@
 #include "runtime/deoptimization.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/stubRoutines.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
+#include "runtime/thread.inline.hpp"
 
 // Implementation of the platform-specific part of StubRoutines - for
 // a description of how to extend it, see the stubRoutines.hpp file.
--- a/src/cpu/x86/vm/stubRoutines_x86_64.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/cpu/x86/vm/stubRoutines_x86_64.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -26,18 +26,7 @@
 #include "runtime/deoptimization.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/stubRoutines.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
+#include "runtime/thread.inline.hpp"
 
 // Implementation of the platform-specific part of StubRoutines - for
 // a description of how to extend it, see the stubRoutines.hpp file.
--- a/src/cpu/zero/vm/interp_masm_zero.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/cpu/zero/vm/interp_masm_zero.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -37,11 +37,6 @@
 #include "runtime/basicLock.hpp"
 #include "runtime/biasedLocking.hpp"
 #include "runtime/sharedRuntime.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
+#include "runtime/thread.inline.hpp"
 
 // This file is intentionally empty
--- a/src/cpu/zero/vm/stubGenerator_zero.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/cpu/zero/vm/stubGenerator_zero.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -38,14 +38,9 @@
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubCodeGenerator.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
 #include "stack_zero.inline.hpp"
 #include "utilities/top.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 #ifdef COMPILER2
 #include "opto/runtime.hpp"
 #endif
--- a/src/cpu/zero/vm/stubRoutines_zero.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/cpu/zero/vm/stubRoutines_zero.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -27,9 +27,4 @@
 #include "runtime/deoptimization.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/stubRoutines.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
+#include "runtime/thread.inline.hpp"
--- a/src/os/bsd/vm/mutex_bsd.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os/bsd/vm/mutex_bsd.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -26,7 +26,7 @@
 #include "mutex_bsd.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/mutex.hpp"
-#include "thread_bsd.inline.hpp"
+#include "runtime/thread.inline.hpp"
 #include "utilities/events.hpp"
 
 // put OS-includes here
--- a/src/os/bsd/vm/mutex_bsd.inline.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os/bsd/vm/mutex_bsd.inline.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -27,7 +27,7 @@
 
 #include "os_bsd.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
-#include "thread_bsd.inline.hpp"
+#include "runtime/thread.inline.hpp"
 
 
 // Reconciliation History
--- a/src/os/bsd/vm/os_bsd.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os/bsd/vm/os_bsd.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -52,11 +52,11 @@
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/statSampler.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/threadCritical.hpp"
 #include "runtime/timer.hpp"
 #include "services/attachListener.hpp"
 #include "services/runtimeService.hpp"
-#include "thread_bsd.inline.hpp"
 #include "utilities/decoder.hpp"
 #include "utilities/defaultStream.hpp"
 #include "utilities/events.hpp"
--- a/src/os/bsd/vm/threadCritical_bsd.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os/bsd/vm/threadCritical_bsd.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -23,8 +23,8 @@
  */
 
 #include "precompiled.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/threadCritical.hpp"
-#include "thread_bsd.inline.hpp"
 
 // put OS-includes here
 # include <pthread.h>
--- a/src/os/bsd/vm/thread_bsd.inline.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os/bsd/vm/thread_bsd.inline.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -25,6 +25,10 @@
 #ifndef OS_BSD_VM_THREAD_BSD_INLINE_HPP
 #define OS_BSD_VM_THREAD_BSD_INLINE_HPP
 
+#ifndef SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE
+#error "This file should only be included from thread.inline.hpp"
+#endif
+
 #include "runtime/atomic.hpp"
 #include "runtime/prefetch.hpp"
 #include "runtime/thread.hpp"
--- a/src/os/linux/vm/mutex_linux.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os/linux/vm/mutex_linux.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -26,7 +26,7 @@
 #include "mutex_linux.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/mutex.hpp"
-#include "thread_linux.inline.hpp"
+#include "runtime/thread.inline.hpp"
 #include "utilities/events.hpp"
 
 // put OS-includes here
--- a/src/os/linux/vm/mutex_linux.inline.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os/linux/vm/mutex_linux.inline.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -27,7 +27,7 @@
 
 #include "os_linux.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
-#include "thread_linux.inline.hpp"
+#include "runtime/thread.inline.hpp"
 
 
 // Reconciliation History
--- a/src/os/linux/vm/os_linux.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os/linux/vm/os_linux.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -52,11 +52,11 @@
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/statSampler.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/threadCritical.hpp"
 #include "runtime/timer.hpp"
 #include "services/attachListener.hpp"
 #include "services/runtimeService.hpp"
-#include "thread_linux.inline.hpp"
 #include "utilities/decoder.hpp"
 #include "utilities/defaultStream.hpp"
 #include "utilities/events.hpp"
--- a/src/os/linux/vm/threadCritical_linux.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os/linux/vm/threadCritical_linux.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -23,8 +23,8 @@
  */
 
 #include "precompiled.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/threadCritical.hpp"
-#include "thread_linux.inline.hpp"
 
 // put OS-includes here
 # include <pthread.h>
--- a/src/os/linux/vm/thread_linux.inline.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os/linux/vm/thread_linux.inline.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -25,6 +25,10 @@
 #ifndef OS_LINUX_VM_THREAD_LINUX_INLINE_HPP
 #define OS_LINUX_VM_THREAD_LINUX_INLINE_HPP
 
+#ifndef SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE
+#error "This file should only be included from thread.inline.hpp"
+#endif
+
 #include "runtime/atomic.hpp"
 #include "runtime/prefetch.hpp"
 #include "runtime/thread.hpp"
--- a/src/os/solaris/vm/mutex_solaris.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os/solaris/vm/mutex_solaris.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -26,7 +26,7 @@
 #include "mutex_solaris.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/mutex.hpp"
-#include "thread_solaris.inline.hpp"
+#include "runtime/thread.inline.hpp"
 #include "utilities/events.hpp"
 
 // Solaris-specific include, therefore not in includeDB_*
--- a/src/os/solaris/vm/mutex_solaris.inline.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os/solaris/vm/mutex_solaris.inline.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -27,6 +27,6 @@
 
 #include "os_solaris.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
-#include "thread_solaris.inline.hpp"
+#include "runtime/thread.inline.hpp"
 
 #endif // OS_SOLARIS_VM_MUTEX_SOLARIS_INLINE_HPP
--- a/src/os/solaris/vm/os_solaris.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os/solaris/vm/os_solaris.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -52,12 +52,12 @@
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/statSampler.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/threadCritical.hpp"
 #include "runtime/timer.hpp"
 #include "services/attachListener.hpp"
 #include "services/memTracker.hpp"
 #include "services/runtimeService.hpp"
-#include "thread_solaris.inline.hpp"
 #include "utilities/decoder.hpp"
 #include "utilities/defaultStream.hpp"
 #include "utilities/events.hpp"
--- a/src/os/solaris/vm/threadCritical_solaris.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os/solaris/vm/threadCritical_solaris.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -23,8 +23,8 @@
  */
 
 #include "precompiled.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/threadCritical.hpp"
-#include "thread_solaris.inline.hpp"
 
 // OS-includes here
 #include <thread.h>
--- a/src/os/solaris/vm/thread_solaris.inline.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os/solaris/vm/thread_solaris.inline.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -25,6 +25,10 @@
 #ifndef OS_SOLARIS_VM_THREAD_SOLARIS_INLINE_HPP
 #define OS_SOLARIS_VM_THREAD_SOLARIS_INLINE_HPP
 
+#ifndef SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE
+#error "This file should only be included from thread.inline.hpp"
+#endif
+
 #include "runtime/atomic.hpp"
 #include "runtime/prefetch.hpp"
 #include "runtime/thread.hpp"
--- a/src/os/windows/vm/mutex_windows.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os/windows/vm/mutex_windows.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -26,7 +26,7 @@
 #include "mutex_windows.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/mutex.hpp"
-#include "thread_windows.inline.hpp"
+#include "runtime/thread.inline.hpp"
 #include "utilities/events.hpp"
 
 // put OS-includes here
--- a/src/os/windows/vm/mutex_windows.inline.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os/windows/vm/mutex_windows.inline.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -27,6 +27,6 @@
 
 #include "os_windows.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
-#include "thread_windows.inline.hpp"
+#include "runtime/thread.inline.hpp"
 
 #endif // OS_WINDOWS_VM_MUTEX_WINDOWS_INLINE_HPP
--- a/src/os/windows/vm/os_windows.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os/windows/vm/os_windows.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -55,11 +55,11 @@
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/statSampler.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/threadCritical.hpp"
 #include "runtime/timer.hpp"
 #include "services/attachListener.hpp"
 #include "services/runtimeService.hpp"
-#include "thread_windows.inline.hpp"
 #include "utilities/decoder.hpp"
 #include "utilities/defaultStream.hpp"
 #include "utilities/events.hpp"
--- a/src/os/windows/vm/threadCritical_windows.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os/windows/vm/threadCritical_windows.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -23,8 +23,8 @@
  */
 
 #include "precompiled.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/threadCritical.hpp"
-#include "thread_windows.inline.hpp"
 
 // OS-includes here
 # include <windows.h>
--- a/src/os/windows/vm/thread_windows.inline.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os/windows/vm/thread_windows.inline.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -25,6 +25,10 @@
 #ifndef OS_WINDOWS_VM_THREAD_WINDOWS_INLINE_HPP
 #define OS_WINDOWS_VM_THREAD_WINDOWS_INLINE_HPP
 
+#ifndef SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE
+#error "This file should only be included from thread.inline.hpp"
+#endif
+
 #include "runtime/atomic.hpp"
 #include "runtime/prefetch.hpp"
 #include "runtime/thread.hpp"
--- a/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -48,8 +48,8 @@
 #include "runtime/osThread.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/timer.hpp"
-#include "thread_bsd.inline.hpp"
 #include "utilities/events.hpp"
 #include "utilities/vmError.hpp"
 
--- a/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/bsd_x86/vm/threadLS_bsd_x86.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -23,8 +23,8 @@
  */
 
 #include "precompiled.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/threadLocalStorage.hpp"
-#include "thread_bsd.inline.hpp"
 
 // Map stack pointer (%esp) to thread pointer for faster TLS access
 //
--- a/src/os_cpu/bsd_x86/vm/thread_bsd_x86.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/bsd_x86/vm/thread_bsd_x86.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -24,7 +24,7 @@
 
 #include "precompiled.hpp"
 #include "runtime/frame.inline.hpp"
-#include "thread_bsd.inline.hpp"
+#include "runtime/thread.inline.hpp"
 
 // For Forte Analyzer AsyncGetCallTrace profiling support - thread is
 // currently interrupted by SIGPROF
--- a/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/bsd_zero/vm/os_bsd_zero.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -54,8 +54,8 @@
 #include "runtime/osThread.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/timer.hpp"
-#include "thread_bsd.inline.hpp"
 #include "utilities/events.hpp"
 #include "utilities/vmError.hpp"
 
--- a/src/os_cpu/bsd_zero/vm/threadLS_bsd_zero.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/bsd_zero/vm/threadLS_bsd_zero.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -24,8 +24,8 @@
  */
 
 #include "precompiled.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/threadLocalStorage.hpp"
-#include "thread_bsd.inline.hpp"
 
 void ThreadLocalStorage::generate_code_for_get_thread() {
   // nothing to do
--- a/src/os_cpu/bsd_zero/vm/thread_bsd_zero.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/bsd_zero/vm/thread_bsd_zero.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -25,7 +25,7 @@
 
 #include "precompiled.hpp"
 #include "runtime/frame.inline.hpp"
-#include "thread_bsd.inline.hpp"
+#include "runtime/thread.inline.hpp"
 
 void JavaThread::cache_global_variables() {
   // nothing to do
--- a/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/linux_sparc/vm/os_linux_sparc.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -48,8 +48,8 @@
 #include "runtime/osThread.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/timer.hpp"
-#include "thread_linux.inline.hpp"
 #include "utilities/events.hpp"
 #include "utilities/vmError.hpp"
 
--- a/src/os_cpu/linux_sparc/vm/threadLS_linux_sparc.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/linux_sparc/vm/threadLS_linux_sparc.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -23,8 +23,8 @@
  */
 
 #include "precompiled.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/threadLocalStorage.hpp"
-#include "thread_linux.inline.hpp"
 
 void ThreadLocalStorage::generate_code_for_get_thread() {
 }
--- a/src/os_cpu/linux_sparc/vm/thread_linux_sparc.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/linux_sparc/vm/thread_linux_sparc.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -24,7 +24,7 @@
 
 #include "precompiled.hpp"
 #include "runtime/frame.inline.hpp"
-#include "thread_linux.inline.hpp"
+#include "runtime/thread.inline.hpp"
 
 // For Forte Analyzer AsyncGetCallTrace profiling support - thread is
 // currently interrupted by SIGPROF
--- a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -48,8 +48,8 @@
 #include "runtime/osThread.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/timer.hpp"
-#include "thread_linux.inline.hpp"
 #include "utilities/events.hpp"
 #include "utilities/vmError.hpp"
 
--- a/src/os_cpu/linux_x86/vm/threadLS_linux_x86.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/linux_x86/vm/threadLS_linux_x86.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -23,8 +23,8 @@
  */
 
 #include "precompiled.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/threadLocalStorage.hpp"
-#include "thread_linux.inline.hpp"
 
 // Map stack pointer (%esp) to thread pointer for faster TLS access
 //
--- a/src/os_cpu/linux_x86/vm/thread_linux_x86.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/linux_x86/vm/thread_linux_x86.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -24,7 +24,7 @@
 
 #include "precompiled.hpp"
 #include "runtime/frame.inline.hpp"
-#include "thread_linux.inline.hpp"
+#include "runtime/thread.inline.hpp"
 
 // For Forte Analyzer AsyncGetCallTrace profiling support - thread is
 // currently interrupted by SIGPROF
--- a/src/os_cpu/linux_zero/vm/os_linux_zero.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/linux_zero/vm/os_linux_zero.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -49,8 +49,8 @@
 #include "runtime/osThread.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/timer.hpp"
-#include "thread_linux.inline.hpp"
 #include "utilities/events.hpp"
 #include "utilities/vmError.hpp"
 
--- a/src/os_cpu/linux_zero/vm/threadLS_linux_zero.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/linux_zero/vm/threadLS_linux_zero.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -24,8 +24,8 @@
  */
 
 #include "precompiled.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/threadLocalStorage.hpp"
-#include "thread_linux.inline.hpp"
 
 void ThreadLocalStorage::generate_code_for_get_thread() {
   // nothing to do
--- a/src/os_cpu/linux_zero/vm/thread_linux_zero.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/linux_zero/vm/thread_linux_zero.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -25,7 +25,7 @@
 
 #include "precompiled.hpp"
 #include "runtime/frame.inline.hpp"
-#include "thread_linux.inline.hpp"
+#include "runtime/thread.inline.hpp"
 
 void JavaThread::cache_global_variables() {
   // nothing to do
--- a/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/solaris_sparc/vm/os_solaris_sparc.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -48,8 +48,8 @@
 #include "runtime/osThread.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/timer.hpp"
-#include "thread_solaris.inline.hpp"
 #include "utilities/events.hpp"
 #include "utilities/vmError.hpp"
 
--- a/src/os_cpu/solaris_sparc/vm/threadLS_solaris_sparc.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/solaris_sparc/vm/threadLS_solaris_sparc.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -23,8 +23,8 @@
  */
 
 #include "precompiled.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/threadLocalStorage.hpp"
-#include "thread_solaris.inline.hpp"
 
 // Provides an entry point we can link against and
 // a buffer we can emit code into. The buffer is
--- a/src/os_cpu/solaris_sparc/vm/thread_solaris_sparc.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/solaris_sparc/vm/thread_solaris_sparc.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -24,7 +24,7 @@
 
 #include "precompiled.hpp"
 #include "runtime/frame.inline.hpp"
-#include "thread_solaris.inline.hpp"
+#include "runtime/thread.inline.hpp"
 
 // For Forte Analyzer AsyncGetCallTrace profiling support - thread is
 // currently interrupted by SIGPROF
--- a/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/solaris_x86/vm/os_solaris_x86.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -48,8 +48,8 @@
 #include "runtime/osThread.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/timer.hpp"
-#include "thread_solaris.inline.hpp"
 #include "utilities/events.hpp"
 #include "utilities/vmError.hpp"
 
--- a/src/os_cpu/solaris_x86/vm/threadLS_solaris_x86.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/solaris_x86/vm/threadLS_solaris_x86.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -23,8 +23,8 @@
  */
 
 #include "precompiled.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/threadLocalStorage.hpp"
-#include "thread_solaris.inline.hpp"
 
 #ifdef AMD64
 extern "C" Thread*  fs_load(ptrdiff_t tlsOffset);
--- a/src/os_cpu/solaris_x86/vm/thread_solaris_x86.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/solaris_x86/vm/thread_solaris_x86.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -24,7 +24,7 @@
 
 #include "precompiled.hpp"
 #include "runtime/frame.inline.hpp"
-#include "thread_solaris.inline.hpp"
+#include "runtime/thread.inline.hpp"
 
 // For Forte Analyzer AsyncGetCallTrace profiling support - thread is
 // currently interrupted by SIGPROF
--- a/src/os_cpu/windows_x86/vm/os_windows_x86.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/windows_x86/vm/os_windows_x86.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -48,8 +48,8 @@
 #include "runtime/osThread.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/timer.hpp"
-#include "thread_windows.inline.hpp"
 #include "utilities/events.hpp"
 #include "utilities/vmError.hpp"
 
--- a/src/os_cpu/windows_x86/vm/threadLS_windows_x86.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/windows_x86/vm/threadLS_windows_x86.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -23,8 +23,8 @@
  */
 
 #include "precompiled.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/threadLocalStorage.hpp"
-#include "thread_windows.inline.hpp"
 
 // Provides an entry point we can link against and
 // a buffer we can emit code into. The buffer is
--- a/src/os_cpu/windows_x86/vm/thread_windows_x86.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/os_cpu/windows_x86/vm/thread_windows_x86.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -24,7 +24,7 @@
 
 #include "precompiled.hpp"
 #include "runtime/frame.inline.hpp"
-#include "thread_windows.inline.hpp"
+#include "runtime/thread.inline.hpp"
 
 // For Forte Analyzer AsyncGetCallTrace profiling support - thread is
 // currently interrupted by SIGPROF
--- a/src/share/vm/classfile/javaClasses.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/classfile/javaClasses.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -47,20 +47,9 @@
 #include "runtime/java.hpp"
 #include "runtime/javaCalls.hpp"
 #include "runtime/safepoint.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/vframe.hpp"
 #include "utilities/preserveException.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 #define INJECTED_FIELD_COMPUTE_OFFSET(klass, name, signature, may_be_java)    \
   klass::_##name##_offset = JavaClasses::compute_injected_offset(JavaClasses::klass##_##name##_enum);
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -40,19 +40,8 @@
 #include "runtime/globals_extension.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/java.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/vmThread.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 //
 // ConcurrentMarkSweepPolicy methods
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -27,18 +27,7 @@
 
 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp"
 #include "gc_implementation/shared/concurrentGCThread.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
+#include "runtime/thread.inline.hpp"
 
 class ConcurrentMarkSweepGeneration;
 class CMSCollector;
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/gc_implementation/concurrentMarkSweep/vmStructs_cms.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -65,8 +65,7 @@
   declare_toplevel_type(AFLBinaryTreeDictionary*)                         \
   declare_toplevel_type(LinearAllocBlock)                                 \
   declare_toplevel_type(FreeBlockDictionary<FreeChunk>)                   \
-  declare_type(AFLBinaryTreeDictionary, FreeBlockDictionary<FreeChunk>)   \
-            declare_type(AFLBinaryTreeDictionary, FreeBlockDictionary<FreeChunk>) \
+           declare_type(AFLBinaryTreeDictionary, FreeBlockDictionary<FreeChunk>)
 
 #define VM_INT_CONSTANTS_CMS(declare_constant)                            \
   declare_constant(Generation::ConcurrentMarkSweep)                       \
--- a/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/gc_implementation/g1/dirtyCardQueue.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -28,20 +28,8 @@
 #include "runtime/atomic.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/safepoint.hpp"
-#include "runtime/thread.hpp"
+#include "runtime/thread.inline.hpp"
 #include "utilities/workgroup.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 bool DirtyCardQueue::apply_closure(CardTableEntryClosure* cl,
                                    bool consume,
--- a/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -302,16 +302,28 @@
   for (size_t c = start_card + 1; c <= end_card; c++ /* yeah! */) {
     u_char entry = _array->offset_array(c);
     if (c - start_card > BlockOffsetArray::power_to_cards_back(1)) {
-      guarantee(entry > N_words, "Should be in logarithmic region");
+      guarantee(entry > N_words,
+                err_msg("Should be in logarithmic region - "
+                        "entry: " UINT32_FORMAT ", "
+                        "_array->offset_array(c): " UINT32_FORMAT ", "
+                        "N_words: " UINT32_FORMAT,
+                        entry, _array->offset_array(c), N_words));
     }
     size_t backskip = BlockOffsetArray::entry_to_cards_back(entry);
     size_t landing_card = c - backskip;
     guarantee(landing_card >= (start_card - 1), "Inv");
     if (landing_card >= start_card) {
-      guarantee(_array->offset_array(landing_card) <= entry, "monotonicity");
+      guarantee(_array->offset_array(landing_card) <= entry,
+                err_msg("Monotonicity - landing_card offset: " UINT32_FORMAT ", "
+                        "entry: " UINT32_FORMAT,
+                        _array->offset_array(landing_card), entry));
     } else {
       guarantee(landing_card == start_card - 1, "Tautology");
-      guarantee(_array->offset_array(landing_card) <= N_words, "Offset value");
+      // Note that N_words is the maximum offset value
+      guarantee(_array->offset_array(landing_card) <= N_words,
+                err_msg("landing card offset: " UINT32_FORMAT ", "
+                        "N_words: " UINT32_FORMAT,
+                        _array->offset_array(landing_card), N_words));
     }
   }
 }
@@ -536,17 +548,27 @@
   // The offset can be 0 if the block starts on a boundary.  That
   // is checked by an assertion above.
   size_t start_index = _array->index_for(blk_start);
-  HeapWord* boundary    = _array->address_for_index(start_index);
+  HeapWord* boundary = _array->address_for_index(start_index);
   assert((_array->offset_array(orig_index) == 0 &&
           blk_start == boundary) ||
           (_array->offset_array(orig_index) > 0 &&
          _array->offset_array(orig_index) <= N_words),
-         "offset array should have been set");
+         err_msg("offset array should have been set - "
+                  "orig_index offset: " UINT32_FORMAT ", "
+                  "blk_start: " PTR_FORMAT ", "
+                  "boundary: " PTR_FORMAT,
+                  _array->offset_array(orig_index),
+                  blk_start, boundary));
   for (size_t j = orig_index + 1; j <= end_index; j++) {
     assert(_array->offset_array(j) > 0 &&
            _array->offset_array(j) <=
              (u_char) (N_words+BlockOffsetArray::N_powers-1),
-           "offset array should have been set");
+           err_msg("offset array should have been set - "
+                   UINT32_FORMAT " not > 0 OR "
+                   UINT32_FORMAT " not <= " UINT32_FORMAT,
+                   _array->offset_array(j),
+                   _array->offset_array(j),
+                   (u_char) (N_words+BlockOffsetArray::N_powers-1)));
   }
 #endif
 }
--- a/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -78,7 +78,9 @@
   virtual void resize(size_t new_word_size) = 0;
 
   virtual void set_bottom(HeapWord* new_bottom) {
-    assert(new_bottom <= _end, "new_bottom > _end");
+    assert(new_bottom <= _end,
+           err_msg("new_bottom (" PTR_FORMAT ") > _end (" PTR_FORMAT ")",
+                   new_bottom, _end));
     _bottom = new_bottom;
     resize(pointer_delta(_end, _bottom));
   }
@@ -134,29 +136,42 @@
   VirtualSpace _vs;
   u_char* _offset_array;          // byte array keeping backwards offsets
 
+  void check_index(size_t index, const char* msg) const {
+    assert(index < _vs.committed_size(),
+           err_msg("%s - "
+                   "index: " SIZE_FORMAT ", _vs.committed_size: " SIZE_FORMAT,
+                   msg, index, _vs.committed_size()));
+  }
+
+  void check_offset(size_t offset, const char* msg) const {
+    assert(offset <= N_words,
+           err_msg("%s - "
+                   "offset: " UINT32_FORMAT", N_words: " UINT32_FORMAT,
+                   msg, offset, N_words));
+  }
+
   // Bounds checking accessors:
   // For performance these have to devolve to array accesses in product builds.
   u_char offset_array(size_t index) const {
-    assert(index < _vs.committed_size(), "index out of range");
+    check_index(index, "index out of range");
     return _offset_array[index];
   }
 
   void set_offset_array(size_t index, u_char offset) {
-    assert(index < _vs.committed_size(), "index out of range");
-    assert(offset <= N_words, "offset too large");
+    check_index(index, "index out of range");
+    check_offset(offset, "offset too large");
     _offset_array[index] = offset;
   }
 
   void set_offset_array(size_t index, HeapWord* high, HeapWord* low) {
-    assert(index < _vs.committed_size(), "index out of range");
+    check_index(index, "index out of range");
     assert(high >= low, "addresses out of order");
-    assert(pointer_delta(high, low) <= N_words, "offset too large");
+    check_offset(pointer_delta(high, low), "offset too large");
     _offset_array[index] = (u_char) pointer_delta(high, low);
   }
 
   void set_offset_array(HeapWord* left, HeapWord* right, u_char offset) {
-    assert(index_for(right - 1) < _vs.committed_size(),
-           "right address out of range");
+    check_index(index_for(right - 1), "right address out of range");
     assert(left  < right, "Heap addresses out of order");
     size_t num_cards = pointer_delta(right, left) >> LogN_words;
     if (UseMemSetInBOT) {
@@ -171,7 +186,7 @@
   }
 
   void set_offset_array(size_t left, size_t right, u_char offset) {
-    assert(right < _vs.committed_size(), "right address out of range");
+    check_index(right, "right index out of range");
     assert(left <= right, "indexes out of order");
     size_t num_cards = right - left + 1;
     if (UseMemSetInBOT) {
@@ -186,11 +201,10 @@
   }
 
   void check_offset_array(size_t index, HeapWord* high, HeapWord* low) const {
-    assert(index < _vs.committed_size(), "index out of range");
+    check_index(index, "index out of range");
     assert(high >= low, "addresses out of order");
-    assert(pointer_delta(high, low) <= N_words, "offset too large");
-    assert(_offset_array[index] == pointer_delta(high, low),
-           "Wrong offset");
+    check_offset(pointer_delta(high, low), "offset too large");
+    assert(_offset_array[index] == pointer_delta(high, low), "Wrong offset");
   }
 
   bool is_card_boundary(HeapWord* p) const;
@@ -481,7 +495,6 @@
                       blk_start, blk_end);
   }
 
-
  public:
   G1BlockOffsetArrayContigSpace(G1BlockOffsetSharedArray* array, MemRegion mr);
 
--- a/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/gc_implementation/g1/g1BlockOffsetTable.inline.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -49,16 +49,17 @@
   char* pc = (char*)p;
   assert(pc >= (char*)_reserved.start() &&
          pc <  (char*)_reserved.end(),
-         "p not in range.");
+         err_msg("p (" PTR_FORMAT ") not in reserved [" PTR_FORMAT ", " PTR_FORMAT ")",
+                 p, (char*)_reserved.start(), (char*)_reserved.end()));
   size_t delta = pointer_delta(pc, _reserved.start(), sizeof(char));
   size_t result = delta >> LogN;
-  assert(result < _vs.committed_size(), "bad index from address");
+  check_index(result, "bad index from address");
   return result;
 }
 
 inline HeapWord*
 G1BlockOffsetSharedArray::address_for_index(size_t index) const {
-  assert(index < _vs.committed_size(), "bad index");
+  check_index(index, "index out of range");
   HeapWord* result = _reserved.start() + (index << LogN_words);
   assert(result >= _reserved.start() && result < _reserved.end(),
          err_msg("bad address from index result " PTR_FORMAT
--- a/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -27,19 +27,7 @@
 #include "gc_implementation/g1/heapRegion.hpp"
 #include "gc_implementation/g1/satbQueue.hpp"
 #include "runtime/mutexLocker.hpp"
-#include "runtime/thread.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
+#include "runtime/thread.inline.hpp"
 
 G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(MemRegion whole_heap,
                                                  int max_covered_regions) :
--- a/src/share/vm/gc_implementation/g1/ptrQueue.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/gc_implementation/g1/ptrQueue.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -28,18 +28,7 @@
 #include "memory/allocation.inline.hpp"
 #include "runtime/mutex.hpp"
 #include "runtime/mutexLocker.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
+#include "runtime/thread.inline.hpp"
 
 PtrQueue::PtrQueue(PtrQueueSet* qset, bool perm, bool active) :
   _qset(qset), _buf(NULL), _index(0), _active(active),
--- a/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -52,14 +52,22 @@
     PrintGCDetails && TraceParallelOldGCTasks, true, gclog_or_tty));
   ParCompactionManager* cm =
     ParCompactionManager::gc_thread_compaction_manager(which);
+
   PSParallelCompact::MarkAndPushClosure mark_and_push_closure(cm);
+  CLDToOopClosure mark_and_push_from_clds(&mark_and_push_closure, true);
   CodeBlobToOopClosure mark_and_push_in_blobs(&mark_and_push_closure, /*do_marking=*/ true);
 
   if (_java_thread != NULL)
-    _java_thread->oops_do(&mark_and_push_closure, &mark_and_push_in_blobs);
+    _java_thread->oops_do(
+        &mark_and_push_closure,
+        &mark_and_push_from_clds,
+        &mark_and_push_in_blobs);
 
   if (_vm_thread != NULL)
-    _vm_thread->oops_do(&mark_and_push_closure, &mark_and_push_in_blobs);
+    _vm_thread->oops_do(
+        &mark_and_push_closure,
+        &mark_and_push_from_clds,
+        &mark_and_push_in_blobs);
 
   // Do the real work
   cm->follow_marking_stacks();
@@ -89,7 +97,8 @@
     {
       ResourceMark rm;
       CodeBlobToOopClosure each_active_code_blob(&mark_and_push_closure, /*do_marking=*/ true);
-      Threads::oops_do(&mark_and_push_closure, &each_active_code_blob);
+      CLDToOopClosure mark_and_push_from_cld(&mark_and_push_closure);
+      Threads::oops_do(&mark_and_push_closure, &mark_and_push_from_cld, &each_active_code_blob);
     }
     break;
 
--- a/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -495,8 +495,9 @@
     ParallelScavengeHeap::ParStrongRootsScope psrs;
     Universe::oops_do(mark_and_push_closure());
     JNIHandles::oops_do(mark_and_push_closure());   // Global (strong) JNI handles
+    CLDToOopClosure mark_and_push_from_cld(mark_and_push_closure());
     CodeBlobToOopClosure each_active_code_blob(mark_and_push_closure(), /*do_marking=*/ true);
-    Threads::oops_do(mark_and_push_closure(), &each_active_code_blob);
+    Threads::oops_do(mark_and_push_closure(), &mark_and_push_from_cld, &each_active_code_blob);
     ObjectSynchronizer::oops_do(mark_and_push_closure());
     FlatProfiler::oops_do(mark_and_push_closure());
     Management::oops_do(mark_and_push_closure());
@@ -584,7 +585,8 @@
   // General strong roots.
   Universe::oops_do(adjust_root_pointer_closure());
   JNIHandles::oops_do(adjust_root_pointer_closure());   // Global (strong) JNI handles
-  Threads::oops_do(adjust_root_pointer_closure(), NULL);
+  CLDToOopClosure adjust_from_cld(adjust_root_pointer_closure());
+  Threads::oops_do(adjust_root_pointer_closure(), &adjust_from_cld, NULL);
   ObjectSynchronizer::oops_do(adjust_root_pointer_closure());
   FlatProfiler::oops_do(adjust_root_pointer_closure());
   Management::oops_do(adjust_root_pointer_closure());
--- a/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -2436,7 +2436,8 @@
   // General strong roots.
   Universe::oops_do(adjust_root_pointer_closure());
   JNIHandles::oops_do(adjust_root_pointer_closure());   // Global (strong) JNI handles
-  Threads::oops_do(adjust_root_pointer_closure(), NULL);
+  CLDToOopClosure adjust_from_cld(adjust_root_pointer_closure());
+  Threads::oops_do(adjust_root_pointer_closure(), &adjust_from_cld, NULL);
   ObjectSynchronizer::oops_do(adjust_root_pointer_closure());
   FlatProfiler::oops_do(adjust_root_pointer_closure());
   Management::oops_do(adjust_root_pointer_closure());
--- a/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -65,7 +65,8 @@
     case threads:
     {
       ResourceMark rm;
-      Threads::oops_do(&roots_closure, NULL);
+      CLDToOopClosure* cld_closure = NULL; // Not needed. All CLDs are already visited.
+      Threads::oops_do(&roots_closure, cld_closure, NULL);
     }
     break;
 
@@ -120,13 +121,14 @@
 
   PSPromotionManager* pm = PSPromotionManager::gc_thread_promotion_manager(which);
   PSScavengeRootsClosure roots_closure(pm);
+  CLDToOopClosure* roots_from_clds = NULL;  // Not needed. All CLDs are already visited.
   CodeBlobToOopClosure roots_in_blobs(&roots_closure, /*do_marking=*/ true);
 
   if (_java_thread != NULL)
-    _java_thread->oops_do(&roots_closure, &roots_in_blobs);
+    _java_thread->oops_do(&roots_closure, roots_from_clds, &roots_in_blobs);
 
   if (_vm_thread != NULL)
-    _vm_thread->oops_do(&roots_closure, &roots_in_blobs);
+    _vm_thread->oops_do(&roots_closure, roots_from_clds, &roots_in_blobs);
 
   // Do the real work
   pm->drain_stacks(false);
--- a/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -28,19 +28,7 @@
 #include "gc_implementation/shared/spaceDecorator.hpp"
 #include "memory/sharedHeap.hpp"
 #include "oops/oop.inline.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
-
+#include "runtime/thread.inline.hpp"
 
 MutableNUMASpace::MutableNUMASpace(size_t alignment) : MutableSpace(alignment) {
   _lgrp_spaces = new (ResourceObj::C_HEAP, mtGC) GrowableArray<LGRPSpace*>(0, true);
--- a/src/share/vm/gc_interface/collectedHeap.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/gc_interface/collectedHeap.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -30,19 +30,8 @@
 #include "oops/oop.inline.hpp"
 #include "oops/instanceMirrorKlass.hpp"
 #include "runtime/init.hpp"
+#include "runtime/thread.inline.hpp"
 #include "services/heapDumper.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 
 #ifdef ASSERT
--- a/src/share/vm/gc_interface/collectedHeap.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/gc_interface/collectedHeap.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -289,11 +289,6 @@
   // (A scavenge is a GC which is not a full GC.)
   virtual bool is_scavengable(const void *p) = 0;
 
-  // Returns "TRUE" if "p" is a method oop in the
-  // current heap, with high probability. This predicate
-  // is not stable, in general.
-  bool is_valid_method(Method* p) const;
-
   void set_gc_cause(GCCause::Cause v) {
      if (UsePerfData) {
        _gc_lastcause = _gc_cause;
--- a/src/share/vm/gc_interface/collectedHeap.inline.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/gc_interface/collectedHeap.inline.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -31,21 +31,9 @@
 #include "oops/arrayOop.hpp"
 #include "prims/jvmtiExport.hpp"
 #include "runtime/sharedRuntime.hpp"
-#include "runtime/thread.hpp"
+#include "runtime/thread.inline.hpp"
 #include "services/lowMemoryDetector.hpp"
 #include "utilities/copy.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 // Inline allocation implementations.
 
@@ -242,36 +230,6 @@
   return (oop)obj;
 }
 
-// Returns "TRUE" if "p" is a method oop in the
-// current heap with high probability. NOTE: The main
-// current consumers of this interface are Forte::
-// and ThreadProfiler::. In these cases, the
-// interpreter frame from which "p" came, may be
-// under construction when sampled asynchronously, so
-// the clients want to check that it represents a
-// valid method before using it. Nonetheless since
-// the clients do not typically lock out GC, the
-// predicate is_valid_method() is not stable, so
-// it is possible that by the time "p" is used, it
-// is no longer valid.
-inline bool CollectedHeap::is_valid_method(Method* p) const {
-  return
-    p != NULL &&
-
-    // Check whether "method" is metadata
-    p->is_metadata() &&
-
-    // See if GC is active; however, there is still an
-    // apparently unavoidable window after this call
-    // and before the client of this interface uses "p".
-    // If the client chooses not to lock out GC, then
-    // it's a risk the client must accept.
-    !is_gc_active() &&
-
-    // Check that p is a Method*.
-    p->is_method();
-}
-
 inline void CollectedHeap::oop_iterate_no_header(OopClosure* cl) {
   NoHeaderExtendedOopClosure no_header_cl(cl);
   oop_iterate(&no_header_cl);
--- a/src/share/vm/interpreter/abstractInterpreter.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/interpreter/abstractInterpreter.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -27,6 +27,7 @@
 
 #include "code/stubs.hpp"
 #include "interpreter/bytecodes.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/vmThread.hpp"
 #include "utilities/top.hpp"
 #ifdef TARGET_ARCH_MODEL_x86_32
@@ -47,18 +48,6 @@
 #ifdef TARGET_ARCH_MODEL_ppc
 # include "interp_masm_ppc.hpp"
 #endif
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 // This file contains the platform-independent parts
 // of the abstract interpreter and the abstract interpreter generator.
--- a/src/share/vm/interpreter/interpreterRuntime.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/interpreter/interpreterRuntime.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -31,19 +31,8 @@
 #include "oops/method.hpp"
 #include "runtime/frame.inline.hpp"
 #include "runtime/signature.hpp"
+#include "runtime/thread.inline.hpp"
 #include "utilities/top.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 // The InterpreterRuntime is called by the interpreter for everything
 // that cannot/should not be dealt with in assembly and needs C support.
--- a/src/share/vm/interpreter/linkResolver.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/interpreter/linkResolver.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -43,19 +43,8 @@
 #include "runtime/handles.inline.hpp"
 #include "runtime/reflection.hpp"
 #include "runtime/signature.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/vmThread.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 //------------------------------------------------------------------------------------------------------------------------
 // Implementation of FieldAccessInfo
--- a/src/share/vm/memory/allocation.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/memory/allocation.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -66,10 +66,17 @@
 }
 
 bool MetaspaceObj::is_metadata() const {
-  // ClassLoaderDataGraph::contains((address)this); has lock inversion problems
+  // GC Verify checks use this in guarantees.
+  // TODO: either replace them with is_metaspace_object() or remove them.
+  // is_metaspace_object() is slower than this test.  This test doesn't
+  // seem very useful for metaspace objects anymore though.
   return !Universe::heap()->is_in_reserved(this);
 }
 
+bool MetaspaceObj::is_metaspace_object() const {
+  return Metaspace::contains((void*)this);
+}
+
 void MetaspaceObj::print_address_on(outputStream* st) const {
   st->print(" {"INTPTR_FORMAT"}", this);
 }
--- a/src/share/vm/memory/allocation.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/memory/allocation.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -245,6 +245,7 @@
 class MetaspaceObj {
  public:
   bool is_metadata() const;
+  bool is_metaspace_object() const;  // more specific test but slower
   bool is_shared() const;
   void print_address_on(outputStream* st) const;  // nonvirtual address printing
 
--- a/src/share/vm/memory/binaryTreeDictionary.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/memory/binaryTreeDictionary.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -290,7 +290,7 @@
   assert(chunk->list() == this, "list should be set for chunk");
   assert(tail() != NULL, "The tree list is embedded in the first chunk");
   // which means that the list can never be empty.
-  assert(!verify_chunk_in_free_list(chunk), "Double entry");
+  assert(!this->verify_chunk_in_free_list(chunk), "Double entry");
   assert(head() == NULL || head()->prev() == NULL, "list invariant");
   assert(tail() == NULL || tail()->next() == NULL, "list invariant");
 
@@ -300,7 +300,7 @@
 
   assert(!tail() || size() == tail()->size(), "Wrong sized chunk in list");
   FreeList_t<Chunk_t>::increment_count();
-  debug_only(increment_returned_bytes_by(chunk->size()*sizeof(HeapWord));)
+  debug_only(this->increment_returned_bytes_by(chunk->size()*sizeof(HeapWord));)
   assert(head() == NULL || head()->prev() == NULL, "list invariant");
   assert(tail() == NULL || tail()->next() == NULL, "list invariant");
 }
@@ -314,7 +314,7 @@
   assert(chunk->list() == this, "list should be set for chunk");
   assert(head() != NULL, "The tree list is embedded in the first chunk");
   assert(chunk != NULL, "returning NULL chunk");
-  assert(!verify_chunk_in_free_list(chunk), "Double entry");
+  assert(!this->verify_chunk_in_free_list(chunk), "Double entry");
   assert(head() == NULL || head()->prev() == NULL, "list invariant");
   assert(tail() == NULL || tail()->next() == NULL, "list invariant");
 
@@ -328,7 +328,7 @@
   head()->link_after(chunk);
   assert(!head() || size() == head()->size(), "Wrong sized chunk in list");
   FreeList_t<Chunk_t>::increment_count();
-  debug_only(increment_returned_bytes_by(chunk->size()*sizeof(HeapWord));)
+  debug_only(this->increment_returned_bytes_by(chunk->size()*sizeof(HeapWord));)
   assert(head() == NULL || head()->prev() == NULL, "list invariant");
   assert(tail() == NULL || tail()->next() == NULL, "list invariant");
 }
--- a/src/share/vm/memory/collectorPolicy.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/memory/collectorPolicy.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -37,19 +37,8 @@
 #include "runtime/globals_extension.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/java.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/vmThread.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 #ifndef SERIALGC
 #include "gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp"
 #include "gc_implementation/concurrentMarkSweep/cmsGCAdaptivePolicyCounters.hpp"
--- a/src/share/vm/memory/defNewGeneration.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/memory/defNewGeneration.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -38,20 +38,9 @@
 #include "oops/instanceRefKlass.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/java.hpp"
+#include "runtime/thread.inline.hpp"
 #include "utilities/copy.hpp"
 #include "utilities/stack.inline.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 //
 // DefNewGeneration functions.
--- a/src/share/vm/memory/filemap.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/memory/filemap.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "classfile/classLoader.hpp"
 #include "classfile/symbolTable.hpp"
+#include "classfile/altHashing.hpp"
 #include "memory/filemap.hpp"
 #include "runtime/arguments.hpp"
 #include "runtime/java.hpp"
@@ -82,8 +83,37 @@
   close();
 }
 
+// Fill in the fileMapInfo structure with data about this VM instance.
 
-// Fill in the fileMapInfo structure with data about this VM instance.
+// This method copies the vm version info into header_version.  If the version is too
+// long then a truncated version, which has a hash code appended to it, is copied.
+//
+// Using a template enables this method to verify that header_version is an array of
+// length JVM_IDENT_MAX.  This ensures that the code that writes to the CDS file and
+// the code that reads the CDS file will both use the same size buffer.  Hence, will
+// use identical truncation.  This is necessary for matching of truncated versions.
+template <int N> static void get_header_version(char (&header_version) [N]) {
+  assert(N == JVM_IDENT_MAX, "Bad header_version size");
+
+  const char *vm_version = VM_Version::internal_vm_info_string();
+  const int version_len = (int)strlen(vm_version);
+
+  if (version_len < (JVM_IDENT_MAX-1)) {
+    strcpy(header_version, vm_version);
+
+  } else {
+    // Get the hash value.  Use a static seed because the hash needs to return the same
+    // value over multiple jvm invocations.
+    unsigned int hash = AltHashing::murmur3_32(8191, (const jbyte*)vm_version, version_len);
+
+    // Truncate the ident, saving room for the 8 hex character hash value.
+    strncpy(header_version, vm_version, JVM_IDENT_MAX-9);
+
+    // Append the hash code as eight hex digits.
+    sprintf(&header_version[JVM_IDENT_MAX-9], "%08x", hash);
+    header_version[JVM_IDENT_MAX-1] = 0;  // Null terminate.
+  }
+}
 
 void FileMapInfo::populate_header(size_t alignment) {
   _header._magic = 0xf00baba2;
@@ -95,13 +125,7 @@
   // invoked with.
 
   // JVM version string ... changes on each build.
-  const char *vm_version = VM_Version::internal_vm_info_string();
-  if (strlen(vm_version) < (JVM_IDENT_MAX-1)) {
-    strcpy(_header._jvm_ident, vm_version);
-  } else {
-    fail_stop("JVM Ident field for shared archive is too long"
-              " - truncated to <%s>", _header._jvm_ident);
-  }
+  get_header_version(_header._jvm_ident);
 
   // Build checks on classpath and jar files
   _header._num_jars = 0;
@@ -434,8 +458,9 @@
     fail_continue("The shared archive file has a bad magic number.");
     return false;
   }
-  if (strncmp(_header._jvm_ident, VM_Version::internal_vm_info_string(),
-              JVM_IDENT_MAX-1) != 0) {
+  char header_version[JVM_IDENT_MAX];
+  get_header_version(header_version);
+  if (strncmp(_header._jvm_ident, header_version, JVM_IDENT_MAX-1) != 0) {
     fail_continue("The shared archive file was created by a different"
                   " version or build of HotSpot.");
     return false;
--- a/src/share/vm/memory/freeBlockDictionary.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/memory/freeBlockDictionary.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -29,18 +29,7 @@
 #include "memory/freeBlockDictionary.hpp"
 #include "memory/metablock.hpp"
 #include "memory/metachunk.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
+#include "runtime/thread.inline.hpp"
 
 #ifndef PRODUCT
 template <class Chunk> Mutex* FreeBlockDictionary<Chunk>::par_lock() const {
--- a/src/share/vm/memory/gcLocker.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/memory/gcLocker.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -29,21 +29,18 @@
 #include "memory/genCollectedHeap.hpp"
 #include "memory/universe.hpp"
 #include "oops/oop.hpp"
+#include "runtime/thread.inline.hpp"
 #ifdef TARGET_OS_FAMILY_linux
 # include "os_linux.inline.hpp"
-# include "thread_linux.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_solaris
 # include "os_solaris.inline.hpp"
-# include "thread_solaris.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
-# include "thread_windows.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_bsd
 # include "os_bsd.inline.hpp"
-# include "thread_bsd.inline.hpp"
 #endif
 
 // The direct lock/unlock calls do not force a collection if an unlock
--- a/src/share/vm/memory/genMarkSweep.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/memory/genMarkSweep.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -43,21 +43,10 @@
 #include "runtime/fprofiler.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/synchronizer.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/vmThread.hpp"
 #include "utilities/copy.hpp"
 #include "utilities/events.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp,
   bool clear_all_softrefs) {
--- a/src/share/vm/memory/iterator.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/memory/iterator.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -30,6 +30,10 @@
   k->oops_do(_oop_closure);
 }
 
+void CLDToOopClosure::do_cld(ClassLoaderData* cld) {
+  cld->oops_do(_oop_closure, &_klass_closure, _must_claim_cld);
+}
+
 void ObjectToOopClosure::do_object(oop obj) {
   obj->oop_iterate(_cl);
 }
--- a/src/share/vm/memory/iterator.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/memory/iterator.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -135,6 +135,20 @@
   virtual void do_klass(Klass* k);
 };
 
+class CLDToOopClosure {
+  OopClosure* _oop_closure;
+  KlassToOopClosure _klass_closure;
+  bool _must_claim_cld;
+
+ public:
+  CLDToOopClosure(OopClosure* oop_closure, bool must_claim_cld = true) :
+      _oop_closure(oop_closure),
+      _klass_closure(oop_closure),
+      _must_claim_cld(must_claim_cld) {}
+
+  void do_cld(ClassLoaderData* cld);
+};
+
 // ObjectClosure is used for iterating through an object space
 
 class ObjectClosure : public Closure {
--- a/src/share/vm/memory/metaspace.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/memory/metaspace.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -36,6 +36,7 @@
 #include "memory/universe.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/mutex.hpp"
+#include "runtime/orderAccess.hpp"
 #include "services/memTracker.hpp"
 #include "utilities/copy.hpp"
 #include "utilities/debug.hpp"
@@ -1007,6 +1008,8 @@
     delete new_entry;
     return false;
   } else {
+    // ensure lock-free iteration sees fully initialized node
+    OrderAccess::storestore();
     link_vs(new_entry, vs_word_size);
     return true;
   }
@@ -1096,7 +1099,6 @@
   }
 }
 
-#ifndef PRODUCT
 bool VirtualSpaceList::contains(const void *ptr) {
   VirtualSpaceNode* list = virtual_space_list();
   VirtualSpaceListIterator iter(list);
@@ -1108,7 +1110,6 @@
   }
   return false;
 }
-#endif // PRODUCT
 
 
 // MetaspaceGC methods
@@ -2739,15 +2740,17 @@
   }
 }
 
-#ifndef PRODUCT
-bool Metaspace::contains(const void * ptr) const {
+bool Metaspace::contains(const void * ptr) {
   if (MetaspaceShared::is_in_shared_space(ptr)) {
     return true;
   }
-  MutexLockerEx cl(SpaceManager::expand_lock(), Mutex::_no_safepoint_check_flag);
+  // This is checked while unlocked.  As long as the virtualspaces are added
+  // at the end, the pointer will be in one of them.  The virtual spaces
+  // aren't deleted presently.  When they are, some sort of locking might
+  // be needed.  Note, locking this can cause inversion problems with the
+  // caller in MetaspaceObj::is_metadata() function.
   return space_list()->contains(ptr) || class_space_list()->contains(ptr);
 }
-#endif
 
 void Metaspace::verify() {
   vsm()->verify();
--- a/src/share/vm/memory/metaspace.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/memory/metaspace.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -135,11 +135,7 @@
 
   static bool is_initialized() { return _class_space_list != NULL; }
 
-#ifndef PRODUCT
-  bool contains(const void *ptr) const;
-  bool contains_class(const void *ptr) const;
-#endif
-
+  static bool contains(const void *ptr);
   void dump(outputStream* const out) const;
 
   void print_on(outputStream* st) const;
--- a/src/share/vm/memory/resourceArea.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/memory/resourceArea.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -26,18 +26,7 @@
 #include "memory/allocation.inline.hpp"
 #include "memory/resourceArea.hpp"
 #include "runtime/mutexLocker.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
+#include "runtime/thread.inline.hpp"
 
 //------------------------------ResourceMark-----------------------------------
 debug_only(int ResourceArea::_warned;)      // to suppress multiple warnings
--- a/src/share/vm/memory/resourceArea.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/memory/resourceArea.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -26,18 +26,7 @@
 #define SHARE_VM_MEMORY_RESOURCEAREA_HPP
 
 #include "memory/allocation.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
+#include "runtime/thread.inline.hpp"
 
 // The resource area holds temporary data structures in the VM.
 // The actual allocation areas are thread local. Typical usage:
--- a/src/share/vm/memory/sharedHeap.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/memory/sharedHeap.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -154,10 +154,12 @@
   if (!_process_strong_tasks->is_task_claimed(SH_PS_JNIHandles_oops_do))
     JNIHandles::oops_do(roots);
   // All threads execute this; the individual threads are task groups.
+  CLDToOopClosure roots_from_clds(roots);
+  CLDToOopClosure* roots_from_clds_p = (is_scavenging ? NULL : &roots_from_clds);
   if (ParallelGCThreads > 0) {
-    Threads::possibly_parallel_oops_do(roots, code_roots);
+    Threads::possibly_parallel_oops_do(roots, roots_from_clds_p ,code_roots);
   } else {
-    Threads::oops_do(roots, code_roots);
+    Threads::oops_do(roots, roots_from_clds_p, code_roots);
   }
   if (!_process_strong_tasks-> is_task_claimed(SH_PS_ObjectSynchronizer_oops_do))
     ObjectSynchronizer::oops_do(roots);
--- a/src/share/vm/memory/space.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/memory/space.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -790,7 +790,9 @@
 
 // Very general, slow implementation.
 HeapWord* ContiguousSpace::block_start_const(const void* p) const {
-  assert(MemRegion(bottom(), end()).contains(p), "p not in space");
+  assert(MemRegion(bottom(), end()).contains(p),
+         err_msg("p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")",
+                  p, bottom(), end()));
   if (p >= top()) {
     return top();
   } else {
@@ -800,19 +802,27 @@
       last = cur;
       cur += oop(cur)->size();
     }
-    assert(oop(last)->is_oop(), "Should be an object start");
+    assert(oop(last)->is_oop(),
+           err_msg(PTR_FORMAT " should be an object start", last));
     return last;
   }
 }
 
 size_t ContiguousSpace::block_size(const HeapWord* p) const {
-  assert(MemRegion(bottom(), end()).contains(p), "p not in space");
+  assert(MemRegion(bottom(), end()).contains(p),
+         err_msg("p (" PTR_FORMAT ") not in space [" PTR_FORMAT ", " PTR_FORMAT ")",
+                  p, bottom(), end()));
   HeapWord* current_top = top();
-  assert(p <= current_top, "p is not a block start");
-  assert(p == current_top || oop(p)->is_oop(), "p is not a block start");
-  if (p < current_top)
+  assert(p <= current_top,
+         err_msg("p > current top - p: " PTR_FORMAT ", current top: " PTR_FORMAT,
+                  p, current_top));
+  assert(p == current_top || oop(p)->is_oop(),
+         err_msg("p (" PTR_FORMAT ") is not a block start - "
+                 "current_top: " PTR_FORMAT ", is_oop: %s",
+                 p, current_top, BOOL_TO_STR(oop(p)->is_oop())));
+  if (p < current_top) {
     return oop(p)->size();
-  else {
+  } else {
     assert(p == current_top, "just checking");
     return pointer_delta(end(), (HeapWord*) p);
   }
--- a/src/share/vm/memory/threadLocalAllocBuffer.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/memory/threadLocalAllocBuffer.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -28,19 +28,8 @@
 #include "memory/threadLocalAllocBuffer.inline.hpp"
 #include "memory/universe.inline.hpp"
 #include "oops/oop.inline.hpp"
+#include "runtime/thread.inline.hpp"
 #include "utilities/copy.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 // Thread-Local Edens support
 
--- a/src/share/vm/memory/universe.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/memory/universe.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -62,6 +62,7 @@
 #include "runtime/javaCalls.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/synchronizer.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/timer.hpp"
 #include "runtime/vm_operations.hpp"
 #include "services/memoryService.hpp"
@@ -69,18 +70,6 @@
 #include "utilities/events.hpp"
 #include "utilities/hashtable.inline.hpp"
 #include "utilities/preserveException.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 #ifndef SERIALGC
 #include "gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp"
 #include "gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp"
@@ -425,14 +414,10 @@
 // from MetaspaceObj, because the latter does not have virtual functions.
 // If the metadata type has a vtable, it cannot be shared in the read-only
 // section of the CDS archive, because the vtable pointer is patched.
-static inline void* dereference(void* addr) {
-  return *(void**)addr;
-}
-
 static inline void add_vtable(void** list, int* n, void* o, int count) {
   guarantee((*n) < count, "vtable list too small");
-  void* vtable = dereference(o);
-  assert(dereference(vtable) != NULL, "invalid vtable");
+  void* vtable = dereference_vptr(o);
+  assert(*(void**)(vtable) != NULL, "invalid vtable");
   list[(*n)++] = vtable;
 }
 
--- a/src/share/vm/oops/compiledICHolder.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/oops/compiledICHolder.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -48,8 +48,8 @@
 // Verification
 
 void CompiledICHolder::verify_on(outputStream* st) {
-  guarantee(holder_method()->is_metadata(),   "should be in permspace");
+  guarantee(holder_method()->is_metadata(),   "should be in metaspace");
   guarantee(holder_method()->is_method(), "should be method");
-  guarantee(holder_klass()->is_metadata(),    "should be in permspace");
+  guarantee(holder_klass()->is_metadata(),    "should be in metaspace");
   guarantee(holder_klass()->is_klass(),   "should be klass");
 }
--- a/src/share/vm/oops/instanceKlass.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/oops/instanceKlass.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -51,20 +51,9 @@
 #include "runtime/handles.inline.hpp"
 #include "runtime/javaCalls.hpp"
 #include "runtime/mutexLocker.hpp"
+#include "runtime/thread.inline.hpp"
 #include "services/threadService.hpp"
 #include "utilities/dtrace.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 #ifndef SERIALGC
 #include "gc_implementation/concurrentMarkSweep/cmsOopClosures.inline.hpp"
 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
--- a/src/share/vm/oops/markOop.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/oops/markOop.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -24,19 +24,7 @@
 
 #include "precompiled.hpp"
 #include "oops/markOop.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
-
+#include "runtime/thread.inline.hpp"
 
 void markOopDesc::print_on(outputStream* st) const {
   if (is_locked()) {
--- a/src/share/vm/oops/method.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/oops/method.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -1818,6 +1818,23 @@
   loader_data->jmethod_ids()->clear_all_methods();
 }
 
+
+// Check that this pointer is valid by checking that the vtbl pointer matches
+bool Method::is_valid_method() const {
+  if (this == NULL) {
+    return false;
+  } else if (!is_metaspace_object()) {
+    return false;
+  } else {
+    Method m;
+    // This assumes that the vtbl pointer is the first word of a C++ object.
+    // This assumption is also in universe.cpp patch_klass_vtble
+    void* vtbl2 = dereference_vptr((void*)&m);
+    void* this_vtbl = dereference_vptr((void*)this);
+    return vtbl2 == this_vtbl;
+  }
+}
+
 #ifndef PRODUCT
 void Method::print_jmethod_ids(ClassLoaderData* loader_data, outputStream* out) {
   out->print_cr("jni_method_id count = %d", loader_data->jmethod_ids()->count_methods());
@@ -1939,7 +1956,7 @@
   guarantee(constMethod()->is_metadata(), "should be metadata");
   MethodData* md = method_data();
   guarantee(md == NULL ||
-      md->is_metadata(), "should be in permspace");
+      md->is_metadata(), "should be metadata");
   guarantee(md == NULL ||
       md->is_methodData(), "should be method data");
 }
--- a/src/share/vm/oops/method.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/oops/method.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -167,7 +167,8 @@
                           ConstMethod::MethodType method_type,
                           TRAPS);
 
-  Method() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }
+  // CDS and vtbl checking can create an empty Method to get vtbl pointer.
+  Method(){}
 
   // The Method vtable is restored by this call when the Method is in the
   // shared archive.  See patch_klass_vtables() in metaspaceShared.cpp for
@@ -809,6 +810,9 @@
 
   const char* internal_name() const { return "{method}"; }
 
+  // Check for valid method pointer
+  bool is_valid_method() const;
+
   // Verify
   void verify() { verify_on(tty); }
   void verify_on(outputStream* st);
--- a/src/share/vm/oops/oop.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/oops/oop.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -27,19 +27,8 @@
 #include "classfile/javaClasses.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/handles.inline.hpp"
+#include "runtime/thread.inline.hpp"
 #include "utilities/copy.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 bool always_do_update_barrier = false;
 
--- a/src/share/vm/oops/oopsHierarchy.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/oops/oopsHierarchy.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -26,20 +26,8 @@
 #include "gc_interface/collectedHeap.hpp"
 #include "gc_interface/collectedHeap.inline.hpp"
 #include "oops/oopsHierarchy.hpp"
-#include "runtime/thread.hpp"
+#include "runtime/thread.inline.hpp"
 #include "utilities/globalDefinitions.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 #ifdef CHECK_UNHANDLED_OOPS
 
--- a/src/share/vm/prims/forte.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/prims/forte.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -216,10 +216,7 @@
     // not yet valid.
 
     *method_p = method;
-
-    // See if gc may have invalidated method since we validated frame
-
-    if (!Universe::heap()->is_valid_method(method)) return false;
+    if (!method->is_valid_method()) return false;
 
     intptr_t bcx = fr->interpreter_frame_bcx();
 
@@ -394,19 +391,11 @@
   bool fully_decipherable = find_initial_Java_frame(thd, &top_frame, &initial_Java_frame, &method, &bci);
 
   // The frame might not be walkable but still recovered a method
-  // (e.g. an nmethod with no scope info for the pc
+  // (e.g. an nmethod with no scope info for the pc)
 
   if (method == NULL) return;
 
-  CollectedHeap* ch = Universe::heap();
-
-  // The method is not stored GC safe so see if GC became active
-  // after we entered AsyncGetCallTrace() and before we try to
-  // use the Method*.
-  // Yes, there is still a window after this check and before
-  // we use Method* below, but we can't lock out GC so that
-  // has to be an acceptable risk.
-  if (!ch->is_valid_method(method)) {
+  if (!method->is_valid_method()) {
     trace->num_frames = ticks_GC_active; // -2
     return;
   }
@@ -440,13 +429,7 @@
     bci = st.bci();
     method = st.method();
 
-    // The method is not stored GC safe so see if GC became active
-    // after we entered AsyncGetCallTrace() and before we try to
-    // use the Method*.
-    // Yes, there is still a window after this check and before
-    // we use Method* below, but we can't lock out GC so that
-    // has to be an acceptable risk.
-    if (!ch->is_valid_method(method)) {
+    if (!method->is_valid_method()) {
       // we throw away everything we've gathered in this sample since
       // none of it is safe
       trace->num_frames = ticks_GC_active; // -2
--- a/src/share/vm/prims/jni.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/prims/jni.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -69,6 +69,7 @@
 #include "runtime/reflection.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/signature.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/vm_operations.hpp"
 #include "services/runtimeService.hpp"
 #include "trace/tracing.hpp"
@@ -79,19 +80,15 @@
 #include "utilities/histogram.hpp"
 #ifdef TARGET_OS_FAMILY_linux
 # include "os_linux.inline.hpp"
-# include "thread_linux.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_solaris
 # include "os_solaris.inline.hpp"
-# include "thread_solaris.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
-# include "thread_windows.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_bsd
 # include "os_bsd.inline.hpp"
-# include "thread_bsd.inline.hpp"
 #endif
 
 static jint CurrentVersion = JNI_VERSION_1_6;
@@ -5044,6 +5041,9 @@
 
 #include "gc_interface/collectedHeap.hpp"
 #include "utilities/quickSort.hpp"
+#if INCLUDE_VM_STRUCTS
+#include "runtime/vmStructs.hpp"
+#endif
 
 #define run_unit_test(unit_test_function_call)              \
   tty->print_cr("Running test: " #unit_test_function_call); \
@@ -5056,6 +5056,9 @@
     run_unit_test(CollectedHeap::test_is_in());
     run_unit_test(QuickSort::test_quick_sort());
     run_unit_test(AltHashing::test_alt_hash());
+#if INCLUDE_VM_STRUCTS
+    run_unit_test(VMStructs::test());
+#endif
     tty->print_cr("All internal VM tests passed");
   }
 }
--- a/src/share/vm/prims/jvmti.xml	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/prims/jvmti.xml	Thu Nov 29 13:55:49 2012 -0800
@@ -2370,11 +2370,11 @@
 jvmtiError err;
 
 err = (*jvmti)-&gt;GetStackTrace(jvmti, aThread, 0, 5, 
-                               &amp;frames, &amp;count);
+                               frames, &amp;count);
 if (err == JVMTI_ERROR_NONE &amp;&amp; count &gt;= 1) {
    char *methodName;
    err = (*jvmti)-&gt;GetMethodName(jvmti, frames[0].method, 
-                       &amp;methodName, NULL);
+                       &amp;methodName, NULL, NULL);
    if (err == JVMTI_ERROR_NONE) {
       printf("Executing method: %s", methodName);
    }
--- a/src/share/vm/prims/jvmtiEnv.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/prims/jvmtiEnv.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -53,24 +53,12 @@
 #include "runtime/osThread.hpp"
 #include "runtime/reflectionUtils.hpp"
 #include "runtime/signature.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/vframe.hpp"
 #include "runtime/vmThread.hpp"
 #include "services/threadService.hpp"
 #include "utilities/exceptions.hpp"
 #include "utilities/preserveException.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
-
 
 
 #define FIXLATER 0 // REMOVE this when completed.
--- a/src/share/vm/prims/jvmtiImpl.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/prims/jvmtiImpl.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -41,22 +41,11 @@
 #include "runtime/os.hpp"
 #include "runtime/serviceThread.hpp"
 #include "runtime/signature.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/vframe.hpp"
 #include "runtime/vframe_hp.hpp"
 #include "runtime/vm_operations.hpp"
 #include "utilities/exceptions.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 //
 // class JvmtiAgentThread
--- a/src/share/vm/runtime/arguments.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/arguments.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -1485,14 +1485,6 @@
       }
     }
   }
-  if (UseNUMA) {
-    if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) {
-      FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M);
-    }
-    // For those collectors or operating systems (eg, Windows) that do
-    // not support full UseNUMA, we will map to UseNUMAInterleaving for now
-    UseNUMAInterleaving = true;
-  }
 }
 
 void Arguments::set_g1_gc_flags() {
@@ -3332,6 +3324,22 @@
   return JNI_OK;
 }
 
+jint Arguments::adjust_after_os() {
+#if INCLUDE_ALTERNATE_GCS
+  if (UseParallelGC || UseParallelOldGC) {
+    if (UseNUMA) {
+      if (FLAG_IS_DEFAULT(MinHeapDeltaBytes)) {
+        FLAG_SET_DEFAULT(MinHeapDeltaBytes, 64*M);
+      }
+      // For those collectors or operating systems (eg, Windows) that do
+      // not support full UseNUMA, we will map to UseNUMAInterleaving for now
+      UseNUMAInterleaving = true;
+    }
+  }
+#endif
+  return JNI_OK;
+}
+
 int Arguments::PropertyList_count(SystemProperty* pl) {
   int count = 0;
   while(pl != NULL) {
--- a/src/share/vm/runtime/arguments.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/arguments.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -409,6 +409,8 @@
  public:
   // Parses the arguments
   static jint parse(const JavaVMInitArgs* args);
+  // Adjusts the arguments after the OS have adjusted the arguments
+  static jint adjust_after_os();
   // Check for consistency in the selection of the garbage collector.
   static bool check_gc_consistency();
   // Check consistecy or otherwise of VM argument settings
--- a/src/share/vm/runtime/deoptimization.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/deoptimization.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -721,7 +721,7 @@
         guarantee(false, "wrong number of expression stack elements during deopt");
       }
       VerifyOopClosure verify;
-      iframe->oops_interpreted_do(&verify, &rm, false);
+      iframe->oops_interpreted_do(&verify, NULL, &rm, false);
       callee_size_of_parameters = mh->size_of_parameters();
       callee_max_locals = mh->max_locals();
       is_top_frame = false;
--- a/src/share/vm/runtime/fprofiler.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/fprofiler.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -26,18 +26,6 @@
 #define SHARE_VM_RUNTIME_FPROFILER_HPP
 
 #include "runtime/timer.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 // a simple flat profiler for Java
 
--- a/src/share/vm/runtime/frame.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/frame.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -879,7 +879,8 @@
 }
 
 
-void frame::oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache) {
+void frame::oops_interpreted_do(OopClosure* f, CLDToOopClosure* cld_f,
+    const RegisterMap* map, bool query_oop_map_cache) {
   assert(is_interpreted_frame(), "Not an interpreted frame");
   assert(map != NULL, "map must be set");
   Thread *thread = Thread::current();
@@ -906,6 +907,16 @@
   }
 
   // process fixed part
+  if (cld_f != NULL) {
+    // The method pointer in the frame might be the only path to the method's
+    // klass, and the klass needs to be kept alive while executing. The GCs
+    // don't trace through method pointers, so typically in similar situations
+    // the mirror or the class loader of the klass are installed as a GC root.
+    // To minimze the overhead of doing that here, we ask the GC to pass down a
+    // closure that knows how to keep klasses alive given a ClassLoaderData.
+    cld_f->do_cld(m->method_holder()->class_loader_data());
+  }
+
 #if !defined(PPC) || defined(ZERO)
   if (m->is_native()) {
 #ifdef CC_INTERP
@@ -1108,7 +1119,7 @@
 }
 
 
-void frame::oops_do_internal(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache) {
+void frame::oops_do_internal(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache) {
 #ifndef PRODUCT
   // simulate GC crash here to dump java thread in error report
   if (CrashGCForDumpingJavaThread) {
@@ -1117,7 +1128,7 @@
   }
 #endif
   if (is_interpreted_frame()) {
-    oops_interpreted_do(f, map, use_interpreter_oop_map_cache);
+    oops_interpreted_do(f, cld_f, map, use_interpreter_oop_map_cache);
   } else if (is_entry_frame()) {
     oops_entry_do(f, map);
   } else if (CodeCache::contains(pc())) {
@@ -1278,7 +1289,7 @@
     }
   }
   COMPILER2_PRESENT(assert(DerivedPointerTable::is_empty(), "must be empty before verify");)
-  oops_do_internal(&VerifyOopClosure::verify_oop, NULL, (RegisterMap*)map, false);
+  oops_do_internal(&VerifyOopClosure::verify_oop, NULL, NULL, (RegisterMap*)map, false);
 }
 
 
--- a/src/share/vm/runtime/frame.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/frame.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -413,19 +413,19 @@
 
   // Oops-do's
   void oops_compiled_arguments_do(Symbol* signature, bool has_receiver, const RegisterMap* reg_map, OopClosure* f);
-  void oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache = true);
+  void oops_interpreted_do(OopClosure* f, CLDToOopClosure* cld_f, const RegisterMap* map, bool query_oop_map_cache = true);
 
  private:
   void oops_interpreted_arguments_do(Symbol* signature, bool has_receiver, OopClosure* f);
 
   // Iteration of oops
-  void oops_do_internal(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache);
+  void oops_do_internal(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache);
   void oops_entry_do(OopClosure* f, const RegisterMap* map);
   void oops_code_blob_do(OopClosure* f, CodeBlobClosure* cf, const RegisterMap* map);
   int adjust_offset(Method* method, int index); // helper for above fn
  public:
   // Memory management
-  void oops_do(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map) { oops_do_internal(f, cf, map, true); }
+  void oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf, RegisterMap* map) { oops_do_internal(f, cld_f, cf, map, true); }
   void nmethods_do(CodeBlobClosure* cf);
 
   // RedefineClasses support for finding live interpreted methods on the stack
--- a/src/share/vm/runtime/handles.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/handles.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -27,21 +27,18 @@
 #include "oops/constantPool.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/handles.inline.hpp"
+#include "runtime/thread.inline.hpp"
 #ifdef TARGET_OS_FAMILY_linux
 # include "os_linux.inline.hpp"
-# include "thread_linux.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_solaris
 # include "os_solaris.inline.hpp"
-# include "thread_solaris.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
-# include "thread_windows.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_bsd
 # include "os_bsd.inline.hpp"
-# include "thread_bsd.inline.hpp"
 #endif
 
 #ifdef ASSERT
--- a/src/share/vm/runtime/handles.inline.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/handles.inline.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -26,18 +26,7 @@
 #define SHARE_VM_RUNTIME_HANDLES_INLINE_HPP
 
 #include "runtime/handles.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
+#include "runtime/thread.inline.hpp"
 
 // these inline functions are in a separate file to break an include cycle
 // between Thread and Handle
--- a/src/share/vm/runtime/interfaceSupport.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/interfaceSupport.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -31,22 +31,11 @@
 #include "runtime/orderAccess.hpp"
 #include "runtime/os.hpp"
 #include "runtime/safepoint.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/vmThread.hpp"
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/preserveException.hpp"
 #include "utilities/top.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 // Wrapper for all entry points to the virtual machine.
 // The HandleMarkCleaner is a faster version of HandleMark.
--- a/src/share/vm/runtime/java.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/java.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -54,6 +54,7 @@
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/statSampler.hpp"
 #include "runtime/task.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/timer.hpp"
 #include "runtime/vm_operations.hpp"
 #include "services/memReporter.hpp"
@@ -79,18 +80,6 @@
 #ifdef TARGET_ARCH_ppc
 # include "vm_version_ppc.hpp"
 #endif
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 #ifndef SERIALGC
 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
 #include "gc_implementation/parallelScavenge/psScavenge.hpp"
--- a/src/share/vm/runtime/javaCalls.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/javaCalls.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -39,18 +39,7 @@
 #include "runtime/mutexLocker.hpp"
 #include "runtime/signature.hpp"
 #include "runtime/stubRoutines.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
+#include "runtime/thread.inline.hpp"
 
 // -----------------------------------------------------
 // Implementation of JavaCallWrapper
--- a/src/share/vm/runtime/javaCalls.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/javaCalls.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -29,6 +29,7 @@
 #include "oops/method.hpp"
 #include "runtime/handles.hpp"
 #include "runtime/javaFrameAnchor.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/vmThread.hpp"
 #ifdef TARGET_ARCH_x86
 # include "jniTypes_x86.hpp"
@@ -45,18 +46,6 @@
 #ifdef TARGET_ARCH_ppc
 # include "jniTypes_ppc.hpp"
 #endif
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 // A JavaCallWrapper is constructed before each JavaCall and destructed after the call.
 // Its purpose is to allocate/deallocate a new handle block and to save/restore the last
--- a/src/share/vm/runtime/jniHandles.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/jniHandles.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -28,18 +28,7 @@
 #include "prims/jvmtiExport.hpp"
 #include "runtime/jniHandles.hpp"
 #include "runtime/mutexLocker.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
+#include "runtime/thread.inline.hpp"
 
 
 JNIHandleBlock* JNIHandles::_global_handles       = NULL;
--- a/src/share/vm/runtime/memprofiler.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/memprofiler.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -35,19 +35,8 @@
 #include "runtime/mutexLocker.hpp"
 #include "runtime/os.hpp"
 #include "runtime/task.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/vmThread.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 #ifndef PRODUCT
 
--- a/src/share/vm/runtime/mutex.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/mutex.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -26,22 +26,19 @@
 #include "precompiled.hpp"
 #include "runtime/mutex.hpp"
 #include "runtime/osThread.hpp"
+#include "runtime/thread.inline.hpp"
 #include "utilities/events.hpp"
 #ifdef TARGET_OS_FAMILY_linux
 # include "mutex_linux.inline.hpp"
-# include "thread_linux.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_solaris
 # include "mutex_solaris.inline.hpp"
-# include "thread_solaris.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_windows
 # include "mutex_windows.inline.hpp"
-# include "thread_windows.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_bsd
 # include "mutex_bsd.inline.hpp"
-# include "thread_bsd.inline.hpp"
 #endif
 
 // o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o
--- a/src/share/vm/runtime/mutexLocker.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/mutexLocker.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -25,20 +25,9 @@
 #include "precompiled.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/safepoint.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/threadLocalStorage.hpp"
 #include "runtime/vmThread.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 // Mutexes used in the VM (see comment in mutexLocker.hpp):
 //
--- a/src/share/vm/runtime/objectMonitor.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/objectMonitor.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -34,25 +34,21 @@
 #include "runtime/objectMonitor.inline.hpp"
 #include "runtime/osThread.hpp"
 #include "runtime/stubRoutines.hpp"
-#include "runtime/thread.hpp"
+#include "runtime/thread.inline.hpp"
 #include "services/threadService.hpp"
 #include "utilities/dtrace.hpp"
 #include "utilities/preserveException.hpp"
 #ifdef TARGET_OS_FAMILY_linux
 # include "os_linux.inline.hpp"
-# include "thread_linux.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_solaris
 # include "os_solaris.inline.hpp"
-# include "thread_solaris.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
-# include "thread_windows.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_bsd
 # include "os_bsd.inline.hpp"
-# include "thread_bsd.inline.hpp"
 #endif
 
 #if defined(__GNUC__) && !defined(IA64)
--- a/src/share/vm/runtime/os.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/os.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -44,6 +44,7 @@
 #include "runtime/mutexLocker.hpp"
 #include "runtime/os.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
 #include "services/attachListener.hpp"
 #include "services/memTracker.hpp"
 #include "services/threadService.hpp"
@@ -51,19 +52,15 @@
 #include "utilities/events.hpp"
 #ifdef TARGET_OS_FAMILY_linux
 # include "os_linux.inline.hpp"
-# include "thread_linux.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_solaris
 # include "os_solaris.inline.hpp"
-# include "thread_solaris.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
-# include "thread_windows.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_bsd
 # include "os_bsd.inline.hpp"
-# include "thread_bsd.inline.hpp"
 #endif
 
 # include <signal.h>
--- a/src/share/vm/runtime/safepoint.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/safepoint.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -48,6 +48,7 @@
 #include "runtime/stubRoutines.hpp"
 #include "runtime/sweeper.hpp"
 #include "runtime/synchronizer.hpp"
+#include "runtime/thread.inline.hpp"
 #include "services/memTracker.hpp"
 #include "services/runtimeService.hpp"
 #include "utilities/events.hpp"
@@ -71,18 +72,6 @@
 # include "nativeInst_ppc.hpp"
 # include "vmreg_ppc.inline.hpp"
 #endif
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 #ifndef SERIALGC
 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
 #include "gc_implementation/shared/concurrentGCThread.hpp"
--- a/src/share/vm/runtime/synchronizer.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/synchronizer.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -36,24 +36,21 @@
 #include "runtime/osThread.hpp"
 #include "runtime/stubRoutines.hpp"
 #include "runtime/synchronizer.hpp"
+#include "runtime/thread.inline.hpp"
 #include "utilities/dtrace.hpp"
 #include "utilities/events.hpp"
 #include "utilities/preserveException.hpp"
 #ifdef TARGET_OS_FAMILY_linux
 # include "os_linux.inline.hpp"
-# include "thread_linux.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_solaris
 # include "os_solaris.inline.hpp"
-# include "thread_solaris.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
-# include "thread_windows.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_bsd
 # include "os_bsd.inline.hpp"
-# include "thread_bsd.inline.hpp"
 #endif
 
 #if defined(__GNUC__) && !defined(IA64)
--- a/src/share/vm/runtime/task.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/task.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -26,22 +26,19 @@
 #include "memory/allocation.hpp"
 #include "runtime/init.hpp"
 #include "runtime/task.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/timer.hpp"
 #ifdef TARGET_OS_FAMILY_linux
 # include "os_linux.inline.hpp"
-# include "thread_linux.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_solaris
 # include "os_solaris.inline.hpp"
-# include "thread_solaris.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
-# include "thread_windows.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_bsd
 # include "os_bsd.inline.hpp"
-# include "thread_bsd.inline.hpp"
 #endif
 
 int PeriodicTask::_num_tasks = 0;
--- a/src/share/vm/runtime/thread.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/thread.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -65,6 +65,7 @@
 #include "runtime/statSampler.hpp"
 #include "runtime/stubRoutines.hpp"
 #include "runtime/task.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/threadCritical.hpp"
 #include "runtime/threadLocalStorage.hpp"
 #include "runtime/vframe.hpp"
@@ -83,19 +84,15 @@
 #include "utilities/preserveException.hpp"
 #ifdef TARGET_OS_FAMILY_linux
 # include "os_linux.inline.hpp"
-# include "thread_linux.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_solaris
 # include "os_solaris.inline.hpp"
-# include "thread_solaris.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
-# include "thread_windows.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_bsd
 # include "os_bsd.inline.hpp"
-# include "thread_bsd.inline.hpp"
 #endif
 #ifndef SERIALGC
 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
@@ -826,7 +823,7 @@
   return false;
 }
 
-void Thread::oops_do(OopClosure* f, CodeBlobClosure* cf) {
+void Thread::oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf) {
   active_handles()->oops_do(f);
   // Do oop for ThreadShadow
   f->do_oop((oop*)&_pending_exception);
@@ -2705,7 +2702,7 @@
   }
 };
 
-void JavaThread::oops_do(OopClosure* f, CodeBlobClosure* cf) {
+void JavaThread::oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf) {
   // Verify that the deferred card marks have been flushed.
   assert(deferred_card_mark().is_empty(), "Should be empty during GC");
 
@@ -2713,7 +2710,7 @@
   // since there may be more than one thread using each ThreadProfiler.
 
   // Traverse the GCHandles
-  Thread::oops_do(f, cf);
+  Thread::oops_do(f, cld_f, cf);
 
   assert( (!has_last_Java_frame() && java_call_counter() == 0) ||
           (has_last_Java_frame() && java_call_counter() > 0), "wrong java_sp info!");
@@ -2741,7 +2738,7 @@
 
     // Traverse the execution stack
     for(StackFrameStream fst(this); !fst.is_done(); fst.next()) {
-      fst.current()->oops_do(f, cf, fst.register_map());
+      fst.current()->oops_do(f, cld_f, cf, fst.register_map());
     }
   }
 
@@ -2875,7 +2872,7 @@
 
 void JavaThread::verify() {
   // Verify oops in the thread.
-  oops_do(&VerifyOopClosure::verify_oop, NULL);
+  oops_do(&VerifyOopClosure::verify_oop, NULL, NULL);
 
   // Verify the stack frames.
   frames_do(frame_verify);
@@ -3125,7 +3122,7 @@
 static void oops_print(frame* f, const RegisterMap *map) {
   PrintAndVerifyOopClosure print;
   f->print_value();
-  f->oops_do(&print, NULL, (RegisterMap*)map);
+  f->oops_do(&print, NULL, NULL, (RegisterMap*)map);
 }
 
 // Print our all the locations that contain oops and whether they are
@@ -3227,8 +3224,8 @@
 #endif
 }
 
-void CompilerThread::oops_do(OopClosure* f, CodeBlobClosure* cf) {
-  JavaThread::oops_do(f, cf);
+void CompilerThread::oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf) {
+  JavaThread::oops_do(f, cld_f, cf);
   if (_scanned_nmethod != NULL && cf != NULL) {
     // Safepoints can occur when the sweeper is scanning an nmethod so
     // process it here to make sure it isn't unloaded in the middle of
@@ -3334,6 +3331,9 @@
   jint os_init_2_result = os::init_2();
   if (os_init_2_result != JNI_OK) return os_init_2_result;
 
+  jint adjust_after_os_result = Arguments::adjust_after_os();
+  if (adjust_after_os_result != JNI_OK) return adjust_after_os_result;
+
   // intialize TLS
   ThreadLocalStorage::init();
 
@@ -4198,14 +4198,14 @@
 // uses the Threads_lock to gurantee this property. It also makes sure that
 // all threads gets blocked when exiting or starting).
 
-void Threads::oops_do(OopClosure* f, CodeBlobClosure* cf) {
+void Threads::oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf) {
   ALL_JAVA_THREADS(p) {
-    p->oops_do(f, cf);
+    p->oops_do(f, cld_f, cf);
   }
-  VMThread::vm_thread()->oops_do(f, cf);
+  VMThread::vm_thread()->oops_do(f, cld_f, cf);
 }
 
-void Threads::possibly_parallel_oops_do(OopClosure* f, CodeBlobClosure* cf) {
+void Threads::possibly_parallel_oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf) {
   // Introduce a mechanism allowing parallel threads to claim threads as
   // root groups.  Overhead should be small enough to use all the time,
   // even in sequential code.
@@ -4222,12 +4222,12 @@
   int cp = SharedHeap::heap()->strong_roots_parity();
   ALL_JAVA_THREADS(p) {
     if (p->claim_oops_do(is_par, cp)) {
-      p->oops_do(f, cf);
+      p->oops_do(f, cld_f, cf);
     }
   }
   VMThread* vmt = VMThread::vm_thread();
   if (vmt->claim_oops_do(is_par, cp)) {
-    vmt->oops_do(f, cf);
+    vmt->oops_do(f, cld_f, cf);
   }
 }
 
--- a/src/share/vm/runtime/thread.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/thread.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -480,8 +480,10 @@
 
   // GC support
   // Apply "f->do_oop" to all root oops in "this".
+  // Apply "cld_f->do_cld" to CLDs that are otherwise not kept alive.
+  //   Used by JavaThread::oops_do.
   // Apply "cf->do_code_blob" (if !NULL) to all code blobs active in frames
-  virtual void oops_do(OopClosure* f, CodeBlobClosure* cf);
+  virtual void oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf);
 
   // Handles the parallel case for the method below.
 private:
@@ -1405,7 +1407,7 @@
   void frames_do(void f(frame*, const RegisterMap*));
 
   // Memory operations
-  void oops_do(OopClosure* f, CodeBlobClosure* cf);
+  void oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf);
 
   // Sweeper operations
   void nmethods_do(CodeBlobClosure* cf);
@@ -1825,7 +1827,7 @@
   // GC support
   // Apply "f->do_oop" to all root oops in "this".
   // Apply "cf->do_code_blob" (if !NULL) to all code blobs active in frames
-  void oops_do(OopClosure* f, CodeBlobClosure* cf);
+  void oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf);
 
 #ifndef PRODUCT
 private:
@@ -1892,9 +1894,9 @@
 
   // Apply "f->do_oop" to all root oops in all threads.
   // This version may only be called by sequential code.
-  static void oops_do(OopClosure* f, CodeBlobClosure* cf);
+  static void oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf);
   // This version may be called by sequential or parallel code.
-  static void possibly_parallel_oops_do(OopClosure* f, CodeBlobClosure* cf);
+  static void possibly_parallel_oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf);
   // This creates a list of GCTasks, one per thread.
   static void create_thread_roots_tasks(GCTaskQueue* q);
   // This creates a list of GCTasks, one per thread, for marking objects.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/vm/runtime/thread.inline.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_RUNTIME_THREAD_INLINE_HPP
+#define SHARE_VM_RUNTIME_THREAD_INLINE_HPP
+
+#define SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE
+
+#include "runtime/thread.hpp"
+#ifdef TARGET_OS_FAMILY_linux
+# include "thread_linux.inline.hpp"
+#endif
+#ifdef TARGET_OS_FAMILY_solaris
+# include "thread_solaris.inline.hpp"
+#endif
+#ifdef TARGET_OS_FAMILY_windows
+# include "thread_windows.inline.hpp"
+#endif
+#ifdef TARGET_OS_FAMILY_bsd
+# include "thread_bsd.inline.hpp"
+#endif
+
+#undef SHARE_VM_RUNTIME_THREAD_INLINE_HPP_SCOPE
+
+#endif // SHARE_VM_RUNTIME_THREAD_INLINE_HPP
--- a/src/share/vm/runtime/threadLocalStorage.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/threadLocalStorage.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -23,22 +23,19 @@
  */
 
 #include "precompiled.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/threadLocalStorage.hpp"
 #ifdef TARGET_OS_FAMILY_linux
 # include "os_linux.inline.hpp"
-# include "thread_linux.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_solaris
 # include "os_solaris.inline.hpp"
-# include "thread_solaris.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
-# include "thread_windows.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_bsd
 # include "os_bsd.inline.hpp"
-# include "thread_bsd.inline.hpp"
 #endif
 
 // static member initialization
--- a/src/share/vm/runtime/vmStructs.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/vmStructs.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -95,6 +95,7 @@
 #include "runtime/serviceThread.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/virtualspace.hpp"
 #include "runtime/vmStructs.hpp"
 #include "utilities/array.hpp"
@@ -115,18 +116,6 @@
 #ifdef TARGET_ARCH_ppc
 # include "vmStructs_ppc.hpp"
 #endif
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 #ifdef TARGET_OS_ARCH_linux_x86
 # include "vmStructs_linux_x86.hpp"
 #endif
@@ -2106,8 +2095,7 @@
   declare_toplevel_type(FreeList<Metablock>*)                             \
   declare_toplevel_type(FreeList<Metablock>)                              \
   declare_toplevel_type(MetablockTreeDictionary*)                         \
-  declare_type(MetablockTreeDictionary, FreeBlockDictionary<Metablock>)   \
-              declare_type(MetablockTreeDictionary, FreeBlockDictionary<Metablock>)
+           declare_type(MetablockTreeDictionary, FreeBlockDictionary<Metablock>)
 
 
   /* NOTE that we do not use the last_entry() macro here; it is used  */
@@ -3215,3 +3203,17 @@
 void vmStructs_init() {
   debug_only(VMStructs::init());
 }
+
+#ifndef PRODUCT
+void VMStructs::test() {
+  // Check for duplicate entries in type array
+  for (int i = 0; localHotSpotVMTypes[i].typeName != NULL; i++) {
+    for (int j = i + 1; localHotSpotVMTypes[j].typeName != NULL; j++) {
+      if (strcmp(localHotSpotVMTypes[i].typeName, localHotSpotVMTypes[j].typeName) == 0) {
+        tty->print_cr("Duplicate entries for '%s'", localHotSpotVMTypes[i].typeName);
+        assert(false, "Duplicate types in localHotSpotVMTypes array");
+      }
+    }
+  }
+}
+#endif
--- a/src/share/vm/runtime/vmStructs.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/vmStructs.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -123,6 +123,11 @@
   // the data structure (debug build only)
   static void init();
 
+#ifndef PRODUCT
+  // Execute unit tests
+  static void test();
+#endif
+
 private:
   // Look up a type in localHotSpotVMTypes using strcmp() (debug build only).
   // Returns 1 if found, 0 if not.
--- a/src/share/vm/runtime/vmThread.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/vmThread.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -31,24 +31,13 @@
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/os.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/vmThread.hpp"
 #include "runtime/vm_operations.hpp"
 #include "services/runtimeService.hpp"
 #include "utilities/dtrace.hpp"
 #include "utilities/events.hpp"
 #include "utilities/xmlstream.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 #ifndef USDT2
 HS_DTRACE_PROBE_DECL3(hotspot, vmops__request, char *, uintptr_t, int);
@@ -668,8 +657,8 @@
 }
 
 
-void VMThread::oops_do(OopClosure* f, CodeBlobClosure* cf) {
-  Thread::oops_do(f, cf);
+void VMThread::oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf) {
+  Thread::oops_do(f, cld_f, cf);
   _vm_queue->oops_do(f);
 }
 
@@ -701,5 +690,5 @@
 #endif
 
 void VMThread::verify() {
-  oops_do(&VerifyOopClosure::verify_oop, NULL);
+  oops_do(&VerifyOopClosure::verify_oop, NULL, NULL);
 }
--- a/src/share/vm/runtime/vmThread.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/vmThread.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -26,19 +26,8 @@
 #define SHARE_VM_RUNTIME_VMTHREAD_HPP
 
 #include "runtime/perfData.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/vm_operations.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 //
 // Prioritized queue of VM operations.
@@ -137,7 +126,7 @@
   static VMThread* vm_thread()                    { return _vm_thread; }
 
   // GC support
-  void oops_do(OopClosure* f, CodeBlobClosure* cf);
+  void oops_do(OopClosure* f, CLDToOopClosure* cld_f, CodeBlobClosure* cf);
 
   // Debugging
   void print_on(outputStream* st) const;
--- a/src/share/vm/runtime/vm_operations.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/vm_operations.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -34,20 +34,9 @@
 #include "runtime/deoptimization.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/sweeper.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/vm_operations.hpp"
 #include "services/threadService.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 #define VM_OP_NAME_INITIALIZE(name) #name,
 
--- a/src/share/vm/runtime/vm_version.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/runtime/vm_version.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -243,19 +243,21 @@
 
   #ifndef FLOAT_ARCH
     #if defined(__SOFTFP__)
-      #define FLOAT_ARCH "-sflt"
+      #define FLOAT_ARCH_STR "-sflt"
     #elif defined(E500V2)
-      #define FLOAT_ARCH "-e500v2"
+      #define FLOAT_ARCH_STR "-e500v2"
     #elif defined(ARM)
-      #define FLOAT_ARCH "-vfp"
+      #define FLOAT_ARCH_STR "-vfp"
     #elif defined(PPC)
-      #define FLOAT_ARCH "-hflt"
+      #define FLOAT_ARCH_STR "-hflt"
     #else
-      #define FLOAT_ARCH ""
+      #define FLOAT_ARCH_STR ""
     #endif
+  #else
+    #define FLOAT_ARCH_STR XSTR(FLOAT_ARCH)
   #endif
 
-  return VMNAME " (" VM_RELEASE ") for " OS "-" CPU FLOAT_ARCH
+  return VMNAME " (" VM_RELEASE ") for " OS "-" CPU FLOAT_ARCH_STR
          " JRE (" JRE_RELEASE_VERSION "), built on " __DATE__ " " __TIME__
          " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER;
 }
--- a/src/share/vm/services/memSnapshot.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/services/memSnapshot.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -261,17 +261,19 @@
   VMMemRegion* cur = (VMMemRegion*)current();
   assert(cur->is_reserved_region() && cur->contains_region(rec),
     "Sanity check");
+  if (rec->is_same_region(cur)) {
+    // release whole reserved region
 #ifdef ASSERT
-  VMMemRegion* next_reg = (VMMemRegion*)peek_next();
-  // should not have any committed memory in this reserved region
-  assert(next_reg == NULL || !next_reg->is_committed_region(), "Sanity check");
+    VMMemRegion* next_region = (VMMemRegion*)peek_next();
+    // should not have any committed memory in this reserved region
+    assert(next_region == NULL || !next_region->is_committed_region(), "Sanity check");
 #endif
-  if (rec->is_same_region(cur)) {
     remove();
   } else if (rec->addr() == cur->addr() ||
     rec->addr() + rec->size() == cur->addr() + cur->size()) {
     // released region is at either end of this region
     cur->exclude_region(rec->addr(), rec->size());
+    assert(check_reserved_region(), "Integrity check");
   } else { // split the reserved region and release the middle
     address high_addr = cur->addr() + cur->size();
     size_t sz = high_addr - rec->addr();
@@ -280,10 +282,14 @@
     if (MemTracker::track_callsite()) {
       MemPointerRecordEx tmp(rec->addr() + rec->size(), cur->flags(), sz,
         ((VMMemRegionEx*)cur)->pc());
-      return insert_reserved_region(&tmp);
+      bool ret = insert_reserved_region(&tmp);
+      assert(!ret || check_reserved_region(), "Integrity check");
+      return ret;
     } else {
       MemPointerRecord tmp(rec->addr() + rec->size(), cur->flags(), sz);
-      return insert_reserved_region(&tmp);
+      bool ret = insert_reserved_region(&tmp);
+      assert(!ret || check_reserved_region(), "Integrity check");
+      return ret;
     }
   }
   return true;
--- a/src/share/vm/services/memSnapshot.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/services/memSnapshot.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -146,6 +146,23 @@
   // reset current position
   inline void reset() { _pos = 0; }
 #ifdef ASSERT
+  // check integrity of records on current reserved memory region.
+  bool check_reserved_region() {
+    VMMemRegion* reserved_region = (VMMemRegion*)current();
+    assert(reserved_region != NULL && reserved_region->is_reserved_region(),
+          "Sanity check");
+    // all committed regions that follow current reserved region, should all
+    // belong to the reserved region.
+    VMMemRegion* next_region = (VMMemRegion*)next();
+    for (; next_region != NULL && next_region->is_committed_region();
+         next_region = (VMMemRegion*)next() ) {
+      if(!reserved_region->contains_region(next_region)) {
+        return false;
+      }
+    }
+    return true;
+  }
+
   virtual bool is_dup_pointer(const MemPointer* ptr1,
     const MemPointer* ptr2) const {
     VMMemRegion* p1 = (VMMemRegion*)ptr1;
--- a/src/share/vm/services/memTracker.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/services/memTracker.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -69,15 +69,12 @@
 
 void MemTracker::init_tracking_options(const char* option_line) {
   _tracking_level = NMT_off;
-  if (strncmp(option_line, "=summary", 8) == 0) {
+  if (strcmp(option_line, "=summary") == 0) {
     _tracking_level = NMT_summary;
-  } else if (strncmp(option_line, "=detail", 7) == 0) {
+  } else if (strcmp(option_line, "=detail") == 0) {
     _tracking_level = NMT_detail;
-  } else {
-    char msg[255];
-    //+1 to remove the '=' character
-    jio_snprintf(msg, 255, "Unknown option given to XX:NativeMemoryTracking: %s", option_line+1);
-    vm_exit_during_initialization(msg, NULL);
+  } else if (strcmp(option_line, "=off") != 0) {
+    vm_exit_during_initialization("Syntax error, expecting -XX:NativeMemoryTracking=[off|summary|detail]", NULL);
   }
 }
 
--- a/src/share/vm/services/memTracker.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/services/memTracker.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -109,10 +109,6 @@
 #include "services/memSnapshot.hpp"
 #include "services/memTrackWorker.hpp"
 
-#ifdef SOLARIS
-#include "thread_solaris.inline.hpp"
-#endif
-
 extern bool NMT_track_callsite;
 
 #ifdef ASSERT
--- a/src/share/vm/utilities/array.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/utilities/array.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -24,19 +24,8 @@
 
 #include "precompiled.hpp"
 #include "memory/resourceArea.hpp"
+#include "runtime/thread.inline.hpp"
 #include "utilities/array.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 
 #ifdef ASSERT
--- a/src/share/vm/utilities/debug.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/utilities/debug.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -44,6 +44,7 @@
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubCodeGenerator.hpp"
 #include "runtime/stubRoutines.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/vframe.hpp"
 #include "services/heapDumper.hpp"
 #include "utilities/defaultStream.hpp"
@@ -52,19 +53,15 @@
 #include "utilities/vmError.hpp"
 #ifdef TARGET_OS_FAMILY_linux
 # include "os_linux.inline.hpp"
-# include "thread_linux.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_solaris
 # include "os_solaris.inline.hpp"
-# include "thread_solaris.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_windows
 # include "os_windows.inline.hpp"
-# include "thread_windows.inline.hpp"
 #endif
 #ifdef TARGET_OS_FAMILY_bsd
 # include "os_bsd.inline.hpp"
-# include "thread_bsd.inline.hpp"
 #endif
 
 #ifndef ASSERT
--- a/src/share/vm/utilities/events.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/utilities/events.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -26,22 +26,11 @@
 #include "memory/allocation.inline.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/osThread.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/threadCritical.hpp"
 #include "runtime/threadLocalStorage.hpp"
 #include "runtime/timer.hpp"
 #include "utilities/events.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 
 EventLog* Events::_logs = NULL;
--- a/src/share/vm/utilities/exceptions.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/utilities/exceptions.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -30,21 +30,10 @@
 #include "runtime/init.hpp"
 #include "runtime/java.hpp"
 #include "runtime/javaCalls.hpp"
+#include "runtime/thread.inline.hpp"
 #include "runtime/threadCritical.hpp"
 #include "utilities/events.hpp"
 #include "utilities/exceptions.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 
 // Implementation of ThreadShadow
--- a/src/share/vm/utilities/globalDefinitions.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/utilities/globalDefinitions.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -1280,4 +1280,12 @@
 
 #define ARRAY_SIZE(array) (sizeof(array)/sizeof((array)[0]))
 
+// Dereference vptr
+// All C++ compilers that we know of have the vtbl pointer in the first
+// word.  If there are exceptions, this function needs to be made compiler
+// specific.
+static inline void* dereference_vptr(void* addr) {
+  return *(void**)addr;
+}
+
 #endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP
--- a/src/share/vm/utilities/growableArray.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/utilities/growableArray.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -24,19 +24,9 @@
 
 #include "precompiled.hpp"
 #include "memory/resourceArea.hpp"
+#include "runtime/thread.inline.hpp"
 #include "utilities/growableArray.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
+
 #ifdef ASSERT
 void GenericGrowableArray::set_nesting() {
   if (on_stack()) {
--- a/src/share/vm/utilities/preserveException.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/utilities/preserveException.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -26,18 +26,7 @@
 #define SHARE_VM_UTILITIES_PRESERVEEXCEPTION_HPP
 
 #include "runtime/handles.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
+#include "runtime/thread.inline.hpp"
 
 // This file provides more support for exception handling; see also exceptions.hpp
 class PreserveExceptionMark {
--- a/src/share/vm/utilities/taskqueue.cpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/utilities/taskqueue.cpp	Thu Nov 29 13:55:49 2012 -0800
@@ -25,21 +25,10 @@
 #include "precompiled.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/os.hpp"
+#include "runtime/thread.inline.hpp"
 #include "utilities/debug.hpp"
 #include "utilities/stack.inline.hpp"
 #include "utilities/taskqueue.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 #ifdef TRACESPINNING
 uint ParallelTaskTerminator::_total_yields = 0;
--- a/src/share/vm/utilities/workgroup.hpp	Tue Nov 27 17:03:56 2012 -0500
+++ b/src/share/vm/utilities/workgroup.hpp	Thu Nov 29 13:55:49 2012 -0800
@@ -25,19 +25,8 @@
 #ifndef SHARE_VM_UTILITIES_WORKGROUP_HPP
 #define SHARE_VM_UTILITIES_WORKGROUP_HPP
 
+#include "runtime/thread.inline.hpp"
 #include "utilities/taskqueue.hpp"
-#ifdef TARGET_OS_FAMILY_linux
-# include "thread_linux.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_solaris
-# include "thread_solaris.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_windows
-# include "thread_windows.inline.hpp"
-#endif
-#ifdef TARGET_OS_FAMILY_bsd
-# include "thread_bsd.inline.hpp"
-#endif
 
 // Task class hierarchy:
 //   AbstractGangTask
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/runtime/8003720/Asmator.java	Thu Nov 29 13:55:49 2012 -0800
@@ -0,0 +1,31 @@
+import com.sun.xml.internal.ws.org.objectweb.asm.*;
+
+class Asmator {
+    static byte[] fixup(byte[] buf) throws java.io.IOException {
+        ClassReader cr = new ClassReader(buf);
+        ClassWriter cw = new ClassWriter(0) {
+            public MethodVisitor visitMethod(
+                final int access,
+                final String name,
+                final String desc,
+                final String signature,
+                final String[] exceptions)
+            {
+                MethodVisitor mv = super.visitMethod(access,
+                        name,
+                        desc,
+                        signature,
+                        exceptions);
+                if (mv == null)  return null;
+                if (name.equals("callme")) {
+                    // make receiver go dead!
+                    mv.visitInsn(Opcodes.ACONST_NULL);
+                    mv.visitVarInsn(Opcodes.ASTORE, 0);
+                }
+                return mv;
+            }
+        };
+        cr.accept(cw, 0);
+        return cw.toByteArray();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/runtime/8003720/Test8003720.java	Thu Nov 29 13:55:49 2012 -0800
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+/*
+ * @test
+ * @bug 8003720
+ * @summary Method in interpreter stack frame can be deallocated
+ * @compile -XDignore.symbol.file Victim.java
+ * @run main/othervm -Xverify:all -Xint Test8003720
+ */
+
+// Attempts to make the JVM unload a class while still executing one of its methods.
+public class Test8003720 {
+    final static String VICTIM_CLASS_NAME = "Victim";
+    final static boolean QUIET = true;
+    final static long DURATION = 30000;
+
+    public interface CallMe { void callme(); }
+
+    public static void main(String... av) throws Throwable {
+        newVictimClassLoader();
+        System.gc();
+
+        newVictimClass();
+        System.gc();
+
+        newVictimInstance();
+        System.gc();
+
+        ((CallMe)newVictimInstance()).callme();
+    }
+
+    public static Object newVictimInstance() throws Throwable {
+        return newVictimClass().newInstance();
+    }
+
+    public static Class<?> newVictimClass() throws Throwable {
+        return Class.forName(VICTIM_CLASS_NAME, true, new VictimClassLoader());
+    }
+
+    public static ClassLoader newVictimClassLoader() throws Throwable {
+        return new VictimClassLoader();
+    }
+
+    public static void println(String line) {
+        if (!QUIET) {
+            System.out.println(line);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/runtime/8003720/Victim.java	Thu Nov 29 13:55:49 2012 -0800
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+public class Victim implements Test8003720.CallMe {
+    public void callme() {
+        // note: Victim.this is dead here
+        Test8003720.println("executing in loader=" + Victim.class.getClassLoader());
+
+        long now = System.currentTimeMillis();
+
+        while ((System.currentTimeMillis() - now) < Test8003720.DURATION) {
+            long count = VictimClassLoader.counter++;
+            if (count %  1000000 == 0)  System.gc();
+            if (count % 16180000 == 0)  blurb();
+            new Object[1].clone();
+        }
+    }
+    static void blurb() {
+        Test8003720.println("count=" + VictimClassLoader.counter);
+    }
+    static {
+        blather();
+    }
+    static void blather() {
+        new java.util.ArrayList<Object>(1000000);
+        Class<Victim> c = Victim.class;
+        Test8003720.println("initializing " + c + "#" + System.identityHashCode(c) + " in " + c.getClassLoader());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/runtime/8003720/VictimClassLoader.java	Thu Nov 29 13:55:49 2012 -0800
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+public class VictimClassLoader extends ClassLoader {
+    public static long counter = 0;
+
+    private int which = (int) ++counter;
+
+    protected VictimClassLoader() {
+        super(VictimClassLoader.class.getClassLoader());
+    }
+
+    protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
+        Class c;
+        if (!name.endsWith("Victim")) {
+            c = super.loadClass(name, resolve);
+            return c;
+        }
+
+        c = findLoadedClass(name);
+        if (c != null) {
+            return c;
+        }
+
+        byte[] buf = readClassFile(name);
+        c = defineClass(name, buf, 0, buf.length);
+        resolveClass(c);
+
+        if (c.getClassLoader() != this) {
+            throw new AssertionError();
+        }
+
+        Test8003720.println("loaded " + c + "#" + System.identityHashCode(c) + " in " + c.getClassLoader());
+        return c;
+    }
+
+    static byte[] readClassFile(String name) {
+        try {
+            String rname = name.substring(name.lastIndexOf('.') + 1) + ".class";
+            java.net.URL url = VictimClassLoader.class.getResource(rname);
+            Test8003720.println("found " + rname + " = " + url);
+
+            java.net.URLConnection connection = url.openConnection();
+            int contentLength = connection.getContentLength();
+            byte[] buf = readFully(connection.getInputStream(), contentLength);
+
+            return Asmator.fixup(buf);
+        } catch (java.io.IOException ex) {
+            throw new Error(ex);
+        }
+    }
+
+    static byte[] readFully(java.io.InputStream in, int len) throws java.io.IOException {
+        // Warning here:
+        return sun.misc.IOUtils.readFully(in, len, true);
+    }
+
+    public void finalize() {
+        Test8003720.println("Goodbye from " + this);
+    }
+
+    public String toString() {
+        return "VictimClassLoader#" + which;
+    }
+}