# HG changeset patch # User jcoomes # Date 1205364697 25200 # Node ID 887682771f698535bbc4ea034481f4a5de811cfc # Parent 7836be3e92d0a4f9ee7566f602c91f5609534e66# Parent 7ee622712fcf1af520d3b61183b20378513abc0f Merge diff -r 7836be3e92d0 -r 887682771f69 build/windows/makefiles/compile.make --- a/build/windows/makefiles/compile.make Fri Feb 29 20:03:58 2008 -0800 +++ b/build/windows/makefiles/compile.make Wed Mar 12 16:31:37 2008 -0700 @@ -44,6 +44,10 @@ # /Od Disable all optimizations # # NOTE: Normally following any of the above with a '-' will turn off that flag +# +# 6655385: For VS2003/2005 we now specify /Oy- (disable frame pointer +# omission.) This has little to no effect on performance while vastly +# improving the quality of crash log stack traces involving jvm.dll. # These are always used in all compiles CPP_FLAGS=/nologo /W3 /WX @@ -141,14 +145,14 @@ !endif !if "$(COMPILER_NAME)" == "VS2003" -PRODUCT_OPT_OPTION = /O2 -FASTDEBUG_OPT_OPTION = /O2 +PRODUCT_OPT_OPTION = /O2 /Oy- +FASTDEBUG_OPT_OPTION = /O2 /Oy- DEBUG_OPT_OPTION = /Od !endif !if "$(COMPILER_NAME)" == "VS2005" -PRODUCT_OPT_OPTION = /O2 -FASTDEBUG_OPT_OPTION = /O2 +PRODUCT_OPT_OPTION = /O2 /Oy- +FASTDEBUG_OPT_OPTION = /O2 /Oy- DEBUG_OPT_OPTION = /Od GX_OPTION = /EHsc # This VS2005 compiler has /GS as a default and requires bufferoverflowU.lib @@ -165,8 +169,8 @@ # Compile for space above time. !if "$(Variant)" == "kernel" -PRODUCT_OPT_OPTION = /O1 -FASTDEBUG_OPT_OPTION = /O1 +PRODUCT_OPT_OPTION = /O1 /Oy- +FASTDEBUG_OPT_OPTION = /O1 /Oy- DEBUG_OPT_OPTION = /Od !endif diff -r 7836be3e92d0 -r 887682771f69 src/share/vm/code/dependencies.cpp --- a/src/share/vm/code/dependencies.cpp Fri Feb 29 20:03:58 2008 -0800 +++ b/src/share/vm/code/dependencies.cpp Wed Mar 12 16:31:37 2008 -0700 @@ -1491,9 +1491,12 @@ // fall through: _change_type = Change_new_sub; case Change_new_sub: - _klass = instanceKlass::cast(_klass)->super(); - if (_klass != NULL) { - return true; + // 6598190: brackets workaround Sun Studio C++ compiler bug 6629277 + { + _klass = instanceKlass::cast(_klass)->super(); + if (_klass != NULL) { + return true; + } } // else set up _ti_limit and fall through: _ti_limit = (_ti_base == NULL) ? 0 : _ti_base->length(); diff -r 7836be3e92d0 -r 887682771f69 src/share/vm/runtime/biasedLocking.cpp --- a/src/share/vm/runtime/biasedLocking.cpp Fri Feb 29 20:03:58 2008 -0800 +++ b/src/share/vm/runtime/biasedLocking.cpp Wed Mar 12 16:31:37 2008 -0700 @@ -38,8 +38,11 @@ class VM_EnableBiasedLocking: public VM_Operation { public: - VM_EnableBiasedLocking() {} - VMOp_Type type() const { return VMOp_EnableBiasedLocking; } + VM_EnableBiasedLocking() {} + VMOp_Type type() const { return VMOp_EnableBiasedLocking; } + Mode evaluation_mode() const { return _async_safepoint; } + bool is_cheap_allocated() const { return true; } + void doit() { // Iterate the system dictionary enabling biased locking for all // currently loaded classes @@ -62,8 +65,10 @@ EnableBiasedLockingTask(size_t interval_time) : PeriodicTask(interval_time) {} virtual void task() { - VM_EnableBiasedLocking op; - VMThread::execute(&op); + // Use async VM operation to avoid blocking the Watcher thread. + // VM Thread will free C heap storage. + VM_EnableBiasedLocking *op = new VM_EnableBiasedLocking(); + VMThread::execute(op); // Reclaim our storage and disenroll ourself delete this; diff -r 7836be3e92d0 -r 887682771f69 src/share/vm/runtime/mutex.cpp --- a/src/share/vm/runtime/mutex.cpp Fri Feb 29 20:03:58 2008 -0800 +++ b/src/share/vm/runtime/mutex.cpp Wed Mar 12 16:31:37 2008 -0700 @@ -1119,10 +1119,15 @@ assert ((UNS(_owner)|UNS(_LockWord.FullWord)|UNS(_EntryList)|UNS(_WaitSet)|UNS(_OnDeck)) == 0, "") ; } -void Monitor::ClearMonitor (Monitor * m) { +void Monitor::ClearMonitor (Monitor * m, const char *name) { m->_owner = NULL ; m->_snuck = false ; - m->_name = "UNKNOWN" ; + if (name == NULL) { + strcpy(m->_name, "UNKNOWN") ; + } else { + strncpy(m->_name, name, MONITOR_NAME_LEN - 1); + m->_name[MONITOR_NAME_LEN - 1] = '\0'; + } m->_LockWord.FullWord = 0 ; m->_EntryList = NULL ; m->_OnDeck = NULL ; @@ -1133,7 +1138,7 @@ Monitor::Monitor() { ClearMonitor(this); } Monitor::Monitor (int Rank, const char * name, bool allow_vm_block) { - ClearMonitor (this) ; + ClearMonitor (this, name) ; #ifdef ASSERT _allow_vm_block = allow_vm_block; _rank = Rank ; @@ -1145,7 +1150,7 @@ } Mutex::Mutex (int Rank, const char * name, bool allow_vm_block) { - ClearMonitor ((Monitor *) this) ; + ClearMonitor ((Monitor *) this, name) ; #ifdef ASSERT _allow_vm_block = allow_vm_block; _rank = Rank ; diff -r 7836be3e92d0 -r 887682771f69 src/share/vm/runtime/mutex.hpp --- a/src/share/vm/runtime/mutex.hpp Fri Feb 29 20:03:58 2008 -0800 +++ b/src/share/vm/runtime/mutex.hpp Wed Mar 12 16:31:37 2008 -0700 @@ -82,6 +82,9 @@ // *in that order*. If their implementations change such that these // assumptions are violated, a whole lot of code will break. +// The default length of monitor name is choosen to be 64 to avoid false sharing. +static const int MONITOR_NAME_LEN = 64; + class Monitor : public CHeapObj { public: @@ -126,9 +129,8 @@ volatile intptr_t _WaitLock [1] ; // Protects _WaitSet ParkEvent * volatile _WaitSet ; // LL of ParkEvents volatile bool _snuck; // Used for sneaky locking (evil). - const char * _name; // Name of mutex int NotifyCount ; // diagnostic assist - double pad [8] ; // avoid false sharing + char _name[MONITOR_NAME_LEN]; // Name of mutex // Debugging fields for naming, deadlock detection, etc. (some only used in debug mode) #ifndef PRODUCT @@ -170,7 +172,7 @@ int ILocked () ; protected: - static void ClearMonitor (Monitor * m) ; + static void ClearMonitor (Monitor * m, const char* name = NULL) ; Monitor() ; public: diff -r 7836be3e92d0 -r 887682771f69 src/share/vm/runtime/mutexLocker.cpp --- a/src/share/vm/runtime/mutexLocker.cpp Fri Feb 29 20:03:58 2008 -0800 +++ b/src/share/vm/runtime/mutexLocker.cpp Wed Mar 12 16:31:37 2008 -0700 @@ -188,10 +188,6 @@ def(Safepoint_lock , Monitor, safepoint, true ); // locks SnippetCache_lock/Threads_lock - if (!UseMembar) { - def(SerializePage_lock , Monitor, leaf, true ); - } - def(Threads_lock , Monitor, barrier, true ); def(VMOperationQueue_lock , Monitor, nonleaf, true ); // VM_thread allowed to block on these diff -r 7836be3e92d0 -r 887682771f69 src/share/vm/runtime/mutexLocker.hpp --- a/src/share/vm/runtime/mutexLocker.hpp Fri Feb 29 20:03:58 2008 -0800 +++ b/src/share/vm/runtime/mutexLocker.hpp Wed Mar 12 16:31:37 2008 -0700 @@ -52,7 +52,6 @@ extern Monitor* VMOperationQueue_lock; // a lock on queue of vm_operations waiting to execute extern Monitor* VMOperationRequest_lock; // a lock on Threads waiting for a vm_operation to terminate extern Monitor* Safepoint_lock; // a lock used by the safepoint abstraction -extern Monitor* SerializePage_lock; // a lock used when VMThread changing serialize memory page permission during safepoint extern Monitor* Threads_lock; // a lock on the Threads table of active Java threads // (also used by Safepoints too to block threads creation/destruction) extern Monitor* CGC_lock; // used for coordination between diff -r 7836be3e92d0 -r 887682771f69 src/share/vm/runtime/os.cpp --- a/src/share/vm/runtime/os.cpp Fri Feb 29 20:03:58 2008 -0800 +++ b/src/share/vm/runtime/os.cpp Wed Mar 12 16:31:37 2008 -0700 @@ -956,7 +956,6 @@ return true; } - void os::set_memory_serialize_page(address page) { int count = log2_intptr(sizeof(class JavaThread)) - log2_intptr(64); _mem_serialize_page = (volatile int32_t *)page; @@ -967,6 +966,8 @@ set_serialize_page_mask((uintptr_t)(vm_page_size() - sizeof(int32_t))); } +static volatile intptr_t SerializePageLock = 0; + // This method is called from signal handler when SIGSEGV occurs while the current // thread tries to store to the "read-only" memory serialize page during state // transition. @@ -974,15 +975,14 @@ if (TraceSafepoint) { tty->print_cr("Block until the serialize page permission restored"); } - // When VMThread is holding the SerializePage_lock during modifying the + // When VMThread is holding the SerializePageLock during modifying the // access permission of the memory serialize page, the following call // will block until the permission of that page is restored to rw. // Generally, it is unsafe to manipulate locks in signal handlers, but in // this case, it's OK as the signal is synchronous and we know precisely when - // it can occur. SerializePage_lock is a transiently-held leaf lock, so - // lock_without_safepoint_check should be safe. - SerializePage_lock->lock_without_safepoint_check(); - SerializePage_lock->unlock(); + // it can occur. + Thread::muxAcquire(&SerializePageLock, "set_memory_serialize_page"); + Thread::muxRelease(&SerializePageLock); } // Serialize all thread state variables @@ -990,14 +990,12 @@ // On some platforms such as Solaris & Linux, the time duration of the page // permission restoration is observed to be much longer than expected due to // scheduler starvation problem etc. To avoid the long synchronization - // time and expensive page trap spinning, 'SerializePage_lock' is used to block - // the mutator thread if such case is encountered. Since this method is always - // called by VMThread during safepoint, lock_without_safepoint_check is used - // instead. See bug 6546278. - SerializePage_lock->lock_without_safepoint_check(); + // time and expensive page trap spinning, 'SerializePageLock' is used to block + // the mutator thread if such case is encountered. See bug 6546278 for details. + Thread::muxAcquire(&SerializePageLock, "serialize_thread_states"); os::protect_memory( (char *)os::get_memory_serialize_page(), os::vm_page_size() ); os::unguard_memory( (char *)os::get_memory_serialize_page(), os::vm_page_size() ); - SerializePage_lock->unlock(); + Thread::muxRelease(&SerializePageLock); } // Returns true if the current stack pointer is above the stack shadow diff -r 7836be3e92d0 -r 887682771f69 src/share/vm/runtime/sharedRuntime.cpp --- a/src/share/vm/runtime/sharedRuntime.cpp Fri Feb 29 20:03:58 2008 -0800 +++ b/src/share/vm/runtime/sharedRuntime.cpp Wed Mar 12 16:31:37 2008 -0700 @@ -1481,11 +1481,9 @@ const char* desc = " cannot be cast to "; size_t msglen = strlen(objName) + strlen(desc) + strlen(targetKlassName) + 1; - char* message = NEW_C_HEAP_ARRAY(char, msglen); + char* message = NEW_RESOURCE_ARRAY(char, msglen); if (NULL == message) { - // out of memory - can't use a detailed message. Since caller is - // using a resource mark to free memory, returning this should be - // safe (caller won't explicitly delete it). + // Shouldn't happen, but don't cause even more problems if it does message = const_cast(objName); } else { jio_snprintf(message, msglen, "%s%s%s", objName, desc, targetKlassName); diff -r 7836be3e92d0 -r 887682771f69 src/share/vm/utilities/vmError.cpp --- a/src/share/vm/utilities/vmError.cpp Fri Feb 29 20:03:58 2008 -0800 +++ b/src/share/vm/utilities/vmError.cpp Wed Mar 12 16:31:37 2008 -0700 @@ -170,7 +170,8 @@ out->print_raw_cr(Arguments::java_vendor_url_bug()); // If the crash is in native code, encourage user to submit a bug to the // provider of that code. - if (thread && thread->is_Java_thread()) { + if (thread && thread->is_Java_thread() && + !thread->is_hidden_from_external_view()) { JavaThread* jt = (JavaThread*)thread; if (jt->thread_state() == _thread_in_native) { out->print_cr("# The crash happened outside the Java Virtual Machine in native code.\n# See problematic frame for where to report the bug."); @@ -249,10 +250,10 @@ BEGIN - STEP(10, "(printing unexpected error message)") + STEP(10, "(printing fatal error message)") st->print_cr("#"); - st->print_cr("# An unexpected error has been detected by Java Runtime Environment:"); + st->print_cr("# A fatal error has been detected by the Java Runtime Environment:"); STEP(15, "(printing type of error)")