/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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.
*
*/
#include "precompiled.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/safepoint.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):
//
// Note that the following pointers are effectively final -- after having been
// set at JVM startup-time, they should never be subsequently mutated.
// Instead of using pointers to malloc()ed monitors and mutexes we should consider
// eliminating the indirection and using instances instead.
// Consider using GCC's __read_mostly.
#ifndef PRODUCT
#endif
static int _num_mutex;
#ifdef ASSERT
// check if this thread owns the lock (common case)
if (IgnoreLockingAssertions) return;
if (lock->owned_by_self()) return;
if (SafepointSynchronize::is_at_safepoint()) return;
if (!Universe::is_fully_initialized()) return;
// see if invoker of VM operation owns it
}
// a stronger assertion than the above
if (IgnoreLockingAssertions) return;
if (lock->owned_by_self()) return;
}
#endif
"increase MAX_NUM_MUTEX"); \
}
void mutex_init() {
if (UseConcMarkSweepGC) {
}
if (UseConcMarkSweepGC || UseG1GC) {
}
if (UseG1GC) {
}
#ifndef PRODUCT
#endif
def(PerfDataMemAlloc_lock , Mutex , leaf, true ); // used for allocating PerfData memory for performance data
def(PerfDataManager_lock , Mutex , leaf, true ); // used for synchronized access to PerfDataManager resources
// CMS_modUnionTable_lock leaf
// CMS_bitMap_lock leaf + 1
// CMS_freeList_lock leaf + 2
if (UseConcMarkSweepGC) {
// used in CMS GC for locking PLL lock
}
def(JNICachedItableIndex_lock , Mutex , nonleaf+1, false); // Used to cache an itable index during JNI invoke
def(JvmtiThreadState_lock , Mutex , nonleaf+2, false); // Used by JvmtiThreadState/JvmtiEventController
}
if (SafepointSynchronize::is_at_safepoint()) {
_locked = false;
} else {
_locked = true;
}
}
// by fatal error handler.
bool none = true;
for (int i = 0; i < _num_mutex; i++) {
// see if it has an owner
if (none) {
// print format used by Mutex::print_on_error()
none = false;
}
}
}
}