8222811: Consolidate MutexLockerEx and MutexLocker
Make MutexLocker be MutexLockerEx implementation, remove MutexLockerEx calls. Reviewed-by: dcubed, dholmes, pliden, rehn
This commit is contained in:
parent
88303d1c60
commit
fbafef11c0
src/hotspot
os
share
aot
c1
classfile
classLoaderData.cppdictionary.cpppackageEntry.cppprotectionDomainCache.cppstringTable.cppsymbolTable.cppsystemDictionary.cpp
code
compiler
gc
cms
cmsVMOperations.cppcompactibleFreeListSpace.cppconcurrentMarkSweepGeneration.cppconcurrentMarkSweepGeneration.hppconcurrentMarkSweepThread.cppyieldingWorkgroup.cpp
epsilon
g1
g1Allocator.cppg1CollectedHeap.cppg1ConcurrentMark.cppg1ConcurrentMarkThread.cppg1ConcurrentRefineThread.cppg1FullGCOopClosures.cppg1MonitoringSupport.cppg1RootProcessor.cppg1SharedDirtyCardQueue.cppg1StringDedupQueue.cppg1VMOperations.cppg1YoungRemSetSamplingThread.cppheapRegion.cppheapRegionRemSet.cppheapRegionRemSet.hpp
parallel
shared
collectedHeap.cppconcurrentGCPhaseManager.cppconcurrentGCThread.cppgenCollectedHeap.cppoopStorage.cppowstTaskTerminator.cppptrQueue.cppsatbMarkQueue.cpp
stringdedup
suspendibleThreadSet.cppworkgroup.cppshenandoah
z
jfr
periodic
recorder
checkpoint/types
repository
service
stacktrace
storage
jvmci
memory
oops
prims
jvm.cppjvmtiCodeBlobEvents.cppjvmtiEnv.cppjvmtiEventController.cppjvmtiExport.cppmethodHandles.cppresolvedMethodTable.cppwhitebox.cpp
runtime
@ -678,7 +678,7 @@ static void *thread_native_entry(Thread *thread) {
|
||||
|
||||
// handshaking with parent thread
|
||||
{
|
||||
MutexLockerEx ml(sync, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(sync, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
// notify parent thread
|
||||
osthread->set_state(INITIALIZED);
|
||||
@ -686,7 +686,7 @@ static void *thread_native_entry(Thread *thread) {
|
||||
|
||||
// wait until os::start_thread()
|
||||
while (osthread->get_state() == INITIALIZED) {
|
||||
sync->wait(Mutex::_no_safepoint_check_flag);
|
||||
sync->wait_without_safepoint_check();
|
||||
}
|
||||
}
|
||||
|
||||
@ -766,9 +766,9 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
|
||||
// Wait until child thread is either initialized or aborted
|
||||
{
|
||||
Monitor* sync_with_child = osthread->startThread_lock();
|
||||
MutexLockerEx ml(sync_with_child, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(sync_with_child, Mutex::_no_safepoint_check_flag);
|
||||
while ((state = osthread->get_state()) == ALLOCATED) {
|
||||
sync_with_child->wait(Mutex::_no_safepoint_check_flag);
|
||||
sync_with_child->wait_without_safepoint_check();
|
||||
}
|
||||
}
|
||||
|
||||
@ -840,7 +840,7 @@ void os::pd_start_thread(Thread* thread) {
|
||||
OSThread * osthread = thread->osthread();
|
||||
assert(osthread->get_state() != INITIALIZED, "just checking");
|
||||
Monitor* sync_with_child = osthread->startThread_lock();
|
||||
MutexLockerEx ml(sync_with_child, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(sync_with_child, Mutex::_no_safepoint_check_flag);
|
||||
sync_with_child->notify();
|
||||
}
|
||||
|
||||
|
@ -773,7 +773,7 @@ static void *thread_native_entry(Thread *thread) {
|
||||
|
||||
// handshaking with parent thread
|
||||
{
|
||||
MutexLockerEx ml(sync, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(sync, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
// notify parent thread
|
||||
osthread->set_state(INITIALIZED);
|
||||
@ -781,7 +781,7 @@ static void *thread_native_entry(Thread *thread) {
|
||||
|
||||
// wait until os::start_thread()
|
||||
while (osthread->get_state() == INITIALIZED) {
|
||||
sync->wait(Mutex::_no_safepoint_check_flag);
|
||||
sync->wait_without_safepoint_check();
|
||||
}
|
||||
}
|
||||
|
||||
@ -881,9 +881,9 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
|
||||
// Wait until child thread is either initialized or aborted
|
||||
{
|
||||
Monitor* sync_with_child = osthread->startThread_lock();
|
||||
MutexLockerEx ml(sync_with_child, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(sync_with_child, Mutex::_no_safepoint_check_flag);
|
||||
while ((state = osthread->get_state()) == ALLOCATED) {
|
||||
sync_with_child->wait(Mutex::_no_safepoint_check_flag);
|
||||
sync_with_child->wait_without_safepoint_check();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -975,7 +975,7 @@ void os::pd_start_thread(Thread* thread) {
|
||||
OSThread * osthread = thread->osthread();
|
||||
assert(osthread->get_state() != INITIALIZED, "just checking");
|
||||
Monitor* sync_with_child = osthread->startThread_lock();
|
||||
MutexLockerEx ml(sync_with_child, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(sync_with_child, Mutex::_no_safepoint_check_flag);
|
||||
sync_with_child->notify();
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ bool AOTCompiledMethod::make_not_entrant_helper(int new_state) {
|
||||
|
||||
{
|
||||
// Enter critical section. Does not block for safepoint.
|
||||
MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
if (*_state_adr == new_state) {
|
||||
// another thread already performed this transition so nothing
|
||||
@ -218,7 +218,7 @@ bool AOTCompiledMethod::make_entrant() {
|
||||
|
||||
{
|
||||
// Enter critical section. Does not block for safepoint.
|
||||
MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
if (*_state_adr == in_use) {
|
||||
// another thread already performed this transition so nothing
|
||||
|
@ -200,7 +200,7 @@ void AOTLoader::universe_init() {
|
||||
if ((*lib)->is_valid()) {
|
||||
AOTCodeHeap* heap = new AOTCodeHeap(*lib);
|
||||
{
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
add_heap(heap);
|
||||
CodeCache::add_heap(heap);
|
||||
}
|
||||
|
@ -1046,7 +1046,7 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_i
|
||||
// Now copy code back
|
||||
|
||||
{
|
||||
MutexLockerEx ml_patch (Patching_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml_patch (Patching_lock, Mutex::_no_safepoint_check_flag);
|
||||
//
|
||||
// Deoptimization may have happened while we waited for the lock.
|
||||
// In that case we don't bother to do any patching we just return
|
||||
@ -1265,7 +1265,7 @@ JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_i
|
||||
// If we are patching in a non-perm oop, make sure the nmethod
|
||||
// is on the right list.
|
||||
{
|
||||
MutexLockerEx ml_code (CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml_code (CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
nmethod* nm = CodeCache::find_nmethod(caller_frame.pc());
|
||||
guarantee(nm != NULL, "only nmethods can contain non-perm oops");
|
||||
|
||||
|
@ -449,7 +449,7 @@ void ClassLoaderData::record_dependency(const Klass* k) {
|
||||
|
||||
void ClassLoaderData::add_class(Klass* k, bool publicize /* true */) {
|
||||
{
|
||||
MutexLockerEx ml(metaspace_lock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(metaspace_lock(), Mutex::_no_safepoint_check_flag);
|
||||
Klass* old_value = _klasses;
|
||||
k->set_next_link(old_value);
|
||||
// Link the new item into the list, making sure the linked class is stable
|
||||
@ -549,7 +549,7 @@ ModuleEntryTable* ClassLoaderData::modules() {
|
||||
modules = new ModuleEntryTable(ModuleEntryTable::_moduletable_entry_size);
|
||||
|
||||
{
|
||||
MutexLockerEx m1(metaspace_lock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker m1(metaspace_lock(), Mutex::_no_safepoint_check_flag);
|
||||
// Ensure _modules is stable, since it is examined without a lock
|
||||
OrderAccess::release_store(&_modules, modules);
|
||||
}
|
||||
@ -743,7 +743,7 @@ ClassLoaderMetaspace* ClassLoaderData::metaspace_non_null() {
|
||||
// Lock-free access requires load_acquire.
|
||||
ClassLoaderMetaspace* metaspace = OrderAccess::load_acquire(&_metaspace);
|
||||
if (metaspace == NULL) {
|
||||
MutexLockerEx ml(_metaspace_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(_metaspace_lock, Mutex::_no_safepoint_check_flag);
|
||||
// Check if _metaspace got allocated while we were waiting for this lock.
|
||||
if ((metaspace = _metaspace) == NULL) {
|
||||
if (this == the_null_class_loader_data()) {
|
||||
@ -764,7 +764,7 @@ ClassLoaderMetaspace* ClassLoaderData::metaspace_non_null() {
|
||||
}
|
||||
|
||||
OopHandle ClassLoaderData::add_handle(Handle h) {
|
||||
MutexLockerEx ml(metaspace_lock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(metaspace_lock(), Mutex::_no_safepoint_check_flag);
|
||||
record_modified_oops();
|
||||
return OopHandle(_handles.add(h()));
|
||||
}
|
||||
@ -779,7 +779,7 @@ void ClassLoaderData::remove_handle(OopHandle h) {
|
||||
}
|
||||
|
||||
void ClassLoaderData::init_handle_locked(OopHandle& dest, Handle h) {
|
||||
MutexLockerEx ml(metaspace_lock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(metaspace_lock(), Mutex::_no_safepoint_check_flag);
|
||||
if (dest.resolve() != NULL) {
|
||||
return;
|
||||
} else {
|
||||
@ -792,7 +792,7 @@ void ClassLoaderData::init_handle_locked(OopHandle& dest, Handle h) {
|
||||
void ClassLoaderData::add_to_deallocate_list(Metadata* m) {
|
||||
// Metadata in shared region isn't deleted.
|
||||
if (!m->is_shared()) {
|
||||
MutexLockerEx ml(metaspace_lock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(metaspace_lock(), Mutex::_no_safepoint_check_flag);
|
||||
if (_deallocate_list == NULL) {
|
||||
_deallocate_list = new (ResourceObj::C_HEAP, mtClass) GrowableArray<Metadata*>(100, true);
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ bool Dictionary::resize_if_needed() {
|
||||
bool DictionaryEntry::contains_protection_domain(oop protection_domain) const {
|
||||
// Lock the pd_set list. This lock cannot safepoint since the caller holds
|
||||
// a Dictionary entry, which can be moved if the Dictionary is resized.
|
||||
MutexLockerEx ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
|
||||
#ifdef ASSERT
|
||||
if (oopDesc::equals(protection_domain, instance_klass()->protection_domain())) {
|
||||
// Ensure this doesn't show up in the pd_set (invariant)
|
||||
@ -191,7 +191,7 @@ void DictionaryEntry::add_protection_domain(Dictionary* dict, Handle protection_
|
||||
ProtectionDomainCacheEntry* entry = SystemDictionary::cache_get(protection_domain);
|
||||
// The pd_set in the dictionary entry is protected by a low level lock.
|
||||
// With concurrent PD table cleanup, these links could be broken.
|
||||
MutexLockerEx ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
|
||||
ProtectionDomainEntry* new_head =
|
||||
new ProtectionDomainEntry(entry, pd_set());
|
||||
set_pd_set(new_head);
|
||||
@ -369,7 +369,7 @@ void Dictionary::clean_cached_protection_domains() {
|
||||
probe = probe->next()) {
|
||||
Klass* e = probe->instance_klass();
|
||||
|
||||
MutexLockerEx ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
|
||||
ProtectionDomainEntry* current = probe->pd_set();
|
||||
ProtectionDomainEntry* prev = NULL;
|
||||
while (current != NULL) {
|
||||
@ -460,7 +460,7 @@ void SymbolPropertyTable::methods_do(void f(Method*)) {
|
||||
}
|
||||
|
||||
void DictionaryEntry::verify_protection_domain_set() {
|
||||
MutexLockerEx ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
|
||||
for (ProtectionDomainEntry* current = pd_set(); // accessed at a safepoint
|
||||
current != NULL;
|
||||
current = current->_next) {
|
||||
@ -469,7 +469,7 @@ void DictionaryEntry::verify_protection_domain_set() {
|
||||
}
|
||||
|
||||
void DictionaryEntry::print_count(outputStream *st) {
|
||||
MutexLockerEx ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(ProtectionDomainSet_lock, Mutex::_no_safepoint_check_flag);
|
||||
int count = 0;
|
||||
for (ProtectionDomainEntry* current = pd_set(); // accessed inside SD lock
|
||||
current != NULL;
|
||||
|
@ -245,7 +245,7 @@ PackageEntry* PackageEntryTable::lookup(Symbol* name, ModuleEntry* module) {
|
||||
|
||||
PackageEntry* PackageEntryTable::lookup_only(Symbol* name) {
|
||||
assert(!Module_lock->owned_by_self(), "should not have the Module_lock - use locked_lookup_only");
|
||||
MutexLockerEx ml(Module_lock);
|
||||
MutexLocker ml(Module_lock);
|
||||
return locked_lookup_only(name);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ ProtectionDomainCacheTable::ProtectionDomainCacheTable(int table_size)
|
||||
}
|
||||
|
||||
void ProtectionDomainCacheTable::trigger_cleanup() {
|
||||
MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||
_dead_entries = true;
|
||||
Service_lock->notify_all();
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ size_t StringTable::table_size() {
|
||||
}
|
||||
|
||||
void StringTable::trigger_concurrent_work() {
|
||||
MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||
the_table()->_has_work = true;
|
||||
Service_lock->notify_all();
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ SymbolTable::SymbolTable() :
|
||||
|
||||
void SymbolTable::delete_symbol(Symbol* sym) {
|
||||
if (sym->refcount() == PERM_REFCOUNT) {
|
||||
MutexLockerEx ml(SymbolArena_lock, Mutex::_no_safepoint_check_flag); // Protect arena
|
||||
MutexLocker ml(SymbolArena_lock, Mutex::_no_safepoint_check_flag); // Protect arena
|
||||
// Deleting permanent symbol should not occur very often (insert race condition),
|
||||
// so log it.
|
||||
log_trace_symboltable_helper(sym, "Freeing permanent symbol");
|
||||
@ -190,7 +190,7 @@ size_t SymbolTable::table_size() {
|
||||
}
|
||||
|
||||
void SymbolTable::trigger_cleanup() {
|
||||
MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||
SymbolTable::the_table()->_has_work = true;
|
||||
Service_lock->notify_all();
|
||||
}
|
||||
@ -208,7 +208,7 @@ Symbol* SymbolTable::allocate_symbol(const char* name, int len, bool c_heap, TRA
|
||||
assert(sym != NULL, "new should call vm_exit_out_of_memory if C_HEAP is exhausted");
|
||||
} else {
|
||||
// Allocate to global arena
|
||||
MutexLockerEx ml(SymbolArena_lock, Mutex::_no_safepoint_check_flag); // Protect arena
|
||||
MutexLocker ml(SymbolArena_lock, Mutex::_no_safepoint_check_flag); // Protect arena
|
||||
sym = new (len, arena(), THREAD) Symbol((const u1*)name, len, PERM_REFCOUNT);
|
||||
}
|
||||
return sym;
|
||||
|
@ -1824,10 +1824,10 @@ bool SystemDictionary::do_unloading(GCTimer* gc_timer) {
|
||||
// First, mark for unload all ClassLoaderData referencing a dead class loader.
|
||||
unloading_occurred = ClassLoaderDataGraph::do_unloading();
|
||||
if (unloading_occurred) {
|
||||
MutexLockerEx ml2(is_concurrent ? Module_lock : NULL);
|
||||
MutexLocker ml2(is_concurrent ? Module_lock : NULL);
|
||||
JFR_ONLY(Jfr::on_unloading_classes();)
|
||||
|
||||
MutexLockerEx ml1(is_concurrent ? SystemDictionary_lock : NULL);
|
||||
MutexLocker ml1(is_concurrent ? SystemDictionary_lock : NULL);
|
||||
ClassLoaderDataGraph::clean_module_and_package_info();
|
||||
constraints()->purge_loader_constraints();
|
||||
resolution_errors()->purge_resolution_errors();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2019, 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
|
||||
@ -227,7 +227,7 @@ BufferBlob* BufferBlob::create(const char* name, int buffer_size) {
|
||||
size += align_up(buffer_size, oopSize);
|
||||
assert(name != NULL, "must provide a name");
|
||||
{
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
blob = new (size) BufferBlob(name, size);
|
||||
}
|
||||
// Track memory usage statistic after releasing CodeCache_lock
|
||||
@ -248,7 +248,7 @@ BufferBlob* BufferBlob::create(const char* name, CodeBuffer* cb) {
|
||||
unsigned int size = CodeBlob::allocation_size(cb, sizeof(BufferBlob));
|
||||
assert(name != NULL, "must provide a name");
|
||||
{
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
blob = new (size) BufferBlob(name, size, cb);
|
||||
}
|
||||
// Track memory usage statistic after releasing CodeCache_lock
|
||||
@ -265,7 +265,7 @@ void BufferBlob::free(BufferBlob *blob) {
|
||||
ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock
|
||||
blob->flush();
|
||||
{
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
CodeCache::free((RuntimeBlob*)blob);
|
||||
}
|
||||
// Track memory usage statistic after releasing CodeCache_lock
|
||||
@ -287,7 +287,7 @@ AdapterBlob* AdapterBlob::create(CodeBuffer* cb) {
|
||||
AdapterBlob* blob = NULL;
|
||||
unsigned int size = CodeBlob::allocation_size(cb, sizeof(AdapterBlob));
|
||||
{
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
blob = new (size) AdapterBlob(size, cb);
|
||||
}
|
||||
// Track memory usage statistic after releasing CodeCache_lock
|
||||
@ -310,7 +310,7 @@ VtableBlob* VtableBlob::create(const char* name, int buffer_size) {
|
||||
size += align_up(buffer_size, oopSize);
|
||||
assert(name != NULL, "must provide a name");
|
||||
{
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
blob = new (size) VtableBlob(name, size);
|
||||
}
|
||||
// Track memory usage statistic after releasing CodeCache_lock
|
||||
@ -331,7 +331,7 @@ MethodHandlesAdapterBlob* MethodHandlesAdapterBlob::create(int buffer_size) {
|
||||
size = CodeBlob::align_code_offset(size);
|
||||
size += align_up(buffer_size, oopSize);
|
||||
{
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
blob = new (size) MethodHandlesAdapterBlob(size);
|
||||
if (blob == NULL) {
|
||||
vm_exit_out_of_memory(size, OOM_MALLOC_ERROR, "CodeCache: no room for method handle adapter blob");
|
||||
@ -369,7 +369,7 @@ RuntimeStub* RuntimeStub::new_runtime_stub(const char* stub_name,
|
||||
RuntimeStub* stub = NULL;
|
||||
ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock
|
||||
{
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
unsigned int size = CodeBlob::allocation_size(cb, sizeof(RuntimeStub));
|
||||
stub = new (size) RuntimeStub(stub_name, cb, size, frame_complete, frame_size, oop_maps, caller_must_gc_arguments);
|
||||
}
|
||||
@ -428,7 +428,7 @@ DeoptimizationBlob* DeoptimizationBlob::create(
|
||||
DeoptimizationBlob* blob = NULL;
|
||||
ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock
|
||||
{
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
unsigned int size = CodeBlob::allocation_size(cb, sizeof(DeoptimizationBlob));
|
||||
blob = new (size) DeoptimizationBlob(cb,
|
||||
size,
|
||||
@ -467,7 +467,7 @@ UncommonTrapBlob* UncommonTrapBlob::create(
|
||||
UncommonTrapBlob* blob = NULL;
|
||||
ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock
|
||||
{
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
unsigned int size = CodeBlob::allocation_size(cb, sizeof(UncommonTrapBlob));
|
||||
blob = new (size) UncommonTrapBlob(cb, size, oop_maps, frame_size);
|
||||
}
|
||||
@ -503,7 +503,7 @@ ExceptionBlob* ExceptionBlob::create(
|
||||
ExceptionBlob* blob = NULL;
|
||||
ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock
|
||||
{
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
unsigned int size = CodeBlob::allocation_size(cb, sizeof(ExceptionBlob));
|
||||
blob = new (size) ExceptionBlob(cb, size, oop_maps, frame_size);
|
||||
}
|
||||
@ -538,7 +538,7 @@ SafepointBlob* SafepointBlob::create(
|
||||
SafepointBlob* blob = NULL;
|
||||
ThreadInVMfromUnknown __tiv; // get to VM state in case we block on CodeCache_lock
|
||||
{
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
unsigned int size = CodeBlob::allocation_size(cb, sizeof(SafepointBlob));
|
||||
blob = new (size) SafepointBlob(cb, size, oop_maps, frame_size);
|
||||
}
|
||||
|
@ -531,7 +531,7 @@ CodeBlob* CodeCache::allocate(int size, int code_blob_type, int orig_code_blob_t
|
||||
return allocate(size, type, orig_code_blob_type);
|
||||
}
|
||||
}
|
||||
MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexUnlocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
CompileBroker::handle_full_code_cache(orig_code_blob_type);
|
||||
return NULL;
|
||||
}
|
||||
@ -792,7 +792,7 @@ CodeCache::UnloadingScope::~UnloadingScope() {
|
||||
}
|
||||
|
||||
void CodeCache::verify_oops() {
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
VerifyOopClosure voc;
|
||||
NMethodIterator iter(NMethodIterator::only_alive_and_not_unloading);
|
||||
while(iter.next()) {
|
||||
@ -989,7 +989,7 @@ void CodeCache::cleanup_inline_caches() {
|
||||
NOT_PRODUCT(static elapsedTimer dependentCheckTime;)
|
||||
|
||||
int CodeCache::mark_for_deoptimization(KlassDepChange& changes) {
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
int number_of_marked_CodeBlobs = 0;
|
||||
|
||||
// search the hierarchy looking for nmethods which are affected by the loading of this class
|
||||
@ -1154,7 +1154,7 @@ void CodeCache::flush_evol_dependents() {
|
||||
|
||||
// Deoptimize all methods
|
||||
void CodeCache::mark_all_nmethods_for_deoptimization() {
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
|
||||
while(iter.next()) {
|
||||
CompiledMethod* nm = iter.method();
|
||||
@ -1165,7 +1165,7 @@ void CodeCache::mark_all_nmethods_for_deoptimization() {
|
||||
}
|
||||
|
||||
int CodeCache::mark_for_deoptimization(Method* dependee) {
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
int number_of_marked_CodeBlobs = 0;
|
||||
|
||||
CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
|
||||
@ -1289,7 +1289,7 @@ void CodeCache::report_codemem_full(int code_blob_type, bool print) {
|
||||
stringStream s;
|
||||
// Dump code cache into a buffer before locking the tty.
|
||||
{
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
print_summary(&s);
|
||||
}
|
||||
{
|
||||
@ -1557,7 +1557,7 @@ void CodeCache::print_summary(outputStream* st, bool detailed) {
|
||||
}
|
||||
|
||||
void CodeCache::print_codelist(outputStream* st) {
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
|
||||
while (iter.next()) {
|
||||
@ -1572,7 +1572,7 @@ void CodeCache::print_codelist(outputStream* st) {
|
||||
}
|
||||
|
||||
void CodeCache::print_layout(outputStream* st) {
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
ResourceMark rm;
|
||||
print_summary(st, true);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2019, 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
|
||||
@ -258,7 +258,7 @@ void InlineCacheBuffer::release_pending_icholders() {
|
||||
// not safe to free them until them since they might be visible to
|
||||
// another thread.
|
||||
void InlineCacheBuffer::queue_for_release(CompiledICHolder* icholder) {
|
||||
MutexLockerEx mex(InlineCacheBuffer_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mex(InlineCacheBuffer_lock, Mutex::_no_safepoint_check_flag);
|
||||
icholder->set_next(_pending_released);
|
||||
_pending_released = icholder;
|
||||
_pending_count++;
|
||||
|
@ -446,7 +446,7 @@ nmethod* nmethod::new_native_nmethod(const methodHandle& method,
|
||||
// create nmethod
|
||||
nmethod* nm = NULL;
|
||||
{
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
int native_nmethod_size = CodeBlob::allocation_size(code_buffer, sizeof(nmethod));
|
||||
CodeOffsets offsets;
|
||||
offsets.set_value(CodeOffsets::Verified_Entry, vep_offset);
|
||||
@ -492,7 +492,7 @@ nmethod* nmethod::new_nmethod(const methodHandle& method,
|
||||
code_buffer->finalize_oop_references(method);
|
||||
// create nmethod
|
||||
nmethod* nm = NULL;
|
||||
{ MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
{ MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
int nmethod_size =
|
||||
CodeBlob::allocation_size(code_buffer, sizeof(nmethod))
|
||||
+ adjust_pcs_size(debug_info->pcs_size())
|
||||
@ -1103,7 +1103,7 @@ void nmethod::make_unloaded() {
|
||||
|
||||
// Unregister must be done before the state change
|
||||
{
|
||||
MutexLockerEx ml(SafepointSynchronize::is_at_safepoint() ? NULL : CodeCache_lock,
|
||||
MutexLocker ml(SafepointSynchronize::is_at_safepoint() ? NULL : CodeCache_lock,
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
Universe::heap()->unregister_nmethod(this);
|
||||
CodeCache::unregister_old_nmethod(this);
|
||||
@ -1222,7 +1222,7 @@ bool nmethod::make_not_entrant_or_zombie(int state) {
|
||||
}
|
||||
|
||||
// Enter critical section. Does not block for safepoint.
|
||||
MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
if (_state == state) {
|
||||
// another thread already performed this transition so nothing
|
||||
@ -1289,7 +1289,7 @@ bool nmethod::make_not_entrant_or_zombie(int state) {
|
||||
// Flushing dependencies must be done before any possible
|
||||
// safepoint can sneak in, otherwise the oops used by the
|
||||
// dependency logic could have become stale.
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
if (nmethod_needs_unregister) {
|
||||
Universe::heap()->unregister_nmethod(this);
|
||||
CodeCache::unregister_old_nmethod(this);
|
||||
@ -1334,7 +1334,7 @@ bool nmethod::make_not_entrant_or_zombie(int state) {
|
||||
}
|
||||
|
||||
void nmethod::flush() {
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
// Note that there are no valid oops in the nmethod anymore.
|
||||
assert(!is_osr_method() || is_unloaded() || is_zombie(),
|
||||
"osr nmethod must be unloaded or zombie before flushing");
|
||||
@ -1452,7 +1452,7 @@ void nmethod::post_compiled_method_load_event() {
|
||||
|
||||
if (JvmtiExport::should_post_compiled_method_load()) {
|
||||
// Let the Service thread (which is a real Java thread) post the event
|
||||
MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||
JvmtiDeferredEventQueue::enqueue(
|
||||
JvmtiDeferredEvent::compiled_method_load_event(this));
|
||||
}
|
||||
@ -1490,7 +1490,7 @@ void nmethod::post_compiled_method_unload() {
|
||||
JvmtiDeferredEvent event =
|
||||
JvmtiDeferredEvent::compiled_method_unload_event(this,
|
||||
_jmethod_id, insts_begin());
|
||||
MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||
JvmtiDeferredEventQueue::enqueue(event);
|
||||
}
|
||||
|
||||
@ -2922,7 +2922,7 @@ void nmethod::invalidate_installed_code(Handle installedCode, TRAPS) {
|
||||
nmethodLocker nml(nm);
|
||||
#ifdef ASSERT
|
||||
{
|
||||
MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
|
||||
// This relationship can only be checked safely under a lock
|
||||
assert(!nm->is_alive() || nm->is_unloading() || nm->jvmci_installed_code() == installedCode(), "sanity check");
|
||||
}
|
||||
@ -2939,7 +2939,7 @@ void nmethod::invalidate_installed_code(Handle installedCode, TRAPS) {
|
||||
// Multiple threads could reach this point so we now need to
|
||||
// lock and re-check the link to the nmethod so that only one
|
||||
// thread clears it.
|
||||
MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
|
||||
if (InstalledCode::address(installedCode) == nativeMethod) {
|
||||
InstalledCode::set_address(installedCode, 0);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2019, 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
|
||||
@ -207,7 +207,7 @@ void StubQueue::remove_all(){
|
||||
void StubQueue::verify() {
|
||||
// verify only if initialized
|
||||
if (_stub_buffer == NULL) return;
|
||||
MutexLockerEx lock(_mutex, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker lock(_mutex, Mutex::_no_safepoint_check_flag);
|
||||
// verify index boundaries
|
||||
guarantee(0 <= _buffer_size, "buffer size must be positive");
|
||||
guarantee(0 <= _buffer_limit && _buffer_limit <= _buffer_size , "_buffer_limit out of bounds");
|
||||
@ -234,7 +234,7 @@ void StubQueue::verify() {
|
||||
|
||||
|
||||
void StubQueue::print() {
|
||||
MutexLockerEx lock(_mutex, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker lock(_mutex, Mutex::_no_safepoint_check_flag);
|
||||
for (Stub* s = first(); s != NULL; s = next(s)) {
|
||||
stub_print(s);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2019, 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
|
||||
@ -125,7 +125,7 @@ int VtableStubs::_itab_stub_size = 0;
|
||||
void VtableStubs::initialize() {
|
||||
VtableStub::_receiver_location = SharedRuntime::name_for_receiver();
|
||||
{
|
||||
MutexLockerEx ml(VtableStubs_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(VtableStubs_lock, Mutex::_no_safepoint_check_flag);
|
||||
assert(_number_of_vtable_stubs == 0, "potential performance bug: VtableStubs initialized more than once");
|
||||
assert(is_power_of_2(N), "N must be a power of 2");
|
||||
for (int i = 0; i < N; i++) {
|
||||
@ -211,7 +211,7 @@ address VtableStubs::find_stub(bool is_vtable_stub, int vtable_index) {
|
||||
|
||||
VtableStub* s;
|
||||
{
|
||||
MutexLockerEx ml(VtableStubs_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(VtableStubs_lock, Mutex::_no_safepoint_check_flag);
|
||||
s = ShareVtableStubs ? lookup(is_vtable_stub, vtable_index) : NULL;
|
||||
if (s == NULL) {
|
||||
if (is_vtable_stub) {
|
||||
@ -271,7 +271,7 @@ void VtableStubs::enter(bool is_vtable_stub, int vtable_index, VtableStub* s) {
|
||||
}
|
||||
|
||||
VtableStub* VtableStubs::entry_point(address pc) {
|
||||
MutexLockerEx ml(VtableStubs_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(VtableStubs_lock, Mutex::_no_safepoint_check_flag);
|
||||
VtableStub* stub = (VtableStub*)(pc - VtableStub::entry_offset());
|
||||
uint hash = VtableStubs::hash(stub->is_vtable_stub(), stub->index());
|
||||
VtableStub* s;
|
||||
|
@ -423,7 +423,7 @@ CompileTask* CompileQueue::get() {
|
||||
// We need a timed wait here, since compiler threads can exit if compilation
|
||||
// is disabled forever. We use 5 seconds wait time; the exiting of compiler threads
|
||||
// is not critical and we do not want idle compiler threads to wake up too often.
|
||||
MethodCompileQueue_lock->wait(!Mutex::_no_safepoint_check_flag, 5*1000);
|
||||
MethodCompileQueue_lock->wait(5*1000);
|
||||
|
||||
if (UseDynamicNumberOfCompilerThreads && _first == NULL) {
|
||||
// Still nothing to compile. Give caller a chance to stop this thread.
|
||||
@ -1500,7 +1500,7 @@ bool CompileBroker::wait_for_jvmci_completion(JVMCICompiler* jvmci, CompileTask*
|
||||
int progress_wait_attempts = 0;
|
||||
int methods_compiled = jvmci->methods_compiled();
|
||||
while (!task->is_complete() && !is_compilation_disabled_forever() &&
|
||||
task->lock()->wait(!Mutex::_no_safepoint_check_flag, JVMCI_COMPILATION_PROGRESS_WAIT_TIMESLICE)) {
|
||||
task->lock()->wait(JVMCI_COMPILATION_PROGRESS_WAIT_TIMESLICE)) {
|
||||
CompilerThread* jvmci_compiler_thread = task->jvmci_compiler_thread();
|
||||
|
||||
bool progress;
|
||||
@ -1644,7 +1644,7 @@ bool CompileBroker::init_compiler_runtime() {
|
||||
void CompileBroker::shutdown_compiler_runtime(AbstractCompiler* comp, CompilerThread* thread) {
|
||||
// Free buffer blob, if allocated
|
||||
if (thread->get_buffer_blob() != NULL) {
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
CodeCache::free(thread->get_buffer_blob());
|
||||
}
|
||||
|
||||
@ -1780,7 +1780,7 @@ void CompileBroker::compiler_thread_loop() {
|
||||
}
|
||||
// Free buffer blob, if allocated
|
||||
if (thread->get_buffer_blob() != NULL) {
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
CodeCache::free(thread->get_buffer_blob());
|
||||
}
|
||||
return; // Stop this thread.
|
||||
@ -1910,7 +1910,7 @@ static void codecache_print(bool detailed)
|
||||
stringStream s;
|
||||
// Dump code cache into a buffer before locking the tty,
|
||||
{
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
CodeCache::print_summary(&s, detailed);
|
||||
}
|
||||
ttyLocker ttyl;
|
||||
@ -1924,7 +1924,7 @@ static void codecache_print(outputStream* out, bool detailed) {
|
||||
|
||||
// Dump code cache into a buffer
|
||||
{
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
CodeCache::print_summary(&s, detailed);
|
||||
}
|
||||
|
||||
@ -2112,9 +2112,9 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
|
||||
ci_env.record_method_not_compilable("no compiler", !TieredCompilation);
|
||||
} else {
|
||||
if (WhiteBoxAPI && WhiteBox::compilation_locked) {
|
||||
MonitorLockerEx locker(Compilation_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker locker(Compilation_lock, Mutex::_no_safepoint_check_flag);
|
||||
while (WhiteBox::compilation_locked) {
|
||||
locker.wait(Mutex::_no_safepoint_check_flag);
|
||||
locker.wait();
|
||||
}
|
||||
}
|
||||
comp->compile_method(&ci_env, target, osr_bci, directive);
|
||||
@ -2678,7 +2678,7 @@ void CompileBroker::print_heapinfo(outputStream* out, const char* function, cons
|
||||
// CodeHeapStateAnalytics_lock could be held by a concurrent thread for a long time,
|
||||
// leading to an unnecessarily long hold time of the CodeCache_lock.
|
||||
ts.update(); // record starting point
|
||||
MutexLockerEx mu1(CodeHeapStateAnalytics_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu1(CodeHeapStateAnalytics_lock, Mutex::_no_safepoint_check_flag);
|
||||
out->print_cr("\n__ CodeHeapStateAnalytics lock wait took %10.3f seconds _________\n", ts.seconds());
|
||||
|
||||
// If we serve an "allFun" call, it is beneficial to hold the CodeCache_lock
|
||||
@ -2688,7 +2688,7 @@ void CompileBroker::print_heapinfo(outputStream* out, const char* function, cons
|
||||
Monitor* global_lock = allFun ? CodeCache_lock : NULL;
|
||||
Monitor* function_lock = allFun ? NULL : CodeCache_lock;
|
||||
ts_global.update(); // record starting point
|
||||
MutexLockerEx mu2(global_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu2(global_lock, Mutex::_no_safepoint_check_flag);
|
||||
if (global_lock != NULL) {
|
||||
out->print_cr("\n__ CodeCache (global) lock wait took %10.3f seconds _________\n", ts_global.seconds());
|
||||
ts_global.update(); // record starting point
|
||||
@ -2696,7 +2696,7 @@ void CompileBroker::print_heapinfo(outputStream* out, const char* function, cons
|
||||
|
||||
if (aggregate) {
|
||||
ts.update(); // record starting point
|
||||
MutexLockerEx mu3(function_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu3(function_lock, Mutex::_no_safepoint_check_flag);
|
||||
if (function_lock != NULL) {
|
||||
out->print_cr("\n__ CodeCache (function) lock wait took %10.3f seconds _________\n", ts.seconds());
|
||||
}
|
||||
@ -2716,7 +2716,7 @@ void CompileBroker::print_heapinfo(outputStream* out, const char* function, cons
|
||||
if (methodNames) {
|
||||
// print_names() has shown to be sensitive to concurrent CodeHeap modifications.
|
||||
// Therefore, request the CodeCache_lock before calling...
|
||||
MutexLockerEx mu3(function_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu3(function_lock, Mutex::_no_safepoint_check_flag);
|
||||
CodeCache::print_names(out);
|
||||
}
|
||||
if (discard) CodeCache::discard(out);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2019, 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
|
||||
@ -456,7 +456,7 @@ void DirectivesStack::init() {
|
||||
}
|
||||
|
||||
DirectiveSet* DirectivesStack::getDefaultDirective(AbstractCompiler* comp) {
|
||||
MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
assert(_bottom != NULL, "Must never be empty");
|
||||
_bottom->inc_refcount();
|
||||
@ -464,7 +464,7 @@ DirectiveSet* DirectivesStack::getDefaultDirective(AbstractCompiler* comp) {
|
||||
}
|
||||
|
||||
void DirectivesStack::push(CompilerDirectives* directive) {
|
||||
MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
directive->inc_refcount();
|
||||
if (_top == NULL) {
|
||||
@ -478,7 +478,7 @@ void DirectivesStack::push(CompilerDirectives* directive) {
|
||||
}
|
||||
|
||||
void DirectivesStack::pop(int count) {
|
||||
MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
assert(count > -1, "No negative values");
|
||||
for (int i = 0; i < count; i++) {
|
||||
pop_inner();
|
||||
@ -508,14 +508,14 @@ bool DirectivesStack::check_capacity(int request_size, outputStream* st) {
|
||||
|
||||
void DirectivesStack::clear() {
|
||||
// holding the lock during the whole operation ensuring consistent result
|
||||
MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
while (_top->next() != NULL) {
|
||||
pop_inner();
|
||||
}
|
||||
}
|
||||
|
||||
void DirectivesStack::print(outputStream* st) {
|
||||
MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
CompilerDirectives* tmp = _top;
|
||||
while (tmp != NULL) {
|
||||
tmp->print(st);
|
||||
@ -526,7 +526,7 @@ void DirectivesStack::print(outputStream* st) {
|
||||
|
||||
void DirectivesStack::release(DirectiveSet* set) {
|
||||
assert(set != NULL, "Never NULL");
|
||||
MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
if (set->is_exclusive_copy()) {
|
||||
// Old CompilecCmmands forced us to create an exclusive copy
|
||||
delete set;
|
||||
@ -550,7 +550,7 @@ DirectiveSet* DirectivesStack::getMatchingDirective(const methodHandle& method,
|
||||
|
||||
DirectiveSet* match = NULL;
|
||||
{
|
||||
MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
CompilerDirectives* dir = _top;
|
||||
assert(dir != NULL, "Must be initialized");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2019, 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
|
||||
@ -338,7 +338,7 @@ void OopMapSet::all_do(const frame *fr, const RegisterMap *reg_map,
|
||||
// Protect the operation on the derived pointers. This
|
||||
// protects the addition of derived pointers to the shared
|
||||
// derived pointer table in DerivedPointerTable::add().
|
||||
MutexLockerEx x(DerivedPointerTableGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(DerivedPointerTableGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
do {
|
||||
omv = oms.current();
|
||||
oop* loc = fr->oopmapreg_to_location(omv.reg(),reg_map);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2019, 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
|
||||
@ -45,7 +45,7 @@ void VM_CMS_Operation::verify_before_gc() {
|
||||
GCTraceTime(Info, gc, phases, verify) tm("Verify Before", _collector->_gc_timer_cm);
|
||||
HandleMark hm;
|
||||
FreelistLocker x(_collector);
|
||||
MutexLockerEx y(_collector->bitMapLock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker y(_collector->bitMapLock(), Mutex::_no_safepoint_check_flag);
|
||||
CMSHeap::heap()->prepare_for_verify();
|
||||
Universe::verify();
|
||||
}
|
||||
@ -57,7 +57,7 @@ void VM_CMS_Operation::verify_after_gc() {
|
||||
GCTraceTime(Info, gc, phases, verify) tm("Verify After", _collector->_gc_timer_cm);
|
||||
HandleMark hm;
|
||||
FreelistLocker x(_collector);
|
||||
MutexLockerEx y(_collector->bitMapLock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker y(_collector->bitMapLock(), Mutex::_no_safepoint_check_flag);
|
||||
Universe::verify();
|
||||
}
|
||||
}
|
||||
@ -183,7 +183,7 @@ void VM_GenCollectFullConcurrent::doit() {
|
||||
&& (_gc_count_before == heap->total_collections())),
|
||||
"total_collections() should be monotonically increasing");
|
||||
|
||||
MutexLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
|
||||
assert(_full_gc_count_before <= heap->total_full_collections(), "Error");
|
||||
if (heap->total_full_collections() == _full_gc_count_before) {
|
||||
// Nudge the CMS thread to start a concurrent collection.
|
||||
@ -244,11 +244,11 @@ void VM_GenCollectFullConcurrent::doit_epilogue() {
|
||||
// or by the CMS thread, so we do not want to be suspended
|
||||
// while holding that lock.
|
||||
ThreadToNativeFromVM native(jt);
|
||||
MutexLockerEx ml(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
|
||||
// Either a concurrent or a stop-world full gc is sufficient
|
||||
// witness to our request.
|
||||
while (heap->total_full_collections_completed() <= _full_gc_count_before) {
|
||||
FullGCCount_lock->wait(Mutex::_no_safepoint_check_flag);
|
||||
FullGCCount_lock->wait_without_safepoint_check();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2019, 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
|
||||
@ -1340,7 +1340,7 @@ size_t CompactibleFreeListSpace::totalSizeInIndexedFreeLists() const {
|
||||
}
|
||||
|
||||
HeapWord* CompactibleFreeListSpace::par_allocate(size_t size) {
|
||||
MutexLockerEx x(freelistLock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(freelistLock(), Mutex::_no_safepoint_check_flag);
|
||||
return allocate(size);
|
||||
}
|
||||
|
||||
@ -1524,8 +1524,8 @@ FreeChunk* CompactibleFreeListSpace::allocateScratch(size_t size) {
|
||||
// If GC is parallel, this might be called by several threads.
|
||||
// This should be rare enough that the locking overhead won't affect
|
||||
// the sequential code.
|
||||
MutexLockerEx x(parDictionaryAllocLock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(parDictionaryAllocLock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
fc = getChunkFromDictionary(size);
|
||||
}
|
||||
if (fc != NULL) {
|
||||
@ -1868,7 +1868,7 @@ CompactibleFreeListSpace::addChunkToFreeListsAtEndRecordingStats(
|
||||
Mutex* lock = &_parDictionaryAllocLock;
|
||||
FreeChunk* ec;
|
||||
{
|
||||
MutexLockerEx x(lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(lock, Mutex::_no_safepoint_check_flag);
|
||||
ec = dictionary()->find_largest_dict(); // get largest block
|
||||
if (ec != NULL && ec->end() == (uintptr_t*) chunk) {
|
||||
// It's a coterminal block - we can coalesce.
|
||||
@ -1885,7 +1885,7 @@ CompactibleFreeListSpace::addChunkToFreeListsAtEndRecordingStats(
|
||||
if (size < SmallForDictionary) {
|
||||
lock = _indexedFreeListParLocks[size];
|
||||
}
|
||||
MutexLockerEx x(lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(lock, Mutex::_no_safepoint_check_flag);
|
||||
addChunkAndRepairOffsetTable((HeapWord*)ec, size, true);
|
||||
// record the birth under the lock since the recording involves
|
||||
// manipulation of the list on which the chunk lives and
|
||||
@ -2682,8 +2682,8 @@ HeapWord* CompactibleFreeListSpaceLAB::alloc(size_t word_sz) {
|
||||
assert(word_sz == _cfls->adjustObjectSize(word_sz), "Error");
|
||||
if (word_sz >= CompactibleFreeListSpace::IndexSetSize) {
|
||||
// This locking manages sync with other large object allocations.
|
||||
MutexLockerEx x(_cfls->parDictionaryAllocLock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(_cfls->parDictionaryAllocLock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
res = _cfls->getChunkFromDictionaryExact(word_sz);
|
||||
if (res == NULL) return NULL;
|
||||
} else {
|
||||
@ -2781,8 +2781,8 @@ void CompactibleFreeListSpaceLAB::retire(int tid) {
|
||||
size_t num_retire = _indexedFreeList[i].count();
|
||||
assert(_num_blocks[i] > num_retire, "Should have used at least one");
|
||||
{
|
||||
// MutexLockerEx x(_cfls->_indexedFreeListParLocks[i],
|
||||
// Mutex::_no_safepoint_check_flag);
|
||||
// MutexLocker x(_cfls->_indexedFreeListParLocks[i],
|
||||
// Mutex::_no_safepoint_check_flag);
|
||||
|
||||
// Update globals stats for num_blocks used
|
||||
_global_num_blocks[i] += (_num_blocks[i] - num_retire);
|
||||
@ -2824,8 +2824,8 @@ bool CompactibleFreeListSpace:: par_get_chunk_of_blocks_IFL(size_t word_sz, size
|
||||
AdaptiveFreeList<FreeChunk> fl_for_cur_sz; // Empty.
|
||||
fl_for_cur_sz.set_size(cur_sz);
|
||||
{
|
||||
MutexLockerEx x(_indexedFreeListParLocks[cur_sz],
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(_indexedFreeListParLocks[cur_sz],
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
AdaptiveFreeList<FreeChunk>* gfl = &_indexedFreeList[cur_sz];
|
||||
if (gfl->count() != 0) {
|
||||
// nn is the number of chunks of size cur_sz that
|
||||
@ -2885,8 +2885,8 @@ bool CompactibleFreeListSpace:: par_get_chunk_of_blocks_IFL(size_t word_sz, size
|
||||
}
|
||||
// Update birth stats for this block size.
|
||||
size_t num = fl->count();
|
||||
MutexLockerEx x(_indexedFreeListParLocks[word_sz],
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(_indexedFreeListParLocks[word_sz],
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
ssize_t births = _indexedFreeList[word_sz].split_births() + num;
|
||||
_indexedFreeList[word_sz].set_split_births(births);
|
||||
return true;
|
||||
@ -2902,8 +2902,8 @@ FreeChunk* CompactibleFreeListSpace::get_n_way_chunk_to_split(size_t word_sz, si
|
||||
FreeChunk* rem_fc = NULL;
|
||||
size_t rem;
|
||||
{
|
||||
MutexLockerEx x(parDictionaryAllocLock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(parDictionaryAllocLock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
while (n > 0) {
|
||||
fc = dictionary()->get_chunk(MAX2(n * word_sz, _dictionary->min_size()));
|
||||
if (fc != NULL) {
|
||||
@ -2968,8 +2968,8 @@ FreeChunk* CompactibleFreeListSpace::get_n_way_chunk_to_split(size_t word_sz, si
|
||||
}
|
||||
}
|
||||
if (rem_fc != NULL) {
|
||||
MutexLockerEx x(_indexedFreeListParLocks[rem],
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(_indexedFreeListParLocks[rem],
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
_bt.verify_not_unallocated((HeapWord*)rem_fc, rem_fc->size());
|
||||
_indexedFreeList[rem].return_chunk_at_head(rem_fc);
|
||||
smallSplitBirth(rem);
|
||||
@ -3027,8 +3027,8 @@ void CompactibleFreeListSpace:: par_get_chunk_of_blocks_dictionary(size_t word_s
|
||||
assert((ssize_t)n > 0 && (ssize_t)n == fl->count(), "Incorrect number of blocks");
|
||||
{
|
||||
// Update the stats for this block size.
|
||||
MutexLockerEx x(_indexedFreeListParLocks[word_sz],
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(_indexedFreeListParLocks[word_sz],
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
const ssize_t births = _indexedFreeList[word_sz].split_births() + n;
|
||||
_indexedFreeList[word_sz].set_split_births(births);
|
||||
// ssize_t new_surplus = _indexedFreeList[word_sz].surplus() + n;
|
||||
|
@ -172,7 +172,7 @@ class CMSTokenSyncWithLocks: public CMSTokenSync {
|
||||
private:
|
||||
// Note: locks are acquired in textual declaration order
|
||||
// and released in the opposite order
|
||||
MutexLockerEx _locker1, _locker2, _locker3;
|
||||
MutexLocker _locker1, _locker2, _locker3;
|
||||
public:
|
||||
CMSTokenSyncWithLocks(bool is_cms_thread, Mutex* mutex1,
|
||||
Mutex* mutex2 = NULL, Mutex* mutex3 = NULL):
|
||||
@ -509,7 +509,7 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
|
||||
|
||||
// Allocate MUT and marking bit map
|
||||
{
|
||||
MutexLockerEx x(_markBitMap.lock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(_markBitMap.lock(), Mutex::_no_safepoint_check_flag);
|
||||
if (!_markBitMap.allocate(_span)) {
|
||||
log_warning(gc)("Failed to allocate CMS Bit Map");
|
||||
return;
|
||||
@ -797,7 +797,7 @@ Mutex* ConcurrentMarkSweepGeneration::freelistLock() const {
|
||||
|
||||
HeapWord* ConcurrentMarkSweepGeneration::allocate(size_t size, bool tlab) {
|
||||
CMSSynchronousYieldRequest yr;
|
||||
MutexLockerEx x(freelistLock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(freelistLock(), Mutex::_no_safepoint_check_flag);
|
||||
return have_lock_and_allocate(size, tlab);
|
||||
}
|
||||
|
||||
@ -844,8 +844,8 @@ HeapWord* ConcurrentMarkSweepGeneration::have_lock_and_allocate(size_t size,
|
||||
void CMSCollector::direct_allocated(HeapWord* start, size_t size) {
|
||||
assert(_markBitMap.covers(start, size), "Out of bounds");
|
||||
if (_collectorState >= Marking) {
|
||||
MutexLockerEx y(_markBitMap.lock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker y(_markBitMap.lock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
// [see comments preceding SweepClosure::do_blk() below for details]
|
||||
//
|
||||
// Can the P-bits be deleted now? JJJ
|
||||
@ -1302,7 +1302,7 @@ void CMSCollector::request_full_gc(unsigned int full_gc_count, GCCause::Cause ca
|
||||
CMSHeap* heap = CMSHeap::heap();
|
||||
unsigned int gc_count = heap->total_full_collections();
|
||||
if (gc_count == full_gc_count) {
|
||||
MutexLockerEx y(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker y(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
_full_gc_requested = true;
|
||||
_full_gc_cause = cause;
|
||||
CGC_lock->notify(); // nudge CMS thread
|
||||
@ -1423,7 +1423,7 @@ void CMSCollector::acquire_control_and_collect(bool full,
|
||||
bitMapLock()->unlock();
|
||||
releaseFreelistLocks();
|
||||
{
|
||||
MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
if (_foregroundGCShouldWait) {
|
||||
// We are going to be waiting for action for the CMS thread;
|
||||
// it had better not be gone (for instance at shutdown)!
|
||||
@ -1440,7 +1440,7 @@ void CMSCollector::acquire_control_and_collect(bool full,
|
||||
"Possible deadlock");
|
||||
while (_foregroundGCShouldWait) {
|
||||
// wait for notification
|
||||
CGC_lock->wait(Mutex::_no_safepoint_check_flag);
|
||||
CGC_lock->wait_without_safepoint_check();
|
||||
// Possibility of delay/starvation here, since CMS token does
|
||||
// not know to give priority to VM thread? Actually, i think
|
||||
// there wouldn't be any delay/starvation, but the proof of
|
||||
@ -1685,7 +1685,7 @@ class ReleaseForegroundGC: public StackObj {
|
||||
public:
|
||||
ReleaseForegroundGC(CMSCollector* c) : _c(c) {
|
||||
assert(_c->_foregroundGCShouldWait, "Else should not need to call");
|
||||
MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
// allow a potentially blocked foreground collector to proceed
|
||||
_c->_foregroundGCShouldWait = false;
|
||||
if (_c->_foregroundGCIsActive) {
|
||||
@ -1697,7 +1697,7 @@ class ReleaseForegroundGC: public StackObj {
|
||||
|
||||
~ReleaseForegroundGC() {
|
||||
assert(!_c->_foregroundGCShouldWait, "Usage protocol violation?");
|
||||
MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
_c->_foregroundGCShouldWait = true;
|
||||
}
|
||||
};
|
||||
@ -1708,10 +1708,9 @@ void CMSCollector::collect_in_background(GCCause::Cause cause) {
|
||||
|
||||
CMSHeap* heap = CMSHeap::heap();
|
||||
{
|
||||
bool safepoint_check = Mutex::_no_safepoint_check_flag;
|
||||
MutexLockerEx hl(Heap_lock, safepoint_check);
|
||||
MutexLocker hl(Heap_lock, Mutex::_no_safepoint_check_flag);
|
||||
FreelistLocker fll(this);
|
||||
MutexLockerEx x(CGC_lock, safepoint_check);
|
||||
MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
if (_foregroundGCIsActive) {
|
||||
// The foreground collector is. Skip this
|
||||
// background collection.
|
||||
@ -1855,7 +1854,7 @@ void CMSCollector::collect_in_background(GCCause::Cause cause) {
|
||||
// collection was preempted.
|
||||
{
|
||||
ReleaseForegroundGC x(this); // unblock FG collection
|
||||
MutexLockerEx y(Heap_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker y(Heap_lock, Mutex::_no_safepoint_check_flag);
|
||||
CMSTokenSync z(true); // not strictly needed.
|
||||
if (_collectorState == Resizing) {
|
||||
compute_new_size();
|
||||
@ -1898,7 +1897,7 @@ void CMSCollector::collect_in_background(GCCause::Cause cause) {
|
||||
// Clear _foregroundGCShouldWait and, in the event that the
|
||||
// foreground collector is waiting, notify it, before
|
||||
// returning.
|
||||
MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
_foregroundGCShouldWait = false;
|
||||
if (_foregroundGCIsActive) {
|
||||
CGC_lock->notify();
|
||||
@ -1946,7 +1945,7 @@ bool CMSCollector::waitForForegroundGC() {
|
||||
// Block the foreground collector until the
|
||||
// background collectors decides whether to
|
||||
// yield.
|
||||
MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
_foregroundGCShouldWait = true;
|
||||
if (_foregroundGCIsActive) {
|
||||
// The background collector yields to the
|
||||
@ -1964,7 +1963,7 @@ bool CMSCollector::waitForForegroundGC() {
|
||||
log_debug(gc, state)("CMS Thread " INTPTR_FORMAT " waiting at CMS state %d",
|
||||
p2i(Thread::current()), _collectorState);
|
||||
while (_foregroundGCIsActive) {
|
||||
CGC_lock->wait(Mutex::_no_safepoint_check_flag);
|
||||
CGC_lock->wait_without_safepoint_check();
|
||||
}
|
||||
ConcurrentMarkSweepThread::set_CMS_flag(
|
||||
ConcurrentMarkSweepThread::CMS_cms_has_token);
|
||||
@ -2206,7 +2205,7 @@ bool CMSCollector::is_cms_reachable(HeapWord* addr) {
|
||||
_markBitMap.isMarked(addr) ? "" : " not");
|
||||
|
||||
if (verify_after_remark()) {
|
||||
MutexLockerEx x(verification_mark_bm()->lock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(verification_mark_bm()->lock(), Mutex::_no_safepoint_check_flag);
|
||||
bool result = verification_mark_bm()->isMarked(addr);
|
||||
tty->print_cr("TransitiveMark: Address " PTR_FORMAT " %s marked", p2i(addr),
|
||||
result ? "IS" : "is NOT");
|
||||
@ -2266,7 +2265,7 @@ class VerifyMarkedClosure: public BitMapClosure {
|
||||
|
||||
bool CMSCollector::verify_after_remark() {
|
||||
GCTraceTime(Info, gc, phases, verify) tm("Verifying CMS Marking.");
|
||||
MutexLockerEx ml(verification_mark_bm()->lock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(verification_mark_bm()->lock(), Mutex::_no_safepoint_check_flag);
|
||||
static bool init = false;
|
||||
|
||||
assert(SafepointSynchronize::is_at_safepoint(),
|
||||
@ -2467,7 +2466,7 @@ ConcurrentMarkSweepGeneration::oop_iterate(OopIterateClosure* cl) {
|
||||
if (freelistLock()->owned_by_self()) {
|
||||
Generation::oop_iterate(cl);
|
||||
} else {
|
||||
MutexLockerEx x(freelistLock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(freelistLock(), Mutex::_no_safepoint_check_flag);
|
||||
Generation::oop_iterate(cl);
|
||||
}
|
||||
}
|
||||
@ -2477,7 +2476,7 @@ ConcurrentMarkSweepGeneration::object_iterate(ObjectClosure* cl) {
|
||||
if (freelistLock()->owned_by_self()) {
|
||||
Generation::object_iterate(cl);
|
||||
} else {
|
||||
MutexLockerEx x(freelistLock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(freelistLock(), Mutex::_no_safepoint_check_flag);
|
||||
Generation::object_iterate(cl);
|
||||
}
|
||||
}
|
||||
@ -2487,7 +2486,7 @@ ConcurrentMarkSweepGeneration::safe_object_iterate(ObjectClosure* cl) {
|
||||
if (freelistLock()->owned_by_self()) {
|
||||
Generation::safe_object_iterate(cl);
|
||||
} else {
|
||||
MutexLockerEx x(freelistLock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(freelistLock(), Mutex::_no_safepoint_check_flag);
|
||||
Generation::safe_object_iterate(cl);
|
||||
}
|
||||
}
|
||||
@ -2506,7 +2505,7 @@ ConcurrentMarkSweepGeneration::prepare_for_verify() {
|
||||
if (freelistLock()->owned_by_self()) {
|
||||
cmsSpace()->prepare_for_verify();
|
||||
} else {
|
||||
MutexLockerEx fll(freelistLock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker fll(freelistLock(), Mutex::_no_safepoint_check_flag);
|
||||
cmsSpace()->prepare_for_verify();
|
||||
}
|
||||
}
|
||||
@ -2519,7 +2518,7 @@ ConcurrentMarkSweepGeneration::verify() {
|
||||
if (freelistLock()->owned_by_self()) {
|
||||
cmsSpace()->verify();
|
||||
} else {
|
||||
MutexLockerEx fll(freelistLock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker fll(freelistLock(), Mutex::_no_safepoint_check_flag);
|
||||
cmsSpace()->verify();
|
||||
}
|
||||
}
|
||||
@ -2629,7 +2628,7 @@ ConcurrentMarkSweepGeneration::expand_and_allocate(size_t word_size,
|
||||
bool parallel) {
|
||||
CMSSynchronousYieldRequest yr;
|
||||
assert(!tlab, "Can't deal with TLAB allocation");
|
||||
MutexLockerEx x(freelistLock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(freelistLock(), Mutex::_no_safepoint_check_flag);
|
||||
expand_for_gc_cause(word_size*HeapWordSize, MinHeapDeltaBytes, CMSExpansionCause::_satisfy_allocation);
|
||||
if (GCExpandToAllocateDelayMillis > 0) {
|
||||
os::sleep(Thread::current(), GCExpandToAllocateDelayMillis, false);
|
||||
@ -2804,8 +2803,8 @@ void CMSCollector::checkpointRootsInitial() {
|
||||
assert(_restart_addr == NULL, "Control point invariant");
|
||||
{
|
||||
// acquire locks for subsequent manipulations
|
||||
MutexLockerEx x(bitMapLock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(bitMapLock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
checkpointRootsInitialWork();
|
||||
// enable ("weak") refs discovery
|
||||
rp->enable_discovery();
|
||||
@ -3246,8 +3245,8 @@ bool CMSConcMarkingTask::get_work_from_overflow_stack(CMSMarkStack* ovflw_stk,
|
||||
return false;
|
||||
}
|
||||
assert(work_q->size() == 0, "Shouldn't steal");
|
||||
MutexLockerEx ml(ovflw_stk->par_lock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(ovflw_stk->par_lock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
// Grab up to 1/4 the size of the work queue
|
||||
size_t num = MIN2((size_t)(work_q->max_elems() - work_q->size())/4,
|
||||
(size_t)ParGCDesiredObjsFromOverflowList);
|
||||
@ -3451,8 +3450,8 @@ void ParConcMarkingClosure::trim_queue(size_t max) {
|
||||
void ParConcMarkingClosure::handle_stack_overflow(HeapWord* lost) {
|
||||
// We need to do this under a mutex to prevent other
|
||||
// workers from interfering with the work done below.
|
||||
MutexLockerEx ml(_overflow_stack->par_lock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(_overflow_stack->par_lock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
// Remember the least grey address discarded
|
||||
HeapWord* ra = (HeapWord*)_overflow_stack->least_value(lost);
|
||||
_collector->lower_restart_addr(ra);
|
||||
@ -4169,8 +4168,8 @@ void CMSCollector::checkpointRootsFinal() {
|
||||
);
|
||||
}
|
||||
FreelistLocker x(this);
|
||||
MutexLockerEx y(bitMapLock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker y(bitMapLock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
checkpointRootsFinalWork();
|
||||
}
|
||||
verify_work_stacks_empty();
|
||||
@ -6725,8 +6724,8 @@ void PushOrMarkClosure::handle_stack_overflow(HeapWord* lost) {
|
||||
void ParPushOrMarkClosure::handle_stack_overflow(HeapWord* lost) {
|
||||
// We need to do this under a mutex to prevent other
|
||||
// workers from interfering with the work done below.
|
||||
MutexLockerEx ml(_overflow_stack->par_lock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(_overflow_stack->par_lock(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
// Remember the least grey address discarded
|
||||
HeapWord* ra = (HeapWord*)_overflow_stack->least_value(lost);
|
||||
_collector->lower_restart_addr(ra);
|
||||
@ -7992,7 +7991,7 @@ void CMSCollector::preserve_mark_if_necessary(oop p) {
|
||||
void CMSCollector::par_preserve_mark_if_necessary(oop p) {
|
||||
markOop m = p->mark_raw();
|
||||
if (m->must_be_preserved(p)) {
|
||||
MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
|
||||
// Even though we read the mark word without holding
|
||||
// the lock, we are assured that it will not change
|
||||
// because we "own" this oop, so no other thread can
|
||||
|
@ -225,13 +225,13 @@ class CMSMarkStack: public CHeapObj<mtGC> {
|
||||
// "Parallel versions" of some of the above
|
||||
oop par_pop() {
|
||||
// lock and pop
|
||||
MutexLockerEx x(&_par_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(&_par_lock, Mutex::_no_safepoint_check_flag);
|
||||
return pop();
|
||||
}
|
||||
|
||||
bool par_push(oop ptr) {
|
||||
// lock and push
|
||||
MutexLockerEx x(&_par_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(&_par_lock, Mutex::_no_safepoint_check_flag);
|
||||
return push(ptr);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2019, 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
|
||||
@ -112,7 +112,7 @@ void ConcurrentMarkSweepThread::stop_service() {
|
||||
// Now post a notify on CGC_lock so as to nudge
|
||||
// CMS thread(s) that might be slumbering in
|
||||
// sleepBeforeNextCycle.
|
||||
MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
CGC_lock->notify_all();
|
||||
}
|
||||
|
||||
@ -147,15 +147,14 @@ void ConcurrentMarkSweepThread::print_all_on(outputStream* st) {
|
||||
void ConcurrentMarkSweepThread::synchronize(bool is_cms_thread) {
|
||||
assert(UseConcMarkSweepGC, "just checking");
|
||||
|
||||
MutexLockerEx x(CGC_lock,
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
if (!is_cms_thread) {
|
||||
assert(Thread::current()->is_VM_thread(), "Not a VM thread");
|
||||
CMSSynchronousYieldRequest yr;
|
||||
while (CMS_flag_is_set(CMS_cms_has_token)) {
|
||||
// indicate that we want to get the token
|
||||
set_CMS_flag(CMS_vm_wants_token);
|
||||
CGC_lock->wait(true);
|
||||
CGC_lock->wait_without_safepoint_check();
|
||||
}
|
||||
// claim the token and proceed
|
||||
clear_CMS_flag(CMS_vm_wants_token);
|
||||
@ -167,7 +166,7 @@ void ConcurrentMarkSweepThread::synchronize(bool is_cms_thread) {
|
||||
// This will need to be modified is there are more CMS threads than one.
|
||||
while (CMS_flag_is_set(CMS_vm_has_token | CMS_vm_wants_token)) {
|
||||
set_CMS_flag(CMS_cms_wants_token);
|
||||
CGC_lock->wait(true);
|
||||
CGC_lock->wait_without_safepoint_check();
|
||||
}
|
||||
// claim the token
|
||||
clear_CMS_flag(CMS_cms_wants_token);
|
||||
@ -178,8 +177,7 @@ void ConcurrentMarkSweepThread::synchronize(bool is_cms_thread) {
|
||||
void ConcurrentMarkSweepThread::desynchronize(bool is_cms_thread) {
|
||||
assert(UseConcMarkSweepGC, "just checking");
|
||||
|
||||
MutexLockerEx x(CGC_lock,
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
if (!is_cms_thread) {
|
||||
assert(Thread::current()->is_VM_thread(), "Not a VM thread");
|
||||
assert(CMS_flag_is_set(CMS_vm_has_token), "just checking");
|
||||
@ -206,13 +204,12 @@ void ConcurrentMarkSweepThread::desynchronize(bool is_cms_thread) {
|
||||
|
||||
// Wait until any cms_lock event
|
||||
void ConcurrentMarkSweepThread::wait_on_cms_lock(long t_millis) {
|
||||
MutexLockerEx x(CGC_lock,
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
if (should_terminate() || _collector->_full_gc_requested) {
|
||||
return;
|
||||
}
|
||||
set_CMS_flag(CMS_cms_wants_token); // to provoke notifies
|
||||
CGC_lock->wait(Mutex::_no_safepoint_check_flag, t_millis);
|
||||
CGC_lock->wait_without_safepoint_check(t_millis);
|
||||
clear_CMS_flag(CMS_cms_wants_token);
|
||||
assert(!CMS_flag_is_set(CMS_cms_has_token | CMS_cms_wants_token),
|
||||
"Should not be set");
|
||||
@ -231,7 +228,7 @@ void ConcurrentMarkSweepThread::wait_on_cms_lock_for_scavenge(long t_millis) {
|
||||
// Total collections count before waiting loop
|
||||
unsigned int before_count;
|
||||
{
|
||||
MutexLockerEx hl(Heap_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker hl(Heap_lock, Mutex::_no_safepoint_check_flag);
|
||||
before_count = heap->total_collections();
|
||||
}
|
||||
|
||||
@ -255,14 +252,14 @@ void ConcurrentMarkSweepThread::wait_on_cms_lock_for_scavenge(long t_millis) {
|
||||
|
||||
// Wait until the next event or the remaining timeout
|
||||
{
|
||||
MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
if (should_terminate() || _collector->_full_gc_requested) {
|
||||
return;
|
||||
}
|
||||
set_CMS_flag(CMS_cms_wants_token); // to provoke notifies
|
||||
assert(t_millis == 0 || wait_time_millis > 0, "Sanity");
|
||||
CGC_lock->wait(Mutex::_no_safepoint_check_flag, wait_time_millis);
|
||||
CGC_lock->wait_without_safepoint_check(wait_time_millis);
|
||||
clear_CMS_flag(CMS_cms_wants_token);
|
||||
assert(!CMS_flag_is_set(CMS_cms_has_token | CMS_cms_wants_token),
|
||||
"Should not be set");
|
||||
@ -277,7 +274,7 @@ void ConcurrentMarkSweepThread::wait_on_cms_lock_for_scavenge(long t_millis) {
|
||||
// Total collections count after the event
|
||||
unsigned int after_count;
|
||||
{
|
||||
MutexLockerEx hl(Heap_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker hl(Heap_lock, Mutex::_no_safepoint_check_flag);
|
||||
after_count = heap->total_collections();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2019, 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
|
||||
@ -137,7 +137,7 @@ NOTE: we can always create a new gang per each iteration
|
||||
*/
|
||||
/////////////////////
|
||||
void YieldingFlexibleWorkGang::start_task(YieldingFlexibleGangTask* new_task) {
|
||||
MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
assert(task() == NULL, "Gang currently tied to a task");
|
||||
assert(new_task != NULL, "Null task");
|
||||
// Bind task to gang
|
||||
@ -175,7 +175,7 @@ void YieldingFlexibleWorkGang::wait_for_gang() {
|
||||
assert(started_workers() <= active_workers(), "invariant");
|
||||
assert(finished_workers() <= active_workers(), "invariant");
|
||||
assert(yielded_workers() <= active_workers(), "invariant");
|
||||
monitor()->wait(Mutex::_no_safepoint_check_flag);
|
||||
monitor()->wait_without_safepoint_check();
|
||||
}
|
||||
switch (yielding_task()->status()) {
|
||||
case COMPLETED:
|
||||
@ -204,7 +204,7 @@ void YieldingFlexibleWorkGang::wait_for_gang() {
|
||||
void YieldingFlexibleWorkGang::continue_task(
|
||||
YieldingFlexibleGangTask* gang_task) {
|
||||
|
||||
MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
assert(task() != NULL && task() == gang_task, "Incorrect usage");
|
||||
assert(_started_workers == _active_workers, "Precondition");
|
||||
assert(_yielded_workers > 0 && yielding_task()->status() == YIELDED,
|
||||
@ -224,7 +224,7 @@ void YieldingFlexibleWorkGang::reset() {
|
||||
|
||||
void YieldingFlexibleWorkGang::yield() {
|
||||
assert(task() != NULL, "Inconsistency; should have task binding");
|
||||
MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
assert(yielded_workers() < active_workers(), "Consistency check");
|
||||
if (yielding_task()->status() == ABORTING) {
|
||||
// Do not yield; we need to abort as soon as possible
|
||||
@ -247,7 +247,7 @@ void YieldingFlexibleWorkGang::yield() {
|
||||
switch (yielding_task()->status()) {
|
||||
case YIELDING:
|
||||
case YIELDED: {
|
||||
monitor()->wait(Mutex::_no_safepoint_check_flag);
|
||||
monitor()->wait_without_safepoint_check();
|
||||
break; // from switch
|
||||
}
|
||||
case ACTIVE:
|
||||
@ -271,7 +271,7 @@ void YieldingFlexibleWorkGang::yield() {
|
||||
|
||||
void YieldingFlexibleWorkGang::abort() {
|
||||
assert(task() != NULL, "Inconsistency; should have task binding");
|
||||
MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
assert(yielded_workers() < active_workers(), "Consistency check");
|
||||
#ifndef PRODUCT
|
||||
switch (yielding_task()->status()) {
|
||||
@ -319,7 +319,7 @@ void YieldingFlexibleGangTask::abort() {
|
||||
void YieldingFlexibleGangWorker::loop() {
|
||||
int previous_sequence_number = 0;
|
||||
Monitor* gang_monitor = yf_gang()->monitor();
|
||||
MutexLockerEx ml(gang_monitor, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(gang_monitor, Mutex::_no_safepoint_check_flag);
|
||||
YieldingWorkData data;
|
||||
int id;
|
||||
while (true) {
|
||||
@ -340,7 +340,7 @@ void YieldingFlexibleGangWorker::loop() {
|
||||
yf_gang()->internal_note_start();
|
||||
// Now, release the gang mutex and do the work.
|
||||
{
|
||||
MutexUnlockerEx mul(gang_monitor, Mutex::_no_safepoint_check_flag);
|
||||
MutexUnlocker mul(gang_monitor, Mutex::_no_safepoint_check_flag);
|
||||
GCIdMark gc_id_mark(data.task()->gc_id());
|
||||
data.task()->work(id); // This might include yielding
|
||||
}
|
||||
@ -394,6 +394,6 @@ void YieldingFlexibleGangWorker::loop() {
|
||||
// Remember the sequence number
|
||||
previous_sequence_number = data.sequence_number();
|
||||
// Wait for more work
|
||||
gang_monitor->wait(Mutex::_no_safepoint_check_flag);
|
||||
gang_monitor->wait_without_safepoint_check();
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ HeapWord* EpsilonHeap::allocate_work(size_t size) {
|
||||
|
||||
while (res == NULL) {
|
||||
// Allocation failed, attempt expansion, and retry:
|
||||
MutexLockerEx ml(Heap_lock);
|
||||
MutexLocker ml(Heap_lock);
|
||||
|
||||
size_t space_left = max_capacity() - capacity();
|
||||
size_t want_space = MAX2(size, EpsilonMinHeapExpand);
|
||||
|
@ -196,7 +196,7 @@ HeapWord* G1Allocator::survivor_attempt_allocation(size_t min_word_size,
|
||||
desired_word_size,
|
||||
actual_word_size);
|
||||
if (result == NULL && !survivor_is_full()) {
|
||||
MutexLockerEx x(FreeList_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(FreeList_lock, Mutex::_no_safepoint_check_flag);
|
||||
result = survivor_gc_alloc_region()->attempt_allocation_locked(min_word_size,
|
||||
desired_word_size,
|
||||
actual_word_size);
|
||||
@ -220,7 +220,7 @@ HeapWord* G1Allocator::old_attempt_allocation(size_t min_word_size,
|
||||
desired_word_size,
|
||||
actual_word_size);
|
||||
if (result == NULL && !old_is_full()) {
|
||||
MutexLockerEx x(FreeList_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(FreeList_lock, Mutex::_no_safepoint_check_flag);
|
||||
result = old_gc_alloc_region()->attempt_allocation_locked(min_word_size,
|
||||
desired_word_size,
|
||||
actual_word_size);
|
||||
|
@ -436,7 +436,7 @@ HeapWord* G1CollectedHeap::attempt_allocation_slow(size_t word_size) {
|
||||
uint gc_count_before;
|
||||
|
||||
{
|
||||
MutexLockerEx x(Heap_lock);
|
||||
MutexLocker x(Heap_lock);
|
||||
result = _allocator->attempt_allocation_locked(word_size);
|
||||
if (result != NULL) {
|
||||
return result;
|
||||
@ -575,7 +575,7 @@ bool G1CollectedHeap::alloc_archive_regions(MemRegion* ranges,
|
||||
assert(!is_init_completed(), "Expect to be called at JVM init time");
|
||||
assert(ranges != NULL, "MemRegion array NULL");
|
||||
assert(count != 0, "No MemRegions provided");
|
||||
MutexLockerEx x(Heap_lock);
|
||||
MutexLocker x(Heap_lock);
|
||||
|
||||
MemRegion reserved = _hrm->reserved();
|
||||
HeapWord* prev_last_addr = NULL;
|
||||
@ -685,7 +685,7 @@ void G1CollectedHeap::fill_archive_regions(MemRegion* ranges, size_t count) {
|
||||
// that contain the address range. The address range actually within the
|
||||
// MemRegion will not be modified. That is assumed to have been initialized
|
||||
// elsewhere, probably via an mmap of archived heap data.
|
||||
MutexLockerEx x(Heap_lock);
|
||||
MutexLocker x(Heap_lock);
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
HeapWord* start_address = ranges[i].start();
|
||||
HeapWord* last_address = ranges[i].last();
|
||||
@ -771,7 +771,7 @@ void G1CollectedHeap::dealloc_archive_regions(MemRegion* ranges, size_t count, b
|
||||
|
||||
// For each Memregion, free the G1 regions that constitute it, and
|
||||
// notify mark-sweep that the range is no longer to be considered 'archive.'
|
||||
MutexLockerEx x(Heap_lock);
|
||||
MutexLocker x(Heap_lock);
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
HeapWord* start_address = ranges[i].start();
|
||||
HeapWord* last_address = ranges[i].last();
|
||||
@ -882,7 +882,7 @@ HeapWord* G1CollectedHeap::attempt_allocation_humongous(size_t word_size) {
|
||||
|
||||
|
||||
{
|
||||
MutexLockerEx x(Heap_lock);
|
||||
MutexLocker x(Heap_lock);
|
||||
|
||||
// Given that humongous objects are not allocated in young
|
||||
// regions, we'll first try to do the allocation without doing a
|
||||
@ -2066,7 +2066,7 @@ void G1CollectedHeap::increment_old_marking_cycles_started() {
|
||||
}
|
||||
|
||||
void G1CollectedHeap::increment_old_marking_cycles_completed(bool concurrent) {
|
||||
MonitorLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
// We assume that if concurrent == true, then the caller is a
|
||||
// concurrent thread that was joined the Suspendible Thread
|
||||
@ -2604,7 +2604,7 @@ HeapWord* G1CollectedHeap::do_collection_pause(size_t word_size,
|
||||
}
|
||||
|
||||
void G1CollectedHeap::do_concurrent_mark() {
|
||||
MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
if (!_cm_thread->in_progress()) {
|
||||
_cm_thread->set_started();
|
||||
CGC_lock->notify();
|
||||
@ -3925,7 +3925,7 @@ void G1CollectedHeap::free_humongous_region(HeapRegion* hr,
|
||||
void G1CollectedHeap::remove_from_old_sets(const uint old_regions_removed,
|
||||
const uint humongous_regions_removed) {
|
||||
if (old_regions_removed > 0 || humongous_regions_removed > 0) {
|
||||
MutexLockerEx x(OldSets_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(OldSets_lock, Mutex::_no_safepoint_check_flag);
|
||||
_old_set.bulk_remove(old_regions_removed);
|
||||
_humongous_set.bulk_remove(humongous_regions_removed);
|
||||
}
|
||||
@ -3935,7 +3935,7 @@ void G1CollectedHeap::remove_from_old_sets(const uint old_regions_removed,
|
||||
void G1CollectedHeap::prepend_to_freelist(FreeRegionList* list) {
|
||||
assert(list != NULL, "list can't be null");
|
||||
if (!list->is_empty()) {
|
||||
MutexLockerEx x(FreeList_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(FreeList_lock, Mutex::_no_safepoint_check_flag);
|
||||
_hrm->insert_list_into_free_list(list);
|
||||
}
|
||||
}
|
||||
@ -4073,7 +4073,7 @@ private:
|
||||
|
||||
void do_serial_work() {
|
||||
// Need to grab the lock to be allowed to modify the old region list.
|
||||
MutexLockerEx x(OldSets_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(OldSets_lock, Mutex::_no_safepoint_check_flag);
|
||||
_collection_set->iterate(&_cl);
|
||||
}
|
||||
|
||||
|
@ -166,13 +166,13 @@ void G1CMMarkStack::add_chunk_to_list(TaskQueueEntryChunk* volatile* list, TaskQ
|
||||
}
|
||||
|
||||
void G1CMMarkStack::add_chunk_to_chunk_list(TaskQueueEntryChunk* elem) {
|
||||
MutexLockerEx x(MarkStackChunkList_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(MarkStackChunkList_lock, Mutex::_no_safepoint_check_flag);
|
||||
add_chunk_to_list(&_chunk_list, elem);
|
||||
_chunks_in_chunk_list++;
|
||||
}
|
||||
|
||||
void G1CMMarkStack::add_chunk_to_free_list(TaskQueueEntryChunk* elem) {
|
||||
MutexLockerEx x(MarkStackFreeList_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(MarkStackFreeList_lock, Mutex::_no_safepoint_check_flag);
|
||||
add_chunk_to_list(&_free_list, elem);
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ G1CMMarkStack::TaskQueueEntryChunk* G1CMMarkStack::remove_chunk_from_list(TaskQu
|
||||
}
|
||||
|
||||
G1CMMarkStack::TaskQueueEntryChunk* G1CMMarkStack::remove_chunk_from_chunk_list() {
|
||||
MutexLockerEx x(MarkStackChunkList_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(MarkStackChunkList_lock, Mutex::_no_safepoint_check_flag);
|
||||
TaskQueueEntryChunk* result = remove_chunk_from_list(&_chunk_list);
|
||||
if (result != NULL) {
|
||||
_chunks_in_chunk_list--;
|
||||
@ -194,7 +194,7 @@ G1CMMarkStack::TaskQueueEntryChunk* G1CMMarkStack::remove_chunk_from_chunk_list(
|
||||
}
|
||||
|
||||
G1CMMarkStack::TaskQueueEntryChunk* G1CMMarkStack::remove_chunk_from_free_list() {
|
||||
MutexLockerEx x(MarkStackFreeList_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(MarkStackFreeList_lock, Mutex::_no_safepoint_check_flag);
|
||||
return remove_chunk_from_list(&_free_list);
|
||||
}
|
||||
|
||||
@ -311,7 +311,7 @@ uint G1CMRootRegions::num_root_regions() const {
|
||||
}
|
||||
|
||||
void G1CMRootRegions::notify_scan_done() {
|
||||
MutexLockerEx x(RootRegionScan_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(RootRegionScan_lock, Mutex::_no_safepoint_check_flag);
|
||||
_scan_in_progress = false;
|
||||
RootRegionScan_lock->notify_all();
|
||||
}
|
||||
@ -338,9 +338,9 @@ bool G1CMRootRegions::wait_until_scan_finished() {
|
||||
}
|
||||
|
||||
{
|
||||
MutexLockerEx x(RootRegionScan_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(RootRegionScan_lock, Mutex::_no_safepoint_check_flag);
|
||||
while (scan_in_progress()) {
|
||||
RootRegionScan_lock->wait(Mutex::_no_safepoint_check_flag);
|
||||
RootRegionScan_lock->wait_without_safepoint_check();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -1288,7 +1288,7 @@ public:
|
||||
// Now update the old/humongous region sets
|
||||
_g1h->remove_from_old_sets(cl.old_regions_removed(), cl.humongous_regions_removed());
|
||||
{
|
||||
MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
|
||||
_g1h->decrement_summary_bytes(cl.freed_bytes());
|
||||
|
||||
_cleanup_list->add_ordered(&local_cleanup_list);
|
||||
|
@ -397,7 +397,7 @@ void G1ConcurrentMarkThread::run_service() {
|
||||
}
|
||||
|
||||
void G1ConcurrentMarkThread::stop_service() {
|
||||
MutexLockerEx ml(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
CGC_lock->notify_all();
|
||||
}
|
||||
|
||||
@ -407,9 +407,9 @@ void G1ConcurrentMarkThread::sleep_before_next_cycle() {
|
||||
// below while the world is otherwise stopped.
|
||||
assert(!in_progress(), "should have been cleared");
|
||||
|
||||
MutexLockerEx x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(CGC_lock, Mutex::_no_safepoint_check_flag);
|
||||
while (!started() && !should_terminate()) {
|
||||
CGC_lock->wait(Mutex::_no_safepoint_check_flag);
|
||||
CGC_lock->wait_without_safepoint_check();
|
||||
}
|
||||
|
||||
if (started()) {
|
||||
|
@ -59,9 +59,9 @@ G1ConcurrentRefineThread::G1ConcurrentRefineThread(G1ConcurrentRefine* cr, uint
|
||||
}
|
||||
|
||||
void G1ConcurrentRefineThread::wait_for_completed_buffers() {
|
||||
MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(_monitor, Mutex::_no_safepoint_check_flag);
|
||||
while (!should_terminate() && !is_active()) {
|
||||
_monitor->wait(Mutex::_no_safepoint_check_flag);
|
||||
_monitor->wait_without_safepoint_check();
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ bool G1ConcurrentRefineThread::is_active() {
|
||||
}
|
||||
|
||||
void G1ConcurrentRefineThread::activate() {
|
||||
MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(_monitor, Mutex::_no_safepoint_check_flag);
|
||||
if (!is_primary()) {
|
||||
set_active(true);
|
||||
} else {
|
||||
@ -82,7 +82,7 @@ void G1ConcurrentRefineThread::activate() {
|
||||
}
|
||||
|
||||
void G1ConcurrentRefineThread::deactivate() {
|
||||
MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(_monitor, Mutex::_no_safepoint_check_flag);
|
||||
if (!is_primary()) {
|
||||
set_active(false);
|
||||
} else {
|
||||
@ -140,6 +140,6 @@ void G1ConcurrentRefineThread::run_service() {
|
||||
}
|
||||
|
||||
void G1ConcurrentRefineThread::stop_service() {
|
||||
MutexLockerEx x(_monitor, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(_monitor, Mutex::_no_safepoint_check_flag);
|
||||
_monitor->notify();
|
||||
}
|
||||
|
@ -62,8 +62,7 @@ template <class T> void G1VerifyOopClosure::do_oop_work(T* p) {
|
||||
oop obj = CompressedOops::decode_not_null(heap_oop);
|
||||
bool failed = false;
|
||||
if (!_g1h->is_in(obj) || _g1h->is_obj_dead_cond(obj, _verify_option)) {
|
||||
MutexLockerEx x(ParGCRareEvent_lock,
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
|
||||
LogStreamHandle(Error, gc, verify) yy;
|
||||
if (!_failures) {
|
||||
yy.cr();
|
||||
|
@ -203,7 +203,7 @@ void G1MonitoringSupport::initialize_serviceability() {
|
||||
}
|
||||
|
||||
MemoryUsage G1MonitoringSupport::memory_usage() {
|
||||
MutexLockerEx x(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
|
||||
return MemoryUsage(InitialHeapSize, _overall_used, _overall_committed, _g1h->max_capacity());
|
||||
}
|
||||
|
||||
@ -225,7 +225,7 @@ GrowableArray<MemoryPool*> G1MonitoringSupport::memory_pools() {
|
||||
void G1MonitoringSupport::recalculate_sizes() {
|
||||
assert_heap_locked_or_at_safepoint(true);
|
||||
|
||||
MutexLockerEx x(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
|
||||
// Recalculate all the sizes from scratch.
|
||||
|
||||
// This never includes used bytes of current allocating heap region.
|
||||
@ -317,7 +317,7 @@ void G1MonitoringSupport::update_eden_size() {
|
||||
}
|
||||
|
||||
MemoryUsage G1MonitoringSupport::eden_space_memory_usage(size_t initial_size, size_t max_size) {
|
||||
MutexLockerEx x(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
return MemoryUsage(initial_size,
|
||||
_eden_space_used,
|
||||
@ -326,7 +326,7 @@ MemoryUsage G1MonitoringSupport::eden_space_memory_usage(size_t initial_size, si
|
||||
}
|
||||
|
||||
MemoryUsage G1MonitoringSupport::survivor_space_memory_usage(size_t initial_size, size_t max_size) {
|
||||
MutexLockerEx x(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
return MemoryUsage(initial_size,
|
||||
_survivor_space_used,
|
||||
@ -335,7 +335,7 @@ MemoryUsage G1MonitoringSupport::survivor_space_memory_usage(size_t initial_size
|
||||
}
|
||||
|
||||
MemoryUsage G1MonitoringSupport::old_gen_memory_usage(size_t initial_size, size_t max_size) {
|
||||
MutexLockerEx x(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(MonitoringSupport_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
return MemoryUsage(initial_size,
|
||||
_old_gen_used,
|
||||
|
@ -50,7 +50,7 @@ void G1RootProcessor::worker_has_discovered_all_strong_classes() {
|
||||
uint new_value = (uint)Atomic::add(1, &_n_workers_discovered_strong_classes);
|
||||
if (new_value == n_workers()) {
|
||||
// This thread is last. Notify the others.
|
||||
MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(&_lock, Mutex::_no_safepoint_check_flag);
|
||||
_lock.notify_all();
|
||||
}
|
||||
}
|
||||
@ -59,9 +59,9 @@ void G1RootProcessor::wait_until_all_strong_classes_discovered() {
|
||||
assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
|
||||
|
||||
if ((uint)_n_workers_discovered_strong_classes != n_workers()) {
|
||||
MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(&_lock, Mutex::_no_safepoint_check_flag);
|
||||
while ((uint)_n_workers_discovered_strong_classes != n_workers()) {
|
||||
_lock.wait(Mutex::_no_safepoint_check_flag, 0, false);
|
||||
_lock.wait_without_safepoint_check(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ G1SharedDirtyCardQueue::~G1SharedDirtyCardQueue() {
|
||||
}
|
||||
|
||||
void G1SharedDirtyCardQueue::enqueue(void* card_ptr) {
|
||||
MutexLockerEx ml(Shared_DirtyCardQ_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(Shared_DirtyCardQ_lock, Mutex::_no_safepoint_check_flag);
|
||||
if (_index == 0) {
|
||||
flush();
|
||||
_buffer = _qset->allocate_buffer();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2019, 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
|
||||
@ -54,14 +54,14 @@ G1StringDedupQueue::~G1StringDedupQueue() {
|
||||
}
|
||||
|
||||
void G1StringDedupQueue::wait_impl() {
|
||||
MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
|
||||
while (_empty && !_cancel) {
|
||||
ml.wait(Mutex::_no_safepoint_check_flag);
|
||||
ml.wait();
|
||||
}
|
||||
}
|
||||
|
||||
void G1StringDedupQueue::cancel_wait_impl() {
|
||||
MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
|
||||
_cancel = true;
|
||||
ml.notify();
|
||||
}
|
||||
@ -75,7 +75,7 @@ void G1StringDedupQueue::push_impl(uint worker_id, oop java_string) {
|
||||
if (!worker_queue.is_full()) {
|
||||
worker_queue.push(java_string);
|
||||
if (_empty) {
|
||||
MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
|
||||
if (_empty) {
|
||||
// Mark non-empty and notify waiter
|
||||
_empty = false;
|
||||
|
@ -191,10 +191,10 @@ void VM_G1CollectForAllocation::doit_epilogue() {
|
||||
JavaThread* jt = (JavaThread*)thr;
|
||||
ThreadToNativeFromVM native(jt);
|
||||
|
||||
MutexLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
|
||||
while (g1h->old_marking_cycles_completed() <=
|
||||
_old_marking_cycles_completed_before) {
|
||||
FullGCCount_lock->wait(Mutex::_no_safepoint_check_flag);
|
||||
FullGCCount_lock->wait_without_safepoint_check();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,10 +47,10 @@ G1YoungRemSetSamplingThread::G1YoungRemSetSamplingThread() :
|
||||
}
|
||||
|
||||
void G1YoungRemSetSamplingThread::sleep_before_next_cycle() {
|
||||
MutexLockerEx x(&_monitor, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(&_monitor, Mutex::_no_safepoint_check_flag);
|
||||
if (!should_terminate()) {
|
||||
uintx waitms = G1ConcRefinementServiceIntervalMillis;
|
||||
_monitor.wait(Mutex::_no_safepoint_check_flag, waitms);
|
||||
_monitor.wait_without_safepoint_check(waitms);
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ void G1YoungRemSetSamplingThread::run_service() {
|
||||
}
|
||||
|
||||
void G1YoungRemSetSamplingThread::stop_service() {
|
||||
MutexLockerEx x(&_monitor, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(&_monitor, Mutex::_no_safepoint_check_flag);
|
||||
_monitor.notify();
|
||||
}
|
||||
|
||||
|
@ -516,7 +516,7 @@ public:
|
||||
oop obj = CompressedOops::decode_not_null(heap_oop);
|
||||
bool failed = false;
|
||||
if (!_g1h->is_in(obj) || _g1h->is_obj_dead_cond(obj, _vo)) {
|
||||
MutexLockerEx x(ParGCRareEvent_lock,
|
||||
MutexLocker x(ParGCRareEvent_lock,
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
|
||||
if (!_failures) {
|
||||
@ -588,7 +588,7 @@ public:
|
||||
cv_field == dirty :
|
||||
cv_obj == dirty || cv_field == dirty));
|
||||
if (is_bad) {
|
||||
MutexLockerEx x(ParGCRareEvent_lock,
|
||||
MutexLocker x(ParGCRareEvent_lock,
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
|
||||
if (!_failures) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2019, 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
|
||||
@ -361,7 +361,7 @@ void OtherRegionsTable::add_reference(OopOrNarrowOopStar from, uint tid) {
|
||||
size_t ind = from_hrm_ind & _mod_max_fine_entries_mask;
|
||||
PerRegionTable* prt = find_region_table(ind, from_hr);
|
||||
if (prt == NULL) {
|
||||
MutexLockerEx x(_m, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(_m, Mutex::_no_safepoint_check_flag);
|
||||
// Confirm that it's really not there...
|
||||
prt = find_region_table(ind, from_hr);
|
||||
if (prt == NULL) {
|
||||
@ -577,7 +577,7 @@ void OtherRegionsTable::clear() {
|
||||
|
||||
bool OtherRegionsTable::contains_reference(OopOrNarrowOopStar from) const {
|
||||
// Cast away const in this case.
|
||||
MutexLockerEx x((Mutex*)_m, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x((Mutex*)_m, Mutex::_no_safepoint_check_flag);
|
||||
return contains_reference_locked(from);
|
||||
}
|
||||
|
||||
@ -628,7 +628,7 @@ void HeapRegionRemSet::setup_remset_size() {
|
||||
}
|
||||
|
||||
void HeapRegionRemSet::clear(bool only_cardset) {
|
||||
MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(&_m, Mutex::_no_safepoint_check_flag);
|
||||
clear_locked(only_cardset);
|
||||
}
|
||||
|
||||
@ -658,7 +658,7 @@ void HeapRegionRemSet::add_strong_code_root(nmethod* nm) {
|
||||
BOOL_TO_STR(CodeCache_lock->owned_by_self()), BOOL_TO_STR(SafepointSynchronize::is_at_safepoint()));
|
||||
// Optimistic unlocked contains-check
|
||||
if (!_code_roots.contains(nm)) {
|
||||
MutexLockerEx ml(&_m, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(&_m, Mutex::_no_safepoint_check_flag);
|
||||
add_strong_code_root_locked(nm);
|
||||
}
|
||||
}
|
||||
@ -678,7 +678,7 @@ void HeapRegionRemSet::remove_strong_code_root(nmethod* nm) {
|
||||
assert(nm != NULL, "sanity");
|
||||
assert_locked_or_safepoint(CodeCache_lock);
|
||||
|
||||
MutexLockerEx ml(CodeCache_lock->owned_by_self() ? NULL : &_m, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(CodeCache_lock->owned_by_self() ? NULL : &_m, Mutex::_no_safepoint_check_flag);
|
||||
_code_roots.remove(nm);
|
||||
|
||||
// Check that there were no duplicates
|
||||
|
@ -194,7 +194,7 @@ public:
|
||||
}
|
||||
|
||||
size_t occupied() {
|
||||
MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(&_m, Mutex::_no_safepoint_check_flag);
|
||||
return occupied_locked();
|
||||
}
|
||||
size_t occupied_locked() {
|
||||
@ -274,7 +274,7 @@ public:
|
||||
// The actual # of bytes this hr_remset takes up.
|
||||
// Note also includes the strong code root set.
|
||||
size_t mem_size() {
|
||||
MutexLockerEx x(&_m, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(&_m, Mutex::_no_safepoint_check_flag);
|
||||
return _other_regions.mem_size()
|
||||
// This correction is necessary because the above includes the second
|
||||
// part.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2019, 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
|
||||
@ -524,7 +524,7 @@ void GCTaskManager::task_idle_workers() {
|
||||
// and get the count for additional IdleGCTask's under
|
||||
// the GCTaskManager's monitor so that the "more_inactive_workers"
|
||||
// count is correct.
|
||||
MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
_wait_helper.set_should_wait(true);
|
||||
// active_workers are a number being requested. idle_workers
|
||||
// are the number currently idle. If all the workers are being
|
||||
@ -563,7 +563,7 @@ void GCTaskManager::task_idle_workers() {
|
||||
|
||||
void GCTaskManager::release_idle_workers() {
|
||||
{
|
||||
MutexLockerEx ml(monitor(),
|
||||
MutexLocker ml(monitor(),
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
_wait_helper.set_should_wait(false);
|
||||
monitor()->notify_all();
|
||||
@ -613,7 +613,7 @@ void GCTaskManager::set_thread(uint which, GCTaskThread* value) {
|
||||
|
||||
void GCTaskManager::add_task(GCTask* task) {
|
||||
assert(task != NULL, "shouldn't have null task");
|
||||
MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
if (TraceGCTaskManager) {
|
||||
tty->print_cr("GCTaskManager::add_task(" INTPTR_FORMAT " [%s])",
|
||||
p2i(task), GCTask::Kind::to_string(task->kind()));
|
||||
@ -630,7 +630,7 @@ void GCTaskManager::add_task(GCTask* task) {
|
||||
|
||||
void GCTaskManager::add_list(GCTaskQueue* list) {
|
||||
assert(list != NULL, "shouldn't have null task");
|
||||
MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
if (TraceGCTaskManager) {
|
||||
tty->print_cr("GCTaskManager::add_list(%u)", list->length());
|
||||
}
|
||||
@ -654,7 +654,7 @@ void GCTaskManager::add_list(GCTaskQueue* list) {
|
||||
GCTask* GCTaskManager::get_task(uint which) {
|
||||
GCTask* result = NULL;
|
||||
// Grab the queue lock.
|
||||
MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
// Wait while the queue is block or
|
||||
// there is nothing to do, except maybe release resources.
|
||||
while (is_blocked() ||
|
||||
@ -671,7 +671,7 @@ GCTask* GCTaskManager::get_task(uint which) {
|
||||
tty->print_cr(" => (%s)->wait()",
|
||||
monitor()->name());
|
||||
}
|
||||
monitor()->wait(Mutex::_no_safepoint_check_flag, 0);
|
||||
monitor()->wait_without_safepoint_check(0);
|
||||
}
|
||||
// We've reacquired the queue lock here.
|
||||
// Figure out which condition caused us to exit the loop above.
|
||||
@ -707,7 +707,7 @@ GCTask* GCTaskManager::get_task(uint which) {
|
||||
}
|
||||
|
||||
void GCTaskManager::note_completion(uint which) {
|
||||
MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
if (TraceGCTaskManager) {
|
||||
tty->print_cr("GCTaskManager::note_completion(%u)", which);
|
||||
}
|
||||
@ -872,7 +872,7 @@ void IdleGCTask::do_it(GCTaskManager* manager, uint which) {
|
||||
log_trace(gc, task)("[" INTPTR_FORMAT "] IdleGCTask:::do_it() should_wait: %s",
|
||||
p2i(this), wait_helper->should_wait() ? "true" : "false");
|
||||
|
||||
MutexLockerEx ml(manager->monitor(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(manager->monitor(), Mutex::_no_safepoint_check_flag);
|
||||
log_trace(gc, task)("--- idle %d", which);
|
||||
// Increment has to be done when the idle tasks are created.
|
||||
// manager->increment_idle_workers();
|
||||
@ -880,7 +880,7 @@ void IdleGCTask::do_it(GCTaskManager* manager, uint which) {
|
||||
while (wait_helper->should_wait()) {
|
||||
log_trace(gc, task)("[" INTPTR_FORMAT "] IdleGCTask::do_it() [" INTPTR_FORMAT "] (%s)->wait()",
|
||||
p2i(this), p2i(manager->monitor()), manager->monitor()->name());
|
||||
manager->monitor()->wait(Mutex::_no_safepoint_check_flag, 0);
|
||||
manager->monitor()->wait_without_safepoint_check(0);
|
||||
}
|
||||
manager->decrement_idle_workers();
|
||||
|
||||
@ -943,7 +943,7 @@ void WaitForBarrierGCTask::do_it_internal(GCTaskManager* manager, uint which) {
|
||||
tty->print_cr("WaitForBarrierGCTask::do_it(%u) waiting on %u workers",
|
||||
which, manager->busy_workers());
|
||||
}
|
||||
manager->monitor()->wait(Mutex::_no_safepoint_check_flag, 0);
|
||||
manager->monitor()->wait_without_safepoint_check(0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -955,7 +955,7 @@ void WaitForBarrierGCTask::do_it(GCTaskManager* manager, uint which) {
|
||||
}
|
||||
{
|
||||
// First, wait for the barrier to arrive.
|
||||
MutexLockerEx ml(manager->lock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(manager->lock(), Mutex::_no_safepoint_check_flag);
|
||||
do_it_internal(manager, which);
|
||||
// Release manager->lock().
|
||||
}
|
||||
@ -991,7 +991,7 @@ void WaitHelper::wait_for(bool reset) {
|
||||
}
|
||||
{
|
||||
// Grab the lock and check again.
|
||||
MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
while (should_wait()) {
|
||||
if (TraceGCTaskManager) {
|
||||
tty->print_cr("[" INTPTR_FORMAT "]"
|
||||
@ -999,7 +999,7 @@ void WaitHelper::wait_for(bool reset) {
|
||||
" [" INTPTR_FORMAT "] (%s)->wait()",
|
||||
p2i(this), p2i(monitor()), monitor()->name());
|
||||
}
|
||||
monitor()->wait(Mutex::_no_safepoint_check_flag, 0);
|
||||
monitor()->wait_without_safepoint_check(0);
|
||||
}
|
||||
// Reset the flag in case someone reuses this task.
|
||||
if (reset) {
|
||||
@ -1016,7 +1016,7 @@ void WaitHelper::wait_for(bool reset) {
|
||||
}
|
||||
|
||||
void WaitHelper::notify() {
|
||||
MutexLockerEx ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
set_should_wait(false);
|
||||
// Waiter doesn't miss the notify in the wait_for method
|
||||
// since it checks the flag after grabbing the monitor.
|
||||
@ -1041,7 +1041,7 @@ Monitor* MonitorSupply::reserve() {
|
||||
Mutex::_allow_vm_block_flag); // allow_vm_block
|
||||
}
|
||||
{
|
||||
MutexLockerEx ml(lock());
|
||||
MutexLocker ml(lock());
|
||||
// Lazy initialization.
|
||||
if (freelist() == NULL) {
|
||||
_freelist =
|
||||
@ -1067,7 +1067,7 @@ void MonitorSupply::release(Monitor* instance) {
|
||||
assert(instance != NULL, "shouldn't release NULL");
|
||||
assert(!instance->is_locked(), "shouldn't be locked");
|
||||
{
|
||||
MutexLockerEx ml(lock());
|
||||
MutexLocker ml(lock());
|
||||
freelist()->push(instance);
|
||||
// release lock().
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ void GCHeapLog::log_heap(CollectedHeap* heap, bool before) {
|
||||
}
|
||||
|
||||
double timestamp = fetch_timestamp();
|
||||
MutexLockerEx ml(&_mutex, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(&_mutex, Mutex::_no_safepoint_check_flag);
|
||||
int index = compute_log_index();
|
||||
_records[index].thread = NULL; // Its the GC thread so it's not that interesting.
|
||||
_records[index].timestamp = timestamp;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2019, 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
|
||||
@ -50,7 +50,7 @@ ConcurrentGCPhaseManager::ConcurrentGCPhaseManager(int phase, Stack* stack) :
|
||||
assert_ConcurrentGC_thread();
|
||||
assert_not_enter_unconstrained(phase);
|
||||
assert(stack != NULL, "precondition");
|
||||
MonitorLockerEx ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
|
||||
if (stack->_top != NULL) {
|
||||
assert(stack->_top->_active, "precondition");
|
||||
_prev = stack->_top;
|
||||
@ -61,7 +61,7 @@ ConcurrentGCPhaseManager::ConcurrentGCPhaseManager(int phase, Stack* stack) :
|
||||
|
||||
ConcurrentGCPhaseManager::~ConcurrentGCPhaseManager() {
|
||||
assert_ConcurrentGC_thread();
|
||||
MonitorLockerEx ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
|
||||
assert_manager_is_tos(this, _stack, "This");
|
||||
wait_when_requested_impl();
|
||||
_stack->_top = _prev;
|
||||
@ -70,7 +70,7 @@ ConcurrentGCPhaseManager::~ConcurrentGCPhaseManager() {
|
||||
|
||||
bool ConcurrentGCPhaseManager::is_requested() const {
|
||||
assert_ConcurrentGC_thread();
|
||||
MonitorLockerEx ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
|
||||
assert_manager_is_tos(this, _stack, "This");
|
||||
return _active && (_stack->_requested_phase == _phase);
|
||||
}
|
||||
@ -81,14 +81,14 @@ bool ConcurrentGCPhaseManager::wait_when_requested_impl() const {
|
||||
bool waited = false;
|
||||
while (_active && (_stack->_requested_phase == _phase)) {
|
||||
waited = true;
|
||||
CGCPhaseManager_lock->wait(Mutex::_no_safepoint_check_flag);
|
||||
CGCPhaseManager_lock->wait_without_safepoint_check();
|
||||
}
|
||||
return waited;
|
||||
}
|
||||
|
||||
bool ConcurrentGCPhaseManager::wait_when_requested() const {
|
||||
assert_ConcurrentGC_thread();
|
||||
MonitorLockerEx ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
|
||||
assert_manager_is_tos(this, _stack, "This");
|
||||
return wait_when_requested_impl();
|
||||
}
|
||||
@ -96,7 +96,7 @@ bool ConcurrentGCPhaseManager::wait_when_requested() const {
|
||||
void ConcurrentGCPhaseManager::set_phase(int phase, bool force) {
|
||||
assert_ConcurrentGC_thread();
|
||||
assert_not_enter_unconstrained(phase);
|
||||
MonitorLockerEx ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
|
||||
assert_manager_is_tos(this, _stack, "This");
|
||||
if (!force) wait_when_requested_impl();
|
||||
_phase = phase;
|
||||
@ -105,7 +105,7 @@ void ConcurrentGCPhaseManager::set_phase(int phase, bool force) {
|
||||
|
||||
void ConcurrentGCPhaseManager::deactivate() {
|
||||
assert_ConcurrentGC_thread();
|
||||
MonitorLockerEx ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(CGCPhaseManager_lock, Mutex::_no_safepoint_check_flag);
|
||||
assert_manager_is_tos(this, _stack, "This");
|
||||
_active = false;
|
||||
ml.notify_all();
|
||||
@ -114,7 +114,7 @@ void ConcurrentGCPhaseManager::deactivate() {
|
||||
bool ConcurrentGCPhaseManager::wait_for_phase(int phase, Stack* stack) {
|
||||
assert(Thread::current()->is_Java_thread(), "precondition");
|
||||
assert(stack != NULL, "precondition");
|
||||
MonitorLockerEx ml(CGCPhaseManager_lock);
|
||||
MonitorLocker ml(CGCPhaseManager_lock);
|
||||
// Update request and notify service of change.
|
||||
if (stack->_requested_phase != phase) {
|
||||
stack->_requested_phase = phase;
|
||||
|
@ -50,7 +50,7 @@ void ConcurrentGCThread::run() {
|
||||
run_service();
|
||||
|
||||
// Signal thread has terminated
|
||||
MonitorLockerEx ml(Terminator_lock);
|
||||
MonitorLocker ml(Terminator_lock);
|
||||
OrderAccess::release_store(&_has_terminated, true);
|
||||
ml.notify_all();
|
||||
}
|
||||
@ -65,7 +65,7 @@ void ConcurrentGCThread::stop() {
|
||||
stop_service();
|
||||
|
||||
// Wait for thread to terminate
|
||||
MonitorLockerEx ml(Terminator_lock);
|
||||
MonitorLocker ml(Terminator_lock);
|
||||
while (!_has_terminated) {
|
||||
ml.wait();
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ size_t GenCollectedHeap::max_capacity() const {
|
||||
// Update the _full_collections_completed counter
|
||||
// at the end of a stop-world full GC.
|
||||
unsigned int GenCollectedHeap::update_full_collections_completed() {
|
||||
MonitorLockerEx ml(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
|
||||
assert(_full_collections_completed <= _total_full_collections,
|
||||
"Can't complete more collections than were started");
|
||||
_full_collections_completed = _total_full_collections;
|
||||
@ -247,7 +247,7 @@ unsigned int GenCollectedHeap::update_full_collections_completed() {
|
||||
// without synchronizing in any manner with the VM thread (which
|
||||
// may already have initiated a STW full collection "concurrently").
|
||||
unsigned int GenCollectedHeap::update_full_collections_completed(unsigned int count) {
|
||||
MonitorLockerEx ml(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
|
||||
assert((_full_collections_completed <= _total_full_collections) &&
|
||||
(count <= _total_full_collections),
|
||||
"Can't complete more collections than were started");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2019, 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
|
||||
@ -412,7 +412,7 @@ OopStorage::Block::block_for_ptr(const OopStorage* owner, const oop* ptr) {
|
||||
// is empty, for ease of empty block deletion processing.
|
||||
|
||||
oop* OopStorage::allocate() {
|
||||
MutexLockerEx ml(_allocation_mutex, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(_allocation_mutex, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
// Note: Without this we might never perform cleanup. As it is,
|
||||
// cleanup is only requested here, when completing a concurrent
|
||||
@ -447,7 +447,7 @@ bool OopStorage::try_add_block() {
|
||||
assert_lock_strong(_allocation_mutex);
|
||||
Block* block;
|
||||
{
|
||||
MutexUnlockerEx ul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
|
||||
MutexUnlocker ul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
|
||||
block = Block::new_block(this);
|
||||
}
|
||||
if (block == NULL) return false;
|
||||
@ -481,14 +481,14 @@ OopStorage::Block* OopStorage::block_for_allocation() {
|
||||
if (block != NULL) {
|
||||
return block;
|
||||
} else if (reduce_deferred_updates()) {
|
||||
MutexUnlockerEx ul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
|
||||
MutexUnlocker ul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
|
||||
notify_needs_cleanup();
|
||||
} else if (try_add_block()) {
|
||||
block = _allocation_list.head();
|
||||
assert(block != NULL, "invariant");
|
||||
return block;
|
||||
} else if (reduce_deferred_updates()) { // Once more before failure.
|
||||
MutexUnlockerEx ul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
|
||||
MutexUnlocker ul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
|
||||
notify_needs_cleanup();
|
||||
} else {
|
||||
// Attempt to add a block failed, no other thread added a block,
|
||||
@ -812,13 +812,13 @@ void OopStorage::notify_needs_cleanup() {
|
||||
// Avoid re-notification if already notified.
|
||||
const uint notified = needs_cleanup_notified;
|
||||
if (Atomic::xchg(notified, &_needs_cleanup) != notified) {
|
||||
MonitorLockerEx ml(Service_lock, Monitor::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(Service_lock, Monitor::_no_safepoint_check_flag);
|
||||
ml.notify_all();
|
||||
}
|
||||
}
|
||||
|
||||
bool OopStorage::delete_empty_blocks() {
|
||||
MutexLockerEx ml(_allocation_mutex, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(_allocation_mutex, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
// Clear the request before processing.
|
||||
Atomic::store(needs_cleanup_none, &_needs_cleanup);
|
||||
@ -837,7 +837,7 @@ bool OopStorage::delete_empty_blocks() {
|
||||
// might become available while we're working.
|
||||
if (reduce_deferred_updates()) {
|
||||
// Be safepoint-polite while looping.
|
||||
MutexUnlockerEx ul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
|
||||
MutexUnlocker ul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
|
||||
ThreadBlockInVM tbiv(JavaThread::current());
|
||||
} else {
|
||||
Block* block = _allocation_list.tail();
|
||||
@ -850,7 +850,7 @@ bool OopStorage::delete_empty_blocks() {
|
||||
|
||||
// Try to delete the block. First, try to remove from _active_array.
|
||||
{
|
||||
MutexLockerEx aml(_active_mutex, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker aml(_active_mutex, Mutex::_no_safepoint_check_flag);
|
||||
// Don't interfere with an active concurrent iteration.
|
||||
// Instead, give up immediately. There is more work to do,
|
||||
// but don't re-notify, to avoid useless spinning of the
|
||||
@ -861,7 +861,7 @@ bool OopStorage::delete_empty_blocks() {
|
||||
// Remove block from _allocation_list and delete it.
|
||||
_allocation_list.unlink(*block);
|
||||
// Be safepoint-polite while deleting and looping.
|
||||
MutexUnlockerEx ul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
|
||||
MutexUnlocker ul(_allocation_mutex, Mutex::_no_safepoint_check_flag);
|
||||
delete_empty_block(*block);
|
||||
ThreadBlockInVM tbiv(JavaThread::current());
|
||||
}
|
||||
@ -878,7 +878,7 @@ OopStorage::EntryStatus OopStorage::allocation_status(const oop* ptr) const {
|
||||
const Block* block = find_block_or_null(ptr);
|
||||
if (block != NULL) {
|
||||
// Prevent block deletion and _active_array modification.
|
||||
MutexLockerEx ml(_allocation_mutex, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(_allocation_mutex, Mutex::_no_safepoint_check_flag);
|
||||
// Block could be a false positive, so get index carefully.
|
||||
size_t index = Block::active_index_safe(block);
|
||||
if ((index < _active_array->block_count()) &&
|
||||
@ -953,7 +953,7 @@ OopStorage::BasicParState::~BasicParState() {
|
||||
|
||||
void OopStorage::BasicParState::update_concurrent_iteration_count(int value) {
|
||||
if (_concurrent) {
|
||||
MutexLockerEx ml(_storage->_active_mutex, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(_storage->_active_mutex, Mutex::_no_safepoint_check_flag);
|
||||
_storage->_concurrent_iteration_count += value;
|
||||
assert(_storage->_concurrent_iteration_count >= 0, "invariant");
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ bool OWSTTaskTerminator::offer_termination(TerminatorTerminator* terminator) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_blocker->wait(true, WorkStealingSleepMillis);
|
||||
_blocker->wait_without_safepoint_check(WorkStealingSleepMillis);
|
||||
|
||||
if (_offered_termination == _n_threads) {
|
||||
_blocker->unlock();
|
||||
@ -151,9 +151,9 @@ bool OWSTTaskTerminator::do_spin_master_work(TerminatorTerminator* terminator) {
|
||||
p2i(Thread::current()), yield_count);
|
||||
yield_count = 0;
|
||||
|
||||
MonitorLockerEx locker(_blocker, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker locker(_blocker, Mutex::_no_safepoint_check_flag);
|
||||
_spin_master = NULL;
|
||||
locker.wait(Mutex::_no_safepoint_check_flag, WorkStealingSleepMillis);
|
||||
locker.wait(WorkStealingSleepMillis);
|
||||
if (_spin_master == NULL) {
|
||||
_spin_master = Thread::current();
|
||||
} else {
|
||||
@ -167,7 +167,7 @@ bool OWSTTaskTerminator::do_spin_master_work(TerminatorTerminator* terminator) {
|
||||
size_t tasks = tasks_in_queue_set();
|
||||
bool exit = exit_termination(tasks, terminator);
|
||||
{
|
||||
MonitorLockerEx locker(_blocker, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker locker(_blocker, Mutex::_no_safepoint_check_flag);
|
||||
// Termination condition reached
|
||||
if (_offered_termination == _n_threads) {
|
||||
_spin_master = NULL;
|
||||
|
@ -305,7 +305,7 @@ bool PtrQueueSet::process_or_enqueue_completed_buffer(BufferNode* node) {
|
||||
}
|
||||
|
||||
void PtrQueueSet::enqueue_completed_buffer(BufferNode* cbn) {
|
||||
MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(_cbl_mon, Mutex::_no_safepoint_check_flag);
|
||||
cbn->set_next(NULL);
|
||||
if (_completed_buffers_tail == NULL) {
|
||||
assert(_completed_buffers_head == NULL, "Well-formedness");
|
||||
@ -328,7 +328,7 @@ void PtrQueueSet::enqueue_completed_buffer(BufferNode* cbn) {
|
||||
}
|
||||
|
||||
BufferNode* PtrQueueSet::get_completed_buffer(size_t stop_at) {
|
||||
MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(_cbl_mon, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
if (_n_completed_buffers <= stop_at) {
|
||||
return NULL;
|
||||
@ -354,7 +354,7 @@ BufferNode* PtrQueueSet::get_completed_buffer(size_t stop_at) {
|
||||
void PtrQueueSet::abandon_completed_buffers() {
|
||||
BufferNode* buffers_to_delete = NULL;
|
||||
{
|
||||
MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(_cbl_mon, Mutex::_no_safepoint_check_flag);
|
||||
buffers_to_delete = _completed_buffers_head;
|
||||
_completed_buffers_head = NULL;
|
||||
_completed_buffers_tail = NULL;
|
||||
@ -389,7 +389,7 @@ void PtrQueueSet::assert_completed_buffers_list_len_correct_locked() {
|
||||
// must share the monitor.
|
||||
void PtrQueueSet::merge_bufferlists(PtrQueueSet *src) {
|
||||
assert(_cbl_mon == src->_cbl_mon, "Should share the same lock");
|
||||
MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(_cbl_mon, Mutex::_no_safepoint_check_flag);
|
||||
if (_completed_buffers_tail == NULL) {
|
||||
assert(_completed_buffers_head == NULL, "Well-formedness");
|
||||
_completed_buffers_head = src->_completed_buffers_head;
|
||||
@ -415,7 +415,7 @@ void PtrQueueSet::merge_bufferlists(PtrQueueSet *src) {
|
||||
}
|
||||
|
||||
void PtrQueueSet::notify_if_necessary() {
|
||||
MutexLockerEx x(_cbl_mon, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(_cbl_mon, Mutex::_no_safepoint_check_flag);
|
||||
if (_n_completed_buffers > _process_completed_buffers_threshold) {
|
||||
_process_completed_buffers = true;
|
||||
if (_notify_when_complete)
|
||||
|
@ -172,7 +172,7 @@ void SATBMarkQueueSet::set_active_all_threads(bool active, bool expected_active)
|
||||
#endif // ASSERT
|
||||
// Update the global state, synchronized with threads list management.
|
||||
{
|
||||
MutexLockerEx ml(NonJavaThreadsList_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(NonJavaThreadsList_lock, Mutex::_no_safepoint_check_flag);
|
||||
_all_active = active;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2019, 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
|
||||
@ -477,7 +477,7 @@ void StringDedupTable::unlink_or_oops_do(StringDedupUnlinkOrOopsDoClosure* cl, u
|
||||
|
||||
// Delayed update to avoid contention on the table lock
|
||||
if (removed > 0) {
|
||||
MutexLockerEx ml(StringDedupTable_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(StringDedupTable_lock, Mutex::_no_safepoint_check_flag);
|
||||
_table->_entries -= removed;
|
||||
_entries_removed += removed;
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ private:
|
||||
// Protect the table from concurrent access. Also note that this lock
|
||||
// acts as a fence for _table, which could have been replaced by a new
|
||||
// instance if the table was resized or rehashed.
|
||||
MutexLockerEx ml(StringDedupTable_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(StringDedupTable_lock, Mutex::_no_safepoint_check_flag);
|
||||
return _table->lookup_or_add_inner(value, latin1, hash);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 2019, 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
|
||||
@ -48,9 +48,9 @@ bool SuspendibleThreadSet::is_synchronized() {
|
||||
|
||||
void SuspendibleThreadSet::join() {
|
||||
assert(!Thread::current()->is_suspendible_thread(), "Thread already joined");
|
||||
MonitorLockerEx ml(STS_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(STS_lock, Mutex::_no_safepoint_check_flag);
|
||||
while (_suspend_all) {
|
||||
ml.wait(Mutex::_no_safepoint_check_flag);
|
||||
ml.wait();
|
||||
}
|
||||
_nthreads++;
|
||||
DEBUG_ONLY(Thread::current()->set_suspendible_thread();)
|
||||
@ -58,7 +58,7 @@ void SuspendibleThreadSet::join() {
|
||||
|
||||
void SuspendibleThreadSet::leave() {
|
||||
assert(Thread::current()->is_suspendible_thread(), "Thread not joined");
|
||||
MonitorLockerEx ml(STS_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(STS_lock, Mutex::_no_safepoint_check_flag);
|
||||
assert(_nthreads > 0, "Invalid");
|
||||
DEBUG_ONLY(Thread::current()->clear_suspendible_thread();)
|
||||
_nthreads--;
|
||||
@ -70,7 +70,7 @@ void SuspendibleThreadSet::leave() {
|
||||
|
||||
void SuspendibleThreadSet::yield() {
|
||||
assert(Thread::current()->is_suspendible_thread(), "Must have joined");
|
||||
MonitorLockerEx ml(STS_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(STS_lock, Mutex::_no_safepoint_check_flag);
|
||||
if (_suspend_all) {
|
||||
_nthreads_stopped++;
|
||||
if (is_synchronized()) {
|
||||
@ -82,7 +82,7 @@ void SuspendibleThreadSet::yield() {
|
||||
_synchronize_wakeup->signal();
|
||||
}
|
||||
while (_suspend_all) {
|
||||
ml.wait(Mutex::_no_safepoint_check_flag);
|
||||
ml.wait();
|
||||
}
|
||||
assert(_nthreads_stopped > 0, "Invalid");
|
||||
_nthreads_stopped--;
|
||||
@ -95,7 +95,7 @@ void SuspendibleThreadSet::synchronize() {
|
||||
_suspend_all_start = os::elapsedTime();
|
||||
}
|
||||
{
|
||||
MonitorLockerEx ml(STS_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(STS_lock, Mutex::_no_safepoint_check_flag);
|
||||
assert(!_suspend_all, "Only one at a time");
|
||||
_suspend_all = true;
|
||||
if (is_synchronized()) {
|
||||
@ -118,7 +118,7 @@ void SuspendibleThreadSet::synchronize() {
|
||||
_synchronize_wakeup->wait();
|
||||
|
||||
#ifdef ASSERT
|
||||
MonitorLockerEx ml(STS_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(STS_lock, Mutex::_no_safepoint_check_flag);
|
||||
assert(_suspend_all, "STS not synchronizing");
|
||||
assert(is_synchronized(), "STS not synchronized");
|
||||
#endif
|
||||
@ -126,7 +126,7 @@ void SuspendibleThreadSet::synchronize() {
|
||||
|
||||
void SuspendibleThreadSet::desynchronize() {
|
||||
assert(Thread::current()->is_VM_thread(), "Must be the VM thread");
|
||||
MonitorLockerEx ml(STS_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(STS_lock, Mutex::_no_safepoint_check_flag);
|
||||
assert(_suspend_all, "STS not synchronizing");
|
||||
assert(is_synchronized(), "STS not synchronized");
|
||||
_suspend_all = false;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2019, 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
|
||||
@ -200,7 +200,7 @@ class MutexGangTaskDispatcher : public GangTaskDispatcher {
|
||||
}
|
||||
|
||||
void coordinator_execute_on_workers(AbstractGangTask* task, uint num_workers) {
|
||||
MutexLockerEx ml(_monitor, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(_monitor, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
_task = task;
|
||||
_num_workers = num_workers;
|
||||
@ -210,7 +210,7 @@ class MutexGangTaskDispatcher : public GangTaskDispatcher {
|
||||
|
||||
// Wait for them to finish.
|
||||
while (_finished < _num_workers) {
|
||||
_monitor->wait(/* no_safepoint_check */ true);
|
||||
_monitor->wait_without_safepoint_check();
|
||||
}
|
||||
|
||||
_task = NULL;
|
||||
@ -220,10 +220,10 @@ class MutexGangTaskDispatcher : public GangTaskDispatcher {
|
||||
}
|
||||
|
||||
WorkData worker_wait_for_task() {
|
||||
MonitorLockerEx ml(_monitor, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(_monitor, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
while (_num_workers == 0 || _started == _num_workers) {
|
||||
_monitor->wait(/* no_safepoint_check */ true);
|
||||
_monitor->wait();
|
||||
}
|
||||
|
||||
_started++;
|
||||
@ -235,7 +235,7 @@ class MutexGangTaskDispatcher : public GangTaskDispatcher {
|
||||
}
|
||||
|
||||
void worker_done_with_task() {
|
||||
MonitorLockerEx ml(_monitor, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(_monitor, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
_finished++;
|
||||
|
||||
@ -300,8 +300,6 @@ void AbstractGangWorker::initialize() {
|
||||
assert(_gang != NULL, "No gang to run in");
|
||||
os::set_priority(this, NearMaxPriority);
|
||||
log_develop_trace(gc, workgang)("Running gang worker for gang %s id %u", gang()->name(), id());
|
||||
// The VM thread should not execute here because MutexLocker's are used
|
||||
// as (opposed to MutexLockerEx's).
|
||||
assert(!Thread::current()->is_VM_thread(), "VM thread should not be part"
|
||||
" of a work gang");
|
||||
}
|
||||
@ -369,7 +367,7 @@ void WorkGangBarrierSync::set_n_workers(uint n_workers) {
|
||||
}
|
||||
|
||||
bool WorkGangBarrierSync::enter() {
|
||||
MutexLockerEx x(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
if (should_reset()) {
|
||||
// The should_reset() was set and we are the first worker to enter
|
||||
// the sync barrier. We will zero the n_completed() count which
|
||||
@ -392,14 +390,14 @@ bool WorkGangBarrierSync::enter() {
|
||||
monitor()->notify_all();
|
||||
} else {
|
||||
while (n_completed() != n_workers() && !aborted()) {
|
||||
monitor()->wait(/* no_safepoint_check */ true);
|
||||
monitor()->wait_without_safepoint_check();
|
||||
}
|
||||
}
|
||||
return !aborted();
|
||||
}
|
||||
|
||||
void WorkGangBarrierSync::abort() {
|
||||
MutexLockerEx x(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker x(monitor(), Mutex::_no_safepoint_check_flag);
|
||||
set_aborted();
|
||||
monitor()->notify_all();
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ void ShenandoahConcurrentMark::concurrent_scan_code_roots(uint worker_id, Refere
|
||||
if (ShenandoahConcurrentScanCodeRoots && claim_codecache()) {
|
||||
ShenandoahObjToScanQueue* q = task_queues()->queue(worker_id);
|
||||
if (!_heap->unload_classes()) {
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
// TODO: We can not honor StringDeduplication here, due to lock ranking
|
||||
// inversion. So, we may miss some deduplication candidates.
|
||||
if (_heap->has_forwarded_objects()) {
|
||||
|
@ -508,7 +508,7 @@ void ShenandoahControlThread::request_gc(GCCause::Cause cause) {
|
||||
void ShenandoahControlThread::handle_requested_gc(GCCause::Cause cause) {
|
||||
_requested_gc_cause = cause;
|
||||
_gc_requested.set();
|
||||
MonitorLockerEx ml(&_gc_waiters_lock);
|
||||
MonitorLocker ml(&_gc_waiters_lock);
|
||||
while (_gc_requested.is_set()) {
|
||||
ml.wait();
|
||||
}
|
||||
@ -528,7 +528,7 @@ void ShenandoahControlThread::handle_alloc_failure(size_t words) {
|
||||
heap->cancel_gc(GCCause::_allocation_failure);
|
||||
}
|
||||
|
||||
MonitorLockerEx ml(&_alloc_failure_waiters_lock);
|
||||
MonitorLocker ml(&_alloc_failure_waiters_lock);
|
||||
while (is_alloc_failure_gc()) {
|
||||
ml.wait();
|
||||
}
|
||||
@ -549,7 +549,7 @@ void ShenandoahControlThread::handle_alloc_failure_evac(size_t words) {
|
||||
|
||||
void ShenandoahControlThread::notify_alloc_failure_waiters() {
|
||||
_alloc_failure_gc.unset();
|
||||
MonitorLockerEx ml(&_alloc_failure_waiters_lock);
|
||||
MonitorLocker ml(&_alloc_failure_waiters_lock);
|
||||
ml.notify_all();
|
||||
}
|
||||
|
||||
@ -563,7 +563,7 @@ bool ShenandoahControlThread::is_alloc_failure_gc() {
|
||||
|
||||
void ShenandoahControlThread::notify_gc_waiters() {
|
||||
_gc_requested.unset();
|
||||
MonitorLockerEx ml(&_gc_waiters_lock);
|
||||
MonitorLocker ml(&_gc_waiters_lock);
|
||||
ml.notify_all();
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ ShenandoahStrDedupQueue::ShenandoahStrDedupQueue() :
|
||||
}
|
||||
|
||||
ShenandoahStrDedupQueue::~ShenandoahStrDedupQueue() {
|
||||
MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
|
||||
for (size_t index = 0; index < num_queues(); index ++) {
|
||||
release_buffers(queue_at(index));
|
||||
}
|
||||
@ -58,9 +58,9 @@ ShenandoahStrDedupQueue::~ShenandoahStrDedupQueue() {
|
||||
}
|
||||
|
||||
void ShenandoahStrDedupQueue::wait_impl() {
|
||||
MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
|
||||
while (_consumer_queue == NULL && !_cancel) {
|
||||
ml.wait(Mutex::_no_safepoint_check_flag);
|
||||
ml.wait_without_safepoint_check();
|
||||
assert(_consumer_queue == NULL, "Why wait?");
|
||||
_consumer_queue = _published_queues;
|
||||
_published_queues = NULL;
|
||||
@ -68,7 +68,7 @@ void ShenandoahStrDedupQueue::wait_impl() {
|
||||
}
|
||||
|
||||
void ShenandoahStrDedupQueue::cancel_wait_impl() {
|
||||
MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
|
||||
_cancel = true;
|
||||
ml.notify();
|
||||
}
|
||||
@ -105,11 +105,11 @@ void ShenandoahStrDedupQueue::push_impl(uint worker_id, oop string_oop) {
|
||||
ShenandoahQueueBuffer* buf = queue_at((size_t)worker_id);
|
||||
|
||||
if (buf == NULL) {
|
||||
MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
|
||||
buf = new_buffer();
|
||||
set_producer_buffer(buf, worker_id);
|
||||
} else if (buf->is_full()) {
|
||||
MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
|
||||
buf->set_next(_published_queues);
|
||||
_published_queues = buf;
|
||||
buf = new_buffer();
|
||||
@ -125,7 +125,7 @@ oop ShenandoahStrDedupQueue::pop_impl() {
|
||||
assert(Thread::current() == StringDedupThread::thread(), "Must be dedup thread");
|
||||
while (true) {
|
||||
if (_consumer_queue == NULL) {
|
||||
MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
|
||||
_consumer_queue = _published_queues;
|
||||
_published_queues = NULL;
|
||||
}
|
||||
@ -163,7 +163,7 @@ bool ShenandoahStrDedupQueue::pop_candidate(oop& obj) {
|
||||
} while (obj == NULL);
|
||||
|
||||
if (to_release != NULL) {
|
||||
MonitorLockerEx ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(StringDedupQueue_lock, Mutex::_no_safepoint_check_flag);
|
||||
release_buffers(to_release);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2019, 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
|
||||
@ -79,7 +79,7 @@ inline void ZMessagePort<T>::send_sync(T message) {
|
||||
|
||||
{
|
||||
// Enqueue message
|
||||
MonitorLockerEx ml(&_monitor, Monitor::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(&_monitor, Monitor::_no_safepoint_check_flag);
|
||||
request.initialize(message, _seqnum);
|
||||
_queue.insert_last(&request);
|
||||
ml.notify();
|
||||
@ -96,13 +96,13 @@ inline void ZMessagePort<T>::send_sync(T message) {
|
||||
// thread have returned from sem_wait(). To avoid this race we are
|
||||
// forcing the waiting thread to acquire/release the lock held by the
|
||||
// posting thread. https://sourceware.org/bugzilla/show_bug.cgi?id=12674
|
||||
MonitorLockerEx ml(&_monitor, Monitor::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(&_monitor, Monitor::_no_safepoint_check_flag);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void ZMessagePort<T>::send_async(T message) {
|
||||
MonitorLockerEx ml(&_monitor, Monitor::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(&_monitor, Monitor::_no_safepoint_check_flag);
|
||||
if (!_has_message) {
|
||||
// Post message
|
||||
_message = message;
|
||||
@ -113,11 +113,11 @@ inline void ZMessagePort<T>::send_async(T message) {
|
||||
|
||||
template <typename T>
|
||||
inline T ZMessagePort<T>::receive() {
|
||||
MonitorLockerEx ml(&_monitor, Monitor::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(&_monitor, Monitor::_no_safepoint_check_flag);
|
||||
|
||||
// Wait for message
|
||||
while (!_has_message && _queue.is_empty()) {
|
||||
ml.wait(Monitor::_no_safepoint_check_flag);
|
||||
ml.wait();
|
||||
}
|
||||
|
||||
// Increment request sequence number
|
||||
@ -134,7 +134,7 @@ inline T ZMessagePort<T>::receive() {
|
||||
|
||||
template <typename T>
|
||||
inline void ZMessagePort<T>::ack() {
|
||||
MonitorLockerEx ml(&_monitor, Monitor::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(&_monitor, Monitor::_no_safepoint_check_flag);
|
||||
|
||||
if (!_has_message) {
|
||||
// Nothing to ack
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2019, 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
|
||||
@ -53,10 +53,10 @@ bool ZMetronome::wait_for_tick() {
|
||||
const uint64_t next_ms = _start_ms + (_interval_ms * _nticks);
|
||||
const int64_t timeout_ms = next_ms - now_ms;
|
||||
|
||||
MonitorLockerEx ml(&_monitor, Monitor::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(&_monitor, Monitor::_no_safepoint_check_flag);
|
||||
if (!_stopped && timeout_ms > 0) {
|
||||
// Wait
|
||||
ml.wait(Monitor::_no_safepoint_check_flag, timeout_ms);
|
||||
ml.wait(timeout_ms);
|
||||
} else {
|
||||
// Tick
|
||||
return !_stopped;
|
||||
@ -65,7 +65,7 @@ bool ZMetronome::wait_for_tick() {
|
||||
}
|
||||
|
||||
void ZMetronome::stop() {
|
||||
MonitorLockerEx ml(&_monitor, Monitor::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(&_monitor, Monitor::_no_safepoint_check_flag);
|
||||
_stopped = true;
|
||||
ml.notify();
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ void ZNMethodTable::wait_until_iteration_done() {
|
||||
assert(CodeCache_lock->owned_by_self(), "Lock must be held");
|
||||
|
||||
while (_iteration.in_progress()) {
|
||||
CodeCache_lock->wait(Monitor::_no_safepoint_check_flag);
|
||||
CodeCache_lock->wait_without_safepoint_check();
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ void ZNMethodTable::unregister_nmethod(nmethod* nm) {
|
||||
}
|
||||
|
||||
void ZNMethodTable::nmethods_do_begin() {
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
// Do not allow the table to be deleted while iterating
|
||||
_safe_delete.enable_deferred_delete();
|
||||
@ -219,7 +219,7 @@ void ZNMethodTable::nmethods_do_begin() {
|
||||
}
|
||||
|
||||
void ZNMethodTable::nmethods_do_end() {
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
// Finish iteration
|
||||
_iteration.nmethods_do_end();
|
||||
|
@ -450,7 +450,7 @@ void ZReferenceProcessor::enqueue_references() {
|
||||
|
||||
{
|
||||
// Heap_lock protects external pending list
|
||||
MonitorLockerEx ml(Heap_lock);
|
||||
MonitorLocker ml(Heap_lock);
|
||||
|
||||
// Prepend internal pending list to external pending list
|
||||
*_pending_list_tail = Universe::swap_reference_pending_list(_pending_list.get());
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2019, 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
|
||||
@ -48,13 +48,13 @@ public:
|
||||
ZThread::set_runtime_worker();
|
||||
|
||||
// Wait for all threads to start
|
||||
MonitorLockerEx ml(&_monitor, Monitor::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(&_monitor, Monitor::_no_safepoint_check_flag);
|
||||
if (++_started == _nworkers) {
|
||||
// All threads started
|
||||
ml.notify_all();
|
||||
} else {
|
||||
while (_started != _nworkers) {
|
||||
ml.wait(Monitor::_no_safepoint_check_flag);
|
||||
ml.wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2019, 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
|
||||
@ -130,7 +130,7 @@ void ZUnload::unlink() {
|
||||
bool unloading_occurred;
|
||||
|
||||
{
|
||||
MutexLockerEx ml(ClassLoaderDataGraph_lock);
|
||||
MutexLocker ml(ClassLoaderDataGraph_lock);
|
||||
unloading_occurred = SystemDictionary::do_unloading(ZStatPhase::timer());
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2019, 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
|
||||
@ -86,13 +86,13 @@ public:
|
||||
ZThread::set_worker();
|
||||
|
||||
// Wait for all threads to start
|
||||
MonitorLockerEx ml(&_monitor, Monitor::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(&_monitor, Monitor::_no_safepoint_check_flag);
|
||||
if (++_started == _nworkers) {
|
||||
// All threads started
|
||||
ml.notify_all();
|
||||
} else {
|
||||
while (_started != _nworkers) {
|
||||
ml.wait(Monitor::_no_safepoint_check_flag);
|
||||
ml.wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2019, 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
|
||||
@ -409,7 +409,7 @@ TRACE_REQUEST_FUNC(ThreadAllocationStatistics) {
|
||||
JfrTicks time_stamp = JfrTicks::now();
|
||||
{
|
||||
// Collect allocation statistics while holding threads lock
|
||||
MutexLockerEx ml(Threads_lock);
|
||||
MutexLocker ml(Threads_lock);
|
||||
for (JavaThreadIteratorWithHandle jtiwh; JavaThread *jt = jtiwh.next(); ) {
|
||||
allocated.append(jt->cooked_allocated_bytes());
|
||||
thread_ids.append(JFR_THREAD_ID(jt));
|
||||
|
@ -347,7 +347,7 @@ static void clear_transition_block(JavaThread* jt) {
|
||||
jt->clear_trace_flag();
|
||||
JfrThreadLocal* const tl = jt->jfr_thread_local();
|
||||
if (tl->is_trace_block()) {
|
||||
MutexLockerEx ml(JfrThreadSampler::transition_block(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(JfrThreadSampler::transition_block(), Mutex::_no_safepoint_check_flag);
|
||||
JfrThreadSampler::transition_block()->notify_all();
|
||||
}
|
||||
}
|
||||
@ -395,9 +395,9 @@ void JfrThreadSampler::on_javathread_suspend(JavaThread* thread) {
|
||||
JfrThreadLocal* const tl = thread->jfr_thread_local();
|
||||
tl->set_trace_block();
|
||||
{
|
||||
MutexLockerEx ml(transition_block(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(transition_block(), Mutex::_no_safepoint_check_flag);
|
||||
while (thread->is_trace_suspend()) {
|
||||
transition_block()->wait(true);
|
||||
transition_block()->wait_without_safepoint_check();
|
||||
}
|
||||
tl->clear_trace_block();
|
||||
}
|
||||
@ -516,7 +516,7 @@ void JfrThreadSampler::task_stacktrace(JfrSampleType type, JavaThread** last_thr
|
||||
elapsedTimer sample_time;
|
||||
sample_time.start();
|
||||
{
|
||||
MonitorLockerEx tlock(Threads_lock, Mutex::_allow_vm_block_flag);
|
||||
MutexLocker tlock(Threads_lock, Mutex::_no_safepoint_check_flag);
|
||||
ThreadsListHandle tlh;
|
||||
// Resolve a sample session relative start position index into the thread list array.
|
||||
// In cases where the last sampled thread is NULL or not-NULL but stale, find_index() returns -1.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2019, 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
|
||||
@ -149,8 +149,8 @@ void JfrTypeManager::write_safepoint_types(JfrCheckpointWriter& writer) {
|
||||
|
||||
void JfrTypeManager::write_type_set() {
|
||||
// can safepoint here because of Module_lock
|
||||
MutexLockerEx cld_lock(SafepointSynchronize::is_at_safepoint() ? NULL : ClassLoaderDataGraph_lock);
|
||||
MutexLockerEx lock(SafepointSynchronize::is_at_safepoint() ? NULL : Module_lock);
|
||||
MutexLocker cld_lock(SafepointSynchronize::is_at_safepoint() ? NULL : ClassLoaderDataGraph_lock);
|
||||
MutexLocker lock(SafepointSynchronize::is_at_safepoint() ? NULL : Module_lock);
|
||||
|
||||
JfrCheckpointWriter writer(true, true, Thread::current());
|
||||
TypeSet set;
|
||||
|
@ -325,7 +325,7 @@ const char* JfrEmergencyDump::build_dump_path(const char* repository_path) {
|
||||
void JfrEmergencyDump::on_vm_error(const char* repository_path) {
|
||||
assert(repository_path != NULL, "invariant");
|
||||
ResourceMark rm;
|
||||
MutexLockerEx stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
|
||||
const fio_fd emergency_fd = emergency_dump_file_descriptor();
|
||||
if (emergency_fd != invalid_fd) {
|
||||
RepositoryIterator iterator(repository_path, strlen(repository_path));
|
||||
|
@ -135,7 +135,7 @@ void JfrRepository::set_chunk_path(jstring path, JavaThread* jt) {
|
||||
ResourceMark rm(jt);
|
||||
const char* const canonical_chunk_path = JfrJavaSupport::c_str(path, jt);
|
||||
{
|
||||
MutexLockerEx stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
|
||||
if (NULL == canonical_chunk_path && !_chunkwriter->is_valid()) {
|
||||
// new output is NULL and current output is NULL
|
||||
return;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2019, 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
|
||||
@ -110,7 +110,7 @@ void JfrPostBox::asynchronous_post(int msg) {
|
||||
void JfrPostBox::synchronous_post(int msg) {
|
||||
assert(is_synchronous(msg), "invariant");
|
||||
assert(!JfrMsg_lock->owned_by_self(), "should not hold JfrMsg_lock here!");
|
||||
MutexLockerEx msg_lock(JfrMsg_lock);
|
||||
MutexLocker msg_lock(JfrMsg_lock);
|
||||
deposit(msg);
|
||||
// serial_id is used to check when what we send in has been processed.
|
||||
// _msg_read_serial is read under JfrMsg_lock protection.
|
||||
@ -168,6 +168,6 @@ void JfrPostBox::notify_waiters() {
|
||||
|
||||
// safeguard to ensure no threads are left waiting
|
||||
void JfrPostBox::notify_collection_stop() {
|
||||
MutexLockerEx msg_lock(JfrMsg_lock);
|
||||
MutexLocker msg_lock(JfrMsg_lock);
|
||||
JfrMsg_lock->notify_all();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2019, 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
|
||||
@ -110,8 +110,8 @@ class RotationLock : public StackObj {
|
||||
}
|
||||
if (_thread->is_Java_thread()) {
|
||||
// in order to allow the system to move to a safepoint
|
||||
MutexLockerEx msg_lock(JfrMsg_lock);
|
||||
JfrMsg_lock->wait(false, rotation_retry_sleep_millis);
|
||||
MutexLocker msg_lock(JfrMsg_lock);
|
||||
JfrMsg_lock->wait(rotation_retry_sleep_millis);
|
||||
}
|
||||
else {
|
||||
os::naked_short_sleep(rotation_retry_sleep_millis);
|
||||
@ -341,7 +341,7 @@ void JfrRecorderService::open_new_chunk(bool vm_error) {
|
||||
assert(!_chunkwriter.is_valid(), "invariant");
|
||||
assert(!JfrStream_lock->owned_by_self(), "invariant");
|
||||
JfrChunkRotation::on_rotation();
|
||||
MutexLockerEx stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
|
||||
if (!_repository.open_chunk(vm_error)) {
|
||||
assert(!_chunkwriter.is_valid(), "invariant");
|
||||
_storage.control().set_to_disk(false);
|
||||
@ -363,7 +363,7 @@ void JfrRecorderService::in_memory_rotation() {
|
||||
|
||||
void JfrRecorderService::serialize_storage_from_in_memory_recording() {
|
||||
assert(!JfrStream_lock->owned_by_self(), "not holding stream lock!");
|
||||
MutexLockerEx stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
|
||||
_storage.write();
|
||||
}
|
||||
|
||||
@ -422,7 +422,7 @@ static void write_stringpool_checkpoint_safepoint(JfrStringPool& string_pool, Jf
|
||||
// release stream lock
|
||||
//
|
||||
void JfrRecorderService::pre_safepoint_write() {
|
||||
MutexLockerEx stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
|
||||
assert(_chunkwriter.is_valid(), "invariant");
|
||||
_checkpoint_manager.write_types();
|
||||
_checkpoint_manager.write_epoch_transition_mspace();
|
||||
@ -457,7 +457,7 @@ static void write_object_sample_stacktrace(JfrStackTraceRepository& stack_trace_
|
||||
//
|
||||
void JfrRecorderService::safepoint_write() {
|
||||
assert(SafepointSynchronize::is_at_safepoint(), "invariant");
|
||||
MutexLockerEx stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
|
||||
write_object_sample_stacktrace(_stack_trace_repository);
|
||||
write_stacktrace_checkpoint(_stack_trace_repository, _chunkwriter, true);
|
||||
write_stringpool_checkpoint_safepoint(_string_pool, _chunkwriter);
|
||||
@ -493,7 +493,7 @@ void JfrRecorderService::post_safepoint_write() {
|
||||
// already tagged artifacts for the previous epoch. We can accomplish this concurrently
|
||||
// with threads now tagging artifacts in relation to the new, now updated, epoch and remain outside of a safepoint.
|
||||
_checkpoint_manager.write_type_set();
|
||||
MutexLockerEx stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
|
||||
// serialize any outstanding checkpoint memory
|
||||
_checkpoint_manager.write();
|
||||
// serialize the metadata descriptor event and close out the chunk
|
||||
@ -526,7 +526,7 @@ void JfrRecorderService::finalize_current_chunk_on_vm_error() {
|
||||
void JfrRecorderService::process_full_buffers() {
|
||||
if (_chunkwriter.is_valid()) {
|
||||
assert(!JfrStream_lock->owned_by_self(), "invariant");
|
||||
MutexLockerEx stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker stream_lock(JfrStream_lock, Mutex::_no_safepoint_check_flag);
|
||||
_storage.write_full();
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2019, 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
|
||||
@ -50,12 +50,12 @@ void recorderthread_entry(JavaThread* thread, Thread* unused) {
|
||||
bool done = false;
|
||||
int msgs = 0;
|
||||
JfrRecorderService service;
|
||||
MutexLockerEx msg_lock(JfrMsg_lock);
|
||||
MutexLocker msg_lock(JfrMsg_lock);
|
||||
|
||||
// JFR MESSAGE LOOP PROCESSING - BEGIN
|
||||
while (!done) {
|
||||
if (post_box.is_empty()) {
|
||||
JfrMsg_lock->wait(false);
|
||||
JfrMsg_lock->wait();
|
||||
}
|
||||
msgs = post_box.collect();
|
||||
JfrMsg_lock->unlock();
|
||||
|
@ -123,7 +123,7 @@ bool JfrStackTraceRepository::initialize() {
|
||||
}
|
||||
|
||||
size_t JfrStackTraceRepository::clear() {
|
||||
MutexLockerEx lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag);
|
||||
if (_entries == 0) {
|
||||
return 0;
|
||||
}
|
||||
@ -142,7 +142,7 @@ size_t JfrStackTraceRepository::clear() {
|
||||
}
|
||||
|
||||
traceid JfrStackTraceRepository::add_trace(const JfrStackTrace& stacktrace) {
|
||||
MutexLockerEx lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag);
|
||||
const size_t index = stacktrace._hash % TABLE_SIZE;
|
||||
const StackTrace* table_entry = _table[index];
|
||||
|
||||
@ -238,7 +238,7 @@ traceid JfrStackTraceRepository::record_for(JavaThread* thread, int skip, JfrSta
|
||||
}
|
||||
|
||||
size_t JfrStackTraceRepository::write_impl(JfrChunkWriter& sw, bool clear) {
|
||||
MutexLockerEx lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker lock(JfrStacktrace_lock, Mutex::_no_safepoint_check_flag);
|
||||
assert(_entries > 0, "invariant");
|
||||
int count = 0;
|
||||
for (u4 i = 0; i < TABLE_SIZE; ++i) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2019, 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
|
||||
@ -321,7 +321,7 @@ static bool full_buffer_registration(BufferPtr buffer, JfrStorageAgeMspace* age_
|
||||
assert(buffer != NULL, "invariant");
|
||||
assert(buffer->retired(), "invariant");
|
||||
assert(age_mspace != NULL, "invariant");
|
||||
MutexLockerEx lock(JfrBuffer_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker lock(JfrBuffer_lock, Mutex::_no_safepoint_check_flag);
|
||||
JfrAgeNode* age_node = get_free_age_node(age_mspace, thread);
|
||||
if (age_node == NULL) {
|
||||
age_node = new_age_node(buffer, age_mspace, thread);
|
||||
@ -623,7 +623,7 @@ static void insert_free_age_nodes(JfrStorageAgeMspace* age_mspace, JfrAgeNode* h
|
||||
assert(tail->next() == NULL, "invariant");
|
||||
assert(head != NULL, "invariant");
|
||||
assert(head->prev() == NULL, "invariant");
|
||||
MutexLockerEx buffer_lock(JfrBuffer_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker buffer_lock(JfrBuffer_lock, Mutex::_no_safepoint_check_flag);
|
||||
age_mspace->insert_free_tail(head, tail, count);
|
||||
}
|
||||
}
|
||||
@ -674,7 +674,7 @@ static size_t process_full(Processor& processor, JfrStorageControl& control, Jfr
|
||||
JfrAgeNode* head;
|
||||
{
|
||||
// fetch age list
|
||||
MutexLockerEx buffer_lock(JfrBuffer_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker buffer_lock(JfrBuffer_lock, Mutex::_no_safepoint_check_flag);
|
||||
count = age_mspace->full_count();
|
||||
head = age_mspace->clear_full();
|
||||
control.reset_full();
|
||||
|
@ -691,7 +691,7 @@ C2V_VMENTRY(jint, installCode, (JNIEnv *jniEnv, jobject, jobject target, jobject
|
||||
stringStream s;
|
||||
// Dump code cache into a buffer before locking the tty,
|
||||
{
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
CodeCache::print_summary(&s, false);
|
||||
}
|
||||
ttyLocker ttyl;
|
||||
@ -706,7 +706,7 @@ C2V_VMENTRY(jint, installCode, (JNIEnv *jniEnv, jobject, jobject target, jobject
|
||||
nmethod::invalidate_installed_code(installed_code_handle, CHECK_0);
|
||||
{
|
||||
// Ensure that all updates to the InstalledCode fields are consistent.
|
||||
MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
|
||||
InstalledCode::set_address(installed_code_handle, (jlong) cb);
|
||||
InstalledCode::set_version(installed_code_handle, InstalledCode::version(installed_code_handle) + 1);
|
||||
if (cb->is_nmethod()) {
|
||||
|
@ -841,7 +841,7 @@ void MetaspaceUtils::print_report(outputStream* out, size_t scale, int flags) {
|
||||
|
||||
// Prints an ASCII representation of the given space.
|
||||
void MetaspaceUtils::print_metaspace_map(outputStream* out, Metaspace::MetadataType mdtype) {
|
||||
MutexLockerEx cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
|
||||
const bool for_class = mdtype == Metaspace::ClassType ? true : false;
|
||||
VirtualSpaceList* const vsl = for_class ? Metaspace::class_space_list() : Metaspace::space_list();
|
||||
if (vsl != NULL) {
|
||||
@ -906,7 +906,7 @@ void MetaspaceUtils::verify_metrics() {
|
||||
|
||||
// Utils to check if a pointer or range is part of a committed metaspace region.
|
||||
metaspace::VirtualSpaceNode* MetaspaceUtils::find_enclosing_virtual_space(const void* p) {
|
||||
MutexLockerEx cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
|
||||
VirtualSpaceNode* vsn = Metaspace::space_list()->find_enclosing_space(p);
|
||||
if (Metaspace::using_class_space() && vsn == NULL) {
|
||||
vsn = Metaspace::class_space_list()->find_enclosing_space(p);
|
||||
@ -1402,8 +1402,8 @@ void Metaspace::purge(MetadataType mdtype) {
|
||||
}
|
||||
|
||||
void Metaspace::purge() {
|
||||
MutexLockerEx cl(MetaspaceExpand_lock,
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker cl(MetaspaceExpand_lock,
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
purge(NonClassType);
|
||||
if (using_class_space()) {
|
||||
purge(ClassType);
|
||||
@ -1480,7 +1480,7 @@ void ClassLoaderMetaspace::initialize(Mutex* lock, Metaspace::MetaspaceType type
|
||||
_class_vsm = new SpaceManager(Metaspace::ClassType, type, lock);
|
||||
}
|
||||
|
||||
MutexLockerEx cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
// Allocate chunk for metadata objects
|
||||
initialize_first_chunk(type, Metaspace::NonClassType);
|
||||
@ -1549,7 +1549,7 @@ void ClassLoaderMetaspace::deallocate(MetaWord* ptr, size_t word_size, bool is_c
|
||||
|
||||
DEBUG_ONLY(Atomic::inc(&g_internal_statistics.num_external_deallocs));
|
||||
|
||||
MutexLockerEx ml(vsm()->lock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(vsm()->lock(), Mutex::_no_safepoint_check_flag);
|
||||
|
||||
if (is_class && Metaspace::using_class_space()) {
|
||||
class_vsm()->deallocate(ptr, word_size);
|
||||
@ -1589,7 +1589,7 @@ void ClassLoaderMetaspace::add_to_statistics_locked(ClassLoaderMetaspaceStatisti
|
||||
}
|
||||
|
||||
void ClassLoaderMetaspace::add_to_statistics(ClassLoaderMetaspaceStatistics* out) const {
|
||||
MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker cl(lock(), Mutex::_no_safepoint_check_flag);
|
||||
add_to_statistics_locked(out);
|
||||
}
|
||||
|
||||
@ -1639,7 +1639,7 @@ class TestMetaspaceUtilsTest : AllStatic {
|
||||
|
||||
static void test_virtual_space_list_large_chunk() {
|
||||
VirtualSpaceList* vs_list = new VirtualSpaceList(os::vm_allocation_granularity());
|
||||
MutexLockerEx cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
|
||||
// A size larger than VirtualSpaceSize (256k) and add one page to make it _not_ be
|
||||
// vm_allocation_granularity aligned on Windows.
|
||||
size_t large_size = (size_t)(2*256*K + (os::vm_page_size()/BytesPerWord));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2019, 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
|
||||
@ -227,7 +227,7 @@ size_t ChunkManager::size_by_index(ChunkIndex index) const {
|
||||
|
||||
#ifdef ASSERT
|
||||
void ChunkManager::verify(bool slow) const {
|
||||
MutexLockerEx cl(MetaspaceExpand_lock,
|
||||
MutexLocker cl(MetaspaceExpand_lock,
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
locked_verify(slow);
|
||||
}
|
||||
@ -630,7 +630,7 @@ void ChunkManager::return_chunk_list(Metachunk* chunks) {
|
||||
}
|
||||
|
||||
void ChunkManager::collect_statistics(ChunkManagerStatistics* out) const {
|
||||
MutexLockerEx cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
|
||||
for (ChunkIndex i = ZeroIndex; i < NumberOfInUseLists; i = next_chunk_index(i)) {
|
||||
out->chunk_stats(i).add(num_free_chunks(i), size_free_chunks_in_bytes(i) / sizeof(MetaWord));
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2019, 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
|
||||
@ -179,7 +179,7 @@ MetaWord* SpaceManager::grow_and_allocate(size_t word_size) {
|
||||
assert(current_chunk() == NULL ||
|
||||
current_chunk()->allocate(word_size) == NULL,
|
||||
"Don't need to expand");
|
||||
MutexLockerEx cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
if (log_is_enabled(Trace, gc, metaspace, freelist)) {
|
||||
size_t words_left = 0;
|
||||
@ -284,8 +284,7 @@ SpaceManager::~SpaceManager() {
|
||||
// This call this->_lock which can't be done while holding MetaspaceExpand_lock
|
||||
DEBUG_ONLY(verify_metrics());
|
||||
|
||||
MutexLockerEx fcl(MetaspaceExpand_lock,
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker fcl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
account_for_spacemanager_death();
|
||||
|
||||
@ -402,7 +401,7 @@ Metachunk* SpaceManager::get_new_chunk(size_t chunk_word_size) {
|
||||
}
|
||||
|
||||
MetaWord* SpaceManager::allocate(size_t word_size) {
|
||||
MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker cl(lock(), Mutex::_no_safepoint_check_flag);
|
||||
size_t raw_word_size = get_allocation_word_size(word_size);
|
||||
BlockFreelist* fl = block_freelists();
|
||||
MetaWord* p = NULL;
|
||||
@ -498,7 +497,7 @@ void SpaceManager::add_to_statistics_locked(SpaceManagerStatistics* out) const {
|
||||
}
|
||||
|
||||
void SpaceManager::add_to_statistics(SpaceManagerStatistics* out) const {
|
||||
MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker cl(lock(), Mutex::_no_safepoint_check_flag);
|
||||
add_to_statistics_locked(out);
|
||||
}
|
||||
|
||||
@ -519,7 +518,7 @@ void SpaceManager::verify_metrics_locked() const {
|
||||
}
|
||||
|
||||
void SpaceManager::verify_metrics() const {
|
||||
MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker cl(lock(), Mutex::_no_safepoint_check_flag);
|
||||
verify_metrics_locked();
|
||||
}
|
||||
#endif // ASSERT
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2019, 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
|
||||
@ -172,8 +172,7 @@ VirtualSpaceList::VirtualSpaceList(size_t word_size) :
|
||||
_virtual_space_count(0),
|
||||
_envelope_lo((address)max_uintx),
|
||||
_envelope_hi(NULL) {
|
||||
MutexLockerEx cl(MetaspaceExpand_lock,
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
|
||||
create_new_virtual_space(word_size);
|
||||
}
|
||||
|
||||
@ -186,8 +185,7 @@ VirtualSpaceList::VirtualSpaceList(ReservedSpace rs) :
|
||||
_virtual_space_count(0),
|
||||
_envelope_lo((address)max_uintx),
|
||||
_envelope_hi(NULL) {
|
||||
MutexLockerEx cl(MetaspaceExpand_lock,
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker cl(MetaspaceExpand_lock, Mutex::_no_safepoint_check_flag);
|
||||
VirtualSpaceNode* class_entry = new VirtualSpaceNode(is_class(), rs);
|
||||
bool succeeded = class_entry->initialize();
|
||||
if (succeeded) {
|
||||
|
@ -1205,7 +1205,7 @@ void Universe::verify(VerifyOption option, const char* prefix) {
|
||||
}
|
||||
if (should_verify_subset(Verify_CodeCache)) {
|
||||
{
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
log_debug(gc, verify)("CodeCache");
|
||||
CodeCache::verify();
|
||||
}
|
||||
|
@ -2187,7 +2187,7 @@ void InstanceKlass::clean_method_data() {
|
||||
for (int m = 0; m < methods()->length(); m++) {
|
||||
MethodData* mdo = methods()->at(m)->method_data();
|
||||
if (mdo != NULL) {
|
||||
MutexLockerEx ml(SafepointSynchronize::is_at_safepoint() ? NULL : mdo->extra_data_lock());
|
||||
MutexLocker ml(SafepointSynchronize::is_at_safepoint() ? NULL : mdo->extra_data_lock());
|
||||
mdo->clean_method_data(/*always_clean*/false);
|
||||
}
|
||||
}
|
||||
@ -2968,7 +2968,7 @@ void InstanceKlass::add_osr_nmethod(nmethod* n) {
|
||||
// only one compilation can be active
|
||||
{
|
||||
// This is a short non-blocking critical region, so the no safepoint check is ok.
|
||||
MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
|
||||
assert(n->is_osr_method(), "wrong kind of nmethod");
|
||||
n->set_osr_link(osr_nmethods_head());
|
||||
set_osr_nmethods_head(n);
|
||||
@ -2993,7 +2993,7 @@ void InstanceKlass::add_osr_nmethod(nmethod* n) {
|
||||
// Remove osr nmethod from the list. Return true if found and removed.
|
||||
bool InstanceKlass::remove_osr_nmethod(nmethod* n) {
|
||||
// This is a short non-blocking critical region, so the no safepoint check is ok.
|
||||
MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
|
||||
assert(n->is_osr_method(), "wrong kind of nmethod");
|
||||
nmethod* last = NULL;
|
||||
nmethod* cur = osr_nmethods_head();
|
||||
@ -3037,7 +3037,7 @@ bool InstanceKlass::remove_osr_nmethod(nmethod* n) {
|
||||
|
||||
int InstanceKlass::mark_osr_nmethods(const Method* m) {
|
||||
// This is a short non-blocking critical region, so the no safepoint check is ok.
|
||||
MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
|
||||
nmethod* osr = osr_nmethods_head();
|
||||
int found = 0;
|
||||
while (osr != NULL) {
|
||||
@ -3053,7 +3053,7 @@ int InstanceKlass::mark_osr_nmethods(const Method* m) {
|
||||
|
||||
nmethod* InstanceKlass::lookup_osr_nmethod(const Method* m, int bci, int comp_level, bool match_level) const {
|
||||
// This is a short non-blocking critical region, so the no safepoint check is ok.
|
||||
MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
|
||||
nmethod* osr = osr_nmethods_head();
|
||||
nmethod* best = NULL;
|
||||
while (osr != NULL) {
|
||||
|
@ -928,7 +928,7 @@ void Method::set_not_osr_compilable(int comp_level, bool report, const char* rea
|
||||
|
||||
// Revert to using the interpreter and clear out the nmethod
|
||||
void Method::clear_code(bool acquire_lock /* = true */) {
|
||||
MutexLockerEx pl(acquire_lock ? Patching_lock : NULL, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker pl(acquire_lock ? Patching_lock : NULL, Mutex::_no_safepoint_check_flag);
|
||||
// this may be NULL if c2i adapters have not been made yet
|
||||
// Only should happen at allocate time.
|
||||
if (adapter() == NULL) {
|
||||
@ -1161,7 +1161,7 @@ bool Method::check_code() const {
|
||||
|
||||
// Install compiled code. Instantly it can execute.
|
||||
void Method::set_code(const methodHandle& mh, CompiledMethod *code) {
|
||||
MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag);
|
||||
assert( code, "use clear_code to remove code" );
|
||||
assert( mh->check_code(), "" );
|
||||
|
||||
@ -2064,7 +2064,7 @@ void Method::ensure_jmethod_ids(ClassLoaderData* loader_data, int capacity) {
|
||||
// Have to add jmethod_ids() to class loader data thread-safely.
|
||||
// Also have to add the method to the list safely, which the cld lock
|
||||
// protects as well.
|
||||
MutexLockerEx ml(cld->metaspace_lock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(cld->metaspace_lock(), Mutex::_no_safepoint_check_flag);
|
||||
if (cld->jmethod_ids() == NULL) {
|
||||
cld->set_jmethod_ids(new JNIMethodBlock(capacity));
|
||||
} else {
|
||||
@ -2088,7 +2088,7 @@ jmethodID Method::make_jmethod_id(ClassLoaderData* loader_data, Method* m) {
|
||||
// Have to add jmethod_ids() to class loader data thread-safely.
|
||||
// Also have to add the method to the list safely, which the cld lock
|
||||
// protects as well.
|
||||
MutexLockerEx ml(cld->metaspace_lock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(cld->metaspace_lock(), Mutex::_no_safepoint_check_flag);
|
||||
if (cld->jmethod_ids() == NULL) {
|
||||
cld->set_jmethod_ids(new JNIMethodBlock());
|
||||
}
|
||||
@ -2382,7 +2382,7 @@ void Method::log_touched(TRAPS) {
|
||||
}
|
||||
|
||||
void Method::print_touched_methods(outputStream* out) {
|
||||
MutexLockerEx ml(Thread::current()->is_VM_thread() ? NULL : TouchedMethodLog_lock);
|
||||
MutexLocker ml(Thread::current()->is_VM_thread() ? NULL : TouchedMethodLog_lock);
|
||||
out->print_cr("# Method::print_touched_methods version 1");
|
||||
if (_touched_method_table) {
|
||||
for (int i = 0; i < TOUCHED_METHOD_TABLE_SIZE; i++) {
|
||||
|
@ -2863,7 +2863,7 @@ JVM_ENTRY(void, JVM_SuspendThread(JNIEnv* env, jobject jthread))
|
||||
if (is_alive) {
|
||||
// jthread refers to a live JavaThread.
|
||||
{
|
||||
MutexLockerEx ml(receiver->SR_lock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(receiver->SR_lock(), Mutex::_no_safepoint_check_flag);
|
||||
if (receiver->is_external_suspend()) {
|
||||
// Don't allow nested external suspend requests. We can't return
|
||||
// an error from this interface so just ignore the problem.
|
||||
@ -3168,7 +3168,7 @@ JVM_END
|
||||
JVM_ENTRY(jobject, JVM_GetAndClearReferencePendingList(JNIEnv* env))
|
||||
JVMWrapper("JVM_GetAndClearReferencePendingList");
|
||||
|
||||
MonitorLockerEx ml(Heap_lock);
|
||||
MonitorLocker ml(Heap_lock);
|
||||
oop ref = Universe::reference_pending_list();
|
||||
if (ref != NULL) {
|
||||
Universe::set_reference_pending_list(NULL);
|
||||
@ -3178,13 +3178,13 @@ JVM_END
|
||||
|
||||
JVM_ENTRY(jboolean, JVM_HasReferencePendingList(JNIEnv* env))
|
||||
JVMWrapper("JVM_HasReferencePendingList");
|
||||
MonitorLockerEx ml(Heap_lock);
|
||||
MonitorLocker ml(Heap_lock);
|
||||
return Universe::has_reference_pending_list();
|
||||
JVM_END
|
||||
|
||||
JVM_ENTRY(void, JVM_WaitForReferencePendingList(JNIEnv* env))
|
||||
JVMWrapper("JVM_WaitForReferencePendingList");
|
||||
MonitorLockerEx ml(Heap_lock);
|
||||
MonitorLocker ml(Heap_lock);
|
||||
while (!Universe::has_reference_pending_list()) {
|
||||
ml.wait();
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ jvmtiError JvmtiCodeBlobEvents::generate_dynamic_code_events(JvmtiEnv* env) {
|
||||
// there isn't any safe way to iterate over regular CodeBlobs since
|
||||
// they can be freed at any point.
|
||||
{
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
collector.collect();
|
||||
}
|
||||
|
||||
@ -225,7 +225,7 @@ jvmtiError JvmtiCodeBlobEvents::generate_compiled_method_load_events(JvmtiEnv* e
|
||||
// may be changing while this is happening which is ok since newly
|
||||
// created nmethod will notify normally and nmethods which are freed
|
||||
// can be safely skipped.
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
// Iterate over non-profiled and profiled nmethods
|
||||
NMethodIterator iter(NMethodIterator::only_alive_and_not_unloading);
|
||||
while(iter.next()) {
|
||||
@ -234,7 +234,7 @@ jvmtiError JvmtiCodeBlobEvents::generate_compiled_method_load_events(JvmtiEnv* e
|
||||
nmethodLocker nml(current);
|
||||
|
||||
// Don't hold the lock over the notify or jmethodID creation
|
||||
MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexUnlocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
current->get_and_cache_jmethod_id();
|
||||
JvmtiExport::post_compiled_method_load(env, current);
|
||||
}
|
||||
|
@ -943,7 +943,7 @@ JvmtiEnv::SuspendThread(JavaThread* java_thread) {
|
||||
}
|
||||
|
||||
{
|
||||
MutexLockerEx ml(java_thread->SR_lock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(java_thread->SR_lock(), Mutex::_no_safepoint_check_flag);
|
||||
if (java_thread->is_external_suspend()) {
|
||||
// don't allow nested external suspend requests.
|
||||
return (JVMTI_ERROR_THREAD_SUSPENDED);
|
||||
@ -983,7 +983,7 @@ JvmtiEnv::SuspendThreadList(jint request_count, const jthread* request_list, jvm
|
||||
}
|
||||
|
||||
{
|
||||
MutexLockerEx ml(java_thread->SR_lock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(java_thread->SR_lock(), Mutex::_no_safepoint_check_flag);
|
||||
if (java_thread->is_external_suspend()) {
|
||||
// don't allow nested external suspend requests.
|
||||
results[i] = JVMTI_ERROR_THREAD_SUSPENDED;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2019, 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
|
||||
@ -997,21 +997,21 @@ JvmtiEventController::set_extension_event_callback(JvmtiEnvBase *env,
|
||||
|
||||
void
|
||||
JvmtiEventController::set_frame_pop(JvmtiEnvThreadState *ets, JvmtiFramePop fpop) {
|
||||
MutexLockerEx mu(SafepointSynchronize::is_at_safepoint() ? NULL : JvmtiThreadState_lock);
|
||||
MutexLocker mu(SafepointSynchronize::is_at_safepoint() ? NULL : JvmtiThreadState_lock);
|
||||
JvmtiEventControllerPrivate::set_frame_pop(ets, fpop);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JvmtiEventController::clear_frame_pop(JvmtiEnvThreadState *ets, JvmtiFramePop fpop) {
|
||||
MutexLockerEx mu(SafepointSynchronize::is_at_safepoint() ? NULL : JvmtiThreadState_lock);
|
||||
MutexLocker mu(SafepointSynchronize::is_at_safepoint() ? NULL : JvmtiThreadState_lock);
|
||||
JvmtiEventControllerPrivate::clear_frame_pop(ets, fpop);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
JvmtiEventController::clear_to_frame_pop(JvmtiEnvThreadState *ets, JvmtiFramePop fpop) {
|
||||
MutexLockerEx mu(SafepointSynchronize::is_at_safepoint() ? NULL : JvmtiThreadState_lock);
|
||||
MutexLocker mu(SafepointSynchronize::is_at_safepoint() ? NULL : JvmtiThreadState_lock);
|
||||
JvmtiEventControllerPrivate::clear_to_frame_pop(ets, fpop);
|
||||
}
|
||||
|
||||
|
@ -2239,7 +2239,7 @@ void JvmtiExport::post_dynamic_code_generated(const char *name, const void *code
|
||||
// It may not be safe to post the event from this thread. Defer all
|
||||
// postings to the service thread so that it can perform them in a safe
|
||||
// context and in-order.
|
||||
MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||
JvmtiDeferredEvent event = JvmtiDeferredEvent::dynamic_code_generated_event(
|
||||
name, code_begin, code_end);
|
||||
JvmtiDeferredEventQueue::enqueue(event);
|
||||
|
@ -1098,7 +1098,7 @@ void MethodHandles::flush_dependent_nmethods(Handle call_site, Handle target) {
|
||||
CallSiteDepChange changes(call_site, target);
|
||||
{
|
||||
NoSafepointVerifier nsv;
|
||||
MutexLockerEx mu2(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu2(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
|
||||
oop context = java_lang_invoke_CallSite::context_no_keepalive(call_site());
|
||||
DependencyContext deps = java_lang_invoke_MethodHandleNatives_CallSiteContext::vmdependencies(context);
|
||||
@ -1497,7 +1497,7 @@ JVM_ENTRY(void, MHN_clearCallSiteContext(JNIEnv* env, jobject igcls, jobject con
|
||||
int marked = 0;
|
||||
{
|
||||
NoSafepointVerifier nsv;
|
||||
MutexLockerEx mu2(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu2(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
DependencyContext deps = java_lang_invoke_MethodHandleNatives_CallSiteContext::vmdependencies(context());
|
||||
marked = deps.remove_all_dependents();
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ void ResolvedMethodTable::check_concurrent_work() {
|
||||
}
|
||||
|
||||
void ResolvedMethodTable::trigger_concurrent_work() {
|
||||
MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
|
||||
_has_work = true;
|
||||
Service_lock->notify_all();
|
||||
}
|
||||
|
@ -817,7 +817,7 @@ WB_ENTRY(jint, WB_DeoptimizeFrames(JNIEnv* env, jobject o, jboolean make_not_ent
|
||||
WB_END
|
||||
|
||||
WB_ENTRY(void, WB_DeoptimizeAll(JNIEnv* env, jobject o))
|
||||
MutexLockerEx mu(Compile_lock);
|
||||
MutexLocker mu(Compile_lock);
|
||||
CodeCache::mark_all_nmethods_for_deoptimization();
|
||||
VM_Deoptimize op;
|
||||
VMThread::execute(&op);
|
||||
@ -827,7 +827,7 @@ WB_ENTRY(jint, WB_DeoptimizeMethod(JNIEnv* env, jobject o, jobject method, jbool
|
||||
jmethodID jmid = reflected_method_to_jmid(thread, env, method);
|
||||
int result = 0;
|
||||
CHECK_JNI_EXCEPTION_(env, result);
|
||||
MutexLockerEx mu(Compile_lock);
|
||||
MutexLocker mu(Compile_lock);
|
||||
methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
|
||||
if (is_osr) {
|
||||
result += mh->mark_osr_nmethods();
|
||||
@ -846,7 +846,7 @@ WB_END
|
||||
WB_ENTRY(jboolean, WB_IsMethodCompiled(JNIEnv* env, jobject o, jobject method, jboolean is_osr))
|
||||
jmethodID jmid = reflected_method_to_jmid(thread, env, method);
|
||||
CHECK_JNI_EXCEPTION_(env, JNI_FALSE);
|
||||
MutexLockerEx mu(Compile_lock);
|
||||
MutexLocker mu(Compile_lock);
|
||||
methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
|
||||
CompiledMethod* code = is_osr ? mh->lookup_osr_nmethod_for(InvocationEntryBci, CompLevel_none, false) : mh->code();
|
||||
if (code == NULL) {
|
||||
@ -861,7 +861,7 @@ WB_ENTRY(jboolean, WB_IsMethodCompilable(JNIEnv* env, jobject o, jobject method,
|
||||
}
|
||||
jmethodID jmid = reflected_method_to_jmid(thread, env, method);
|
||||
CHECK_JNI_EXCEPTION_(env, JNI_FALSE);
|
||||
MutexLockerEx mu(Compile_lock);
|
||||
MutexLocker mu(Compile_lock);
|
||||
methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
|
||||
if (is_osr) {
|
||||
return CompilationPolicy::can_be_osr_compiled(mh, comp_level);
|
||||
@ -873,7 +873,7 @@ WB_END
|
||||
WB_ENTRY(jboolean, WB_IsMethodQueuedForCompilation(JNIEnv* env, jobject o, jobject method))
|
||||
jmethodID jmid = reflected_method_to_jmid(thread, env, method);
|
||||
CHECK_JNI_EXCEPTION_(env, JNI_FALSE);
|
||||
MutexLockerEx mu(Compile_lock);
|
||||
MutexLocker mu(Compile_lock);
|
||||
methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
|
||||
return mh->queued_for_compilation();
|
||||
WB_END
|
||||
@ -982,7 +982,7 @@ bool WhiteBox::compile_method(Method* method, int comp_level, int bci, Thread* T
|
||||
|
||||
// Compile method and check result
|
||||
nmethod* nm = CompileBroker::compile_method(mh, bci, comp_level, mh, mh->invocation_count(), CompileTask::Reason_Whitebox, THREAD);
|
||||
MutexLockerEx mu(Compile_lock);
|
||||
MutexLocker mu(Compile_lock);
|
||||
bool is_queued = mh->queued_for_compilation();
|
||||
if ((!is_blocking && is_queued) || nm != NULL) {
|
||||
return true;
|
||||
@ -1082,7 +1082,7 @@ WB_ENTRY(void, WB_ClearMethodState(JNIEnv* env, jobject o, jobject method))
|
||||
jmethodID jmid = reflected_method_to_jmid(thread, env, method);
|
||||
CHECK_JNI_EXCEPTION(env);
|
||||
methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
|
||||
MutexLockerEx mu(Compile_lock);
|
||||
MutexLocker mu(Compile_lock);
|
||||
MethodData* mdo = mh->method_data();
|
||||
MethodCounters* mcs = mh->method_counters();
|
||||
|
||||
@ -1093,7 +1093,7 @@ WB_ENTRY(void, WB_ClearMethodState(JNIEnv* env, jobject o, jobject method))
|
||||
for (int i = 0; i < arg_count; i++) {
|
||||
mdo->set_arg_modified(i, 0);
|
||||
}
|
||||
MutexLockerEx mu(mdo->extra_data_lock());
|
||||
MutexLocker mu(mdo->extra_data_lock());
|
||||
mdo->clean_method_data(/*always_clean*/true);
|
||||
}
|
||||
|
||||
@ -1342,7 +1342,7 @@ WB_ENTRY(void, WB_LockCompilation(JNIEnv* env, jobject o, jlong timeout))
|
||||
WB_END
|
||||
|
||||
WB_ENTRY(void, WB_UnlockCompilation(JNIEnv* env, jobject o))
|
||||
MonitorLockerEx mo(Compilation_lock, Mutex::_no_safepoint_check_flag);
|
||||
MonitorLocker mo(Compilation_lock, Mutex::_no_safepoint_check_flag);
|
||||
WhiteBox::compilation_locked = false;
|
||||
mo.notify_all();
|
||||
WB_END
|
||||
@ -1502,7 +1502,7 @@ CodeBlob* WhiteBox::allocate_code_blob(int size, int blob_type) {
|
||||
full_size += align_up(size - full_size, oopSize);
|
||||
}
|
||||
{
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
blob = (BufferBlob*) CodeCache::allocate(full_size, blob_type);
|
||||
if (blob != NULL) {
|
||||
::new (blob) BufferBlob("WB::DummyBlob", full_size);
|
||||
@ -1532,7 +1532,7 @@ WB_ENTRY(jobjectArray, WB_GetCodeHeapEntries(JNIEnv* env, jobject o, jint blob_t
|
||||
ResourceMark rm;
|
||||
GrowableArray<CodeBlobStub*> blobs;
|
||||
{
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
CodeHeap* heap = WhiteBox::get_code_heap(blob_type);
|
||||
if (heap == NULL) {
|
||||
return NULL;
|
||||
@ -1718,8 +1718,11 @@ WB_ENTRY(void, WB_AssertMatchingSafepointCalls(JNIEnv* env, jobject o, jboolean
|
||||
Monitor::SafepointCheckRequired sfpt_check_required = mutexSafepointValue ?
|
||||
Monitor::_safepoint_check_always :
|
||||
Monitor::_safepoint_check_never;
|
||||
MutexLockerEx ml(new Mutex(Mutex::leaf, "SFPT_Test_lock", true, sfpt_check_required),
|
||||
attemptedNoSafepointValue == JNI_TRUE);
|
||||
Monitor::SafepointCheckFlag sfpt_check_attempted = attemptedNoSafepointValue ?
|
||||
Monitor::_no_safepoint_check_flag :
|
||||
Monitor::_safepoint_check_flag;
|
||||
MutexLocker ml(new Mutex(Mutex::leaf, "SFPT_Test_lock", true, sfpt_check_required),
|
||||
sfpt_check_attempted);
|
||||
WB_END
|
||||
|
||||
WB_ENTRY(jboolean, WB_IsMonitorInflated(JNIEnv* env, jobject wb, jobject obj))
|
||||
|
@ -137,7 +137,7 @@ class VM_HandshakeOneThread: public VM_Handshake {
|
||||
// There is an assumption in the code that the Threads_lock should be
|
||||
// locked during certain phases.
|
||||
{
|
||||
MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(Threads_lock, Mutex::_no_safepoint_check_flag);
|
||||
_target->handshake_process_by_vmthread();
|
||||
}
|
||||
} while (!poll_for_completed_thread());
|
||||
@ -186,7 +186,7 @@ class VM_HandshakeAllThreads: public VM_Handshake {
|
||||
// There is an assumption in the code that the Threads_lock should
|
||||
// be locked during certain phases.
|
||||
jtiwh.rewind();
|
||||
MutexLockerEx ml(Threads_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(Threads_lock, Mutex::_no_safepoint_check_flag);
|
||||
for (JavaThread *thr = jtiwh.next(); thr != NULL; thr = jtiwh.next()) {
|
||||
// A new thread on the ThreadsList will not have an operation,
|
||||
// hence it is skipped in handshake_process_by_vmthread.
|
||||
|
@ -191,15 +191,15 @@ bool is_init_completed() {
|
||||
}
|
||||
|
||||
void wait_init_completed() {
|
||||
MonitorLockerEx ml(InitCompleted_lock, Monitor::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(InitCompleted_lock, Monitor::_no_safepoint_check_flag);
|
||||
while (!_init_completed) {
|
||||
ml.wait(Monitor::_no_safepoint_check_flag);
|
||||
ml.wait();
|
||||
}
|
||||
}
|
||||
|
||||
void set_init_completed() {
|
||||
assert(Universe::is_fully_initialized(), "Should have completed initialization");
|
||||
MonitorLockerEx ml(InitCompleted_lock, Monitor::_no_safepoint_check_flag);
|
||||
MonitorLocker ml(InitCompleted_lock, Monitor::_no_safepoint_check_flag);
|
||||
OrderAccess::release_store(&_init_completed, true);
|
||||
ml.notify_all();
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ void print_statistics() {
|
||||
}
|
||||
|
||||
if (PrintCodeCache) {
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
CodeCache::print();
|
||||
}
|
||||
|
||||
@ -315,7 +315,7 @@ void print_statistics() {
|
||||
}
|
||||
|
||||
if (PrintCodeCache2) {
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
CodeCache::print_internals();
|
||||
}
|
||||
|
||||
@ -370,7 +370,7 @@ void print_statistics() {
|
||||
}
|
||||
|
||||
if (PrintCodeCache) {
|
||||
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
|
||||
CodeCache::print();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2019, 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
|
||||
@ -371,8 +371,8 @@ JNIHandleBlock* JNIHandleBlock::allocate_block(Thread* thread) {
|
||||
// - we would hold JNIHandleBlockFreeList_lock and then Threads_lock
|
||||
// - another would hold Threads_lock (jni_AttachCurrentThread) and then
|
||||
// JNIHandleBlockFreeList_lock (JNIHandleBlock::allocate_block)
|
||||
MutexLockerEx ml(JNIHandleBlockFreeList_lock,
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(JNIHandleBlockFreeList_lock,
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
if (_block_free_list == NULL) {
|
||||
// Allocate new block
|
||||
block = new JNIHandleBlock();
|
||||
@ -427,8 +427,8 @@ void JNIHandleBlock::release_block(JNIHandleBlock* block, Thread* thread) {
|
||||
// - we would hold JNIHandleBlockFreeList_lock and then Threads_lock
|
||||
// - another would hold Threads_lock (jni_AttachCurrentThread) and then
|
||||
// JNIHandleBlockFreeList_lock (JNIHandleBlock::allocate_block)
|
||||
MutexLockerEx ml(JNIHandleBlockFreeList_lock,
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(JNIHandleBlockFreeList_lock,
|
||||
Mutex::_no_safepoint_check_flag);
|
||||
while (block != NULL) {
|
||||
block->zap();
|
||||
JNIHandleBlock* next = block->_next;
|
||||
|
@ -140,27 +140,9 @@ void Monitor::notify_all() {
|
||||
_lock.notify_all();
|
||||
}
|
||||
|
||||
bool Monitor::wait(bool no_safepoint_check, long timeout,
|
||||
bool as_suspend_equivalent) {
|
||||
// Make sure safepoint checking is used properly.
|
||||
assert(!(_safepoint_check_required == Monitor::_safepoint_check_never && no_safepoint_check == false),
|
||||
"This lock should never have a safepoint check: %s", name());
|
||||
assert(!(_safepoint_check_required == Monitor::_safepoint_check_always && no_safepoint_check == true),
|
||||
"This lock should always have a safepoint check: %s", name());
|
||||
|
||||
// timeout is in milliseconds - with zero meaning never timeout
|
||||
assert(timeout >= 0, "negative timeout");
|
||||
|
||||
Thread * const self = Thread::current();
|
||||
assert_owner(self);
|
||||
|
||||
// as_suspend_equivalent logically implies !no_safepoint_check
|
||||
guarantee(!as_suspend_equivalent || !no_safepoint_check, "invariant");
|
||||
// !no_safepoint_check logically implies java_thread
|
||||
guarantee(no_safepoint_check || self->is_Java_thread(), "invariant");
|
||||
|
||||
#ifdef ASSERT
|
||||
Monitor * least = get_least_ranked_lock_besides_this(self->owned_locks());
|
||||
void Monitor::assert_wait_lock_state(Thread* self) {
|
||||
Monitor* least = get_least_ranked_lock_besides_this(self->owned_locks());
|
||||
assert(least != this, "Specification of get_least_... call above");
|
||||
if (least != NULL && least->rank() <= special) {
|
||||
::tty->print("Attempting to wait on monitor %s/%d while holding"
|
||||
@ -168,60 +150,89 @@ bool Monitor::wait(bool no_safepoint_check, long timeout,
|
||||
name(), rank(), least->name(), least->rank());
|
||||
assert(false, "Shouldn't block(wait) while holding a lock of rank special");
|
||||
}
|
||||
}
|
||||
#endif // ASSERT
|
||||
|
||||
bool Monitor::wait_without_safepoint_check(long timeout) {
|
||||
// Make sure safepoint checking is used properly.
|
||||
assert(_safepoint_check_required != Monitor::_safepoint_check_always,
|
||||
"This lock should always have a safepoint check: %s", name());
|
||||
|
||||
// timeout is in milliseconds - with zero meaning never timeout
|
||||
assert(timeout >= 0, "negative timeout");
|
||||
|
||||
Thread * const self = Thread::current();
|
||||
assert_owner(self);
|
||||
assert_wait_lock_state(self);
|
||||
|
||||
// conceptually set the owner to NULL in anticipation of
|
||||
// abdicating the lock in wait
|
||||
set_owner(NULL);
|
||||
int wait_status = _lock.wait(timeout);
|
||||
set_owner(self);
|
||||
return wait_status != 0; // return true IFF timeout
|
||||
}
|
||||
|
||||
bool Monitor::wait(long timeout, bool as_suspend_equivalent) {
|
||||
// Make sure safepoint checking is used properly.
|
||||
assert(_safepoint_check_required != Monitor::_safepoint_check_never,
|
||||
"This lock should never have a safepoint check: %s", name());
|
||||
|
||||
// timeout is in milliseconds - with zero meaning never timeout
|
||||
assert(timeout >= 0, "negative timeout");
|
||||
|
||||
Thread* const self = Thread::current();
|
||||
assert_owner(self);
|
||||
|
||||
// Safepoint checking logically implies java_thread
|
||||
guarantee(self->is_Java_thread(), "invariant");
|
||||
assert_wait_lock_state(self);
|
||||
|
||||
#ifdef CHECK_UNHANDLED_OOPS
|
||||
// Clear unhandled oops in JavaThreads so we get a crash right away.
|
||||
if (self->is_Java_thread() && !no_safepoint_check) {
|
||||
self->clear_unhandled_oops();
|
||||
}
|
||||
self->clear_unhandled_oops();
|
||||
#endif // CHECK_UNHANDLED_OOPS
|
||||
|
||||
int wait_status;
|
||||
// conceptually set the owner to NULL in anticipation of
|
||||
// abdicating the lock in wait
|
||||
set_owner(NULL);
|
||||
if (no_safepoint_check) {
|
||||
wait_status = _lock.wait(timeout);
|
||||
set_owner(self);
|
||||
} else {
|
||||
assert(self->is_Java_thread(), "invariant");
|
||||
JavaThread *jt = (JavaThread *)self;
|
||||
Monitor* in_flight_monitor = NULL;
|
||||
JavaThread *jt = (JavaThread *)self;
|
||||
Monitor* in_flight_monitor = NULL;
|
||||
|
||||
{
|
||||
ThreadBlockInVMWithDeadlockCheck tbivmdc(jt, &in_flight_monitor);
|
||||
OSThreadWaitState osts(self->osthread(), false /* not Object.wait() */);
|
||||
if (as_suspend_equivalent) {
|
||||
jt->set_suspend_equivalent();
|
||||
// cleared by handle_special_suspend_equivalent_condition() or
|
||||
// java_suspend_self()
|
||||
}
|
||||
|
||||
wait_status = _lock.wait(timeout);
|
||||
in_flight_monitor = this; // save for ~ThreadBlockInVMWithDeadlockCheck
|
||||
|
||||
// were we externally suspended while we were waiting?
|
||||
if (as_suspend_equivalent && jt->handle_special_suspend_equivalent_condition()) {
|
||||
// Our event wait has finished and we own the lock, but
|
||||
// while we were waiting another thread suspended us. We don't
|
||||
// want to hold the lock while suspended because that
|
||||
// would surprise the thread that suspended us.
|
||||
_lock.unlock();
|
||||
jt->java_suspend_self();
|
||||
_lock.lock();
|
||||
}
|
||||
{
|
||||
ThreadBlockInVMWithDeadlockCheck tbivmdc(jt, &in_flight_monitor);
|
||||
OSThreadWaitState osts(self->osthread(), false /* not Object.wait() */);
|
||||
if (as_suspend_equivalent) {
|
||||
jt->set_suspend_equivalent();
|
||||
// cleared by handle_special_suspend_equivalent_condition() or
|
||||
// java_suspend_self()
|
||||
}
|
||||
|
||||
if (in_flight_monitor != NULL) {
|
||||
// Not unlocked by ~ThreadBlockInVMWithDeadlockCheck
|
||||
assert_owner(NULL);
|
||||
// Conceptually reestablish ownership of the lock.
|
||||
set_owner(self);
|
||||
} else {
|
||||
lock(self);
|
||||
wait_status = _lock.wait(timeout);
|
||||
in_flight_monitor = this; // save for ~ThreadBlockInVMWithDeadlockCheck
|
||||
|
||||
// were we externally suspended while we were waiting?
|
||||
if (as_suspend_equivalent && jt->handle_special_suspend_equivalent_condition()) {
|
||||
// Our event wait has finished and we own the lock, but
|
||||
// while we were waiting another thread suspended us. We don't
|
||||
// want to hold the lock while suspended because that
|
||||
// would surprise the thread that suspended us.
|
||||
_lock.unlock();
|
||||
jt->java_suspend_self();
|
||||
_lock.lock();
|
||||
}
|
||||
}
|
||||
|
||||
if (in_flight_monitor != NULL) {
|
||||
// Not unlocked by ~ThreadBlockInVMWithDeadlockCheck
|
||||
assert_owner(NULL);
|
||||
// Conceptually reestablish ownership of the lock.
|
||||
set_owner(self);
|
||||
} else {
|
||||
lock(self);
|
||||
}
|
||||
|
||||
return wait_status != 0; // return true IFF timeout
|
||||
}
|
||||
|
||||
|
@ -93,14 +93,19 @@ class Monitor : public CHeapObj<mtSynchronizer> {
|
||||
void check_prelock_state (Thread* thread, bool safepoint_check) PRODUCT_RETURN;
|
||||
void check_block_state (Thread* thread) PRODUCT_RETURN;
|
||||
void assert_owner (Thread* expected) NOT_DEBUG_RETURN;
|
||||
void assert_wait_lock_state (Thread* self) NOT_DEBUG_RETURN;
|
||||
|
||||
public:
|
||||
enum {
|
||||
_no_safepoint_check_flag = true,
|
||||
_allow_vm_block_flag = true,
|
||||
_as_suspend_equivalent_flag = true
|
||||
};
|
||||
|
||||
enum SafepointCheckFlag {
|
||||
_safepoint_check_flag,
|
||||
_no_safepoint_check_flag
|
||||
};
|
||||
|
||||
// Locks can be acquired with or without safepoint check.
|
||||
// Monitor::lock and Monitor::lock_without_safepoint_check
|
||||
// checks these flags when acquiring a lock to ensure
|
||||
@ -135,9 +140,9 @@ class Monitor : public CHeapObj<mtSynchronizer> {
|
||||
// Defaults are to make safepoint checks, wait time is forever (i.e.,
|
||||
// zero), and not a suspend-equivalent condition. Returns true if wait
|
||||
// times out; otherwise returns false.
|
||||
bool wait(bool no_safepoint_check = !_no_safepoint_check_flag,
|
||||
long timeout = 0,
|
||||
bool wait(long timeout = 0,
|
||||
bool as_suspend_equivalent = !_as_suspend_equivalent_flag);
|
||||
bool wait_without_safepoint_check(long timeout = 0);
|
||||
void notify();
|
||||
void notify_all();
|
||||
|
||||
@ -220,21 +225,19 @@ class PaddedMonitor : public Monitor {
|
||||
// An even better alternative is to simply eliminate Mutex:: and use Monitor:: instead.
|
||||
// After all, monitors are sufficient for Java-level synchronization. At one point in time
|
||||
// there may have been some benefit to having distinct mutexes and monitors, but that time
|
||||
// has past.
|
||||
// has passed.
|
||||
//
|
||||
|
||||
class Mutex : public Monitor { // degenerate Monitor
|
||||
public:
|
||||
Mutex(int rank, const char *name, bool allow_vm_block = false,
|
||||
SafepointCheckRequired safepoint_check_required = _safepoint_check_always);
|
||||
// default destructor
|
||||
// default destructor
|
||||
private:
|
||||
void notify () { ShouldNotReachHere(); }
|
||||
void notify_all() { ShouldNotReachHere(); }
|
||||
bool wait (bool no_safepoint_check, long timeout, bool as_suspend_equivalent) {
|
||||
ShouldNotReachHere() ;
|
||||
return false ;
|
||||
}
|
||||
void notify();
|
||||
void notify_all();
|
||||
bool wait(long timeout, bool as_suspend_equivalent);
|
||||
bool wait_without_safepoint_check(long timeout);
|
||||
};
|
||||
|
||||
class PaddedMutex : public Mutex {
|
||||
|
@ -62,7 +62,7 @@ extern Mutex* VtableStubs_lock; // a lock on the VtableStubs
|
||||
extern Mutex* SymbolArena_lock; // a lock on the symbol table arena
|
||||
extern Monitor* StringDedupQueue_lock; // a lock on the string deduplication queue
|
||||
extern Mutex* StringDedupTable_lock; // a lock on the string deduplication table
|
||||
extern Monitor* CodeCache_lock; // a lock on the CodeCache, rank is special, use MutexLockerEx
|
||||
extern Monitor* CodeCache_lock; // a lock on the CodeCache, rank is special
|
||||
extern Mutex* MethodData_lock; // a lock on installation of method data
|
||||
extern Mutex* TouchedMethodLog_lock; // a lock on allocation of LogExecutedMethods info
|
||||
extern Mutex* RetData_lock; // a lock on installation of RetData inside method data
|
||||
@ -175,31 +175,6 @@ void print_owned_locks_on_error(outputStream* st);
|
||||
|
||||
char *lock_name(Mutex *mutex);
|
||||
|
||||
class MutexLocker: StackObj {
|
||||
private:
|
||||
Monitor * _mutex;
|
||||
public:
|
||||
MutexLocker(Monitor * mutex) {
|
||||
assert(mutex->rank() != Mutex::special,
|
||||
"Special ranked mutex should only use MutexLockerEx");
|
||||
_mutex = mutex;
|
||||
_mutex->lock();
|
||||
}
|
||||
|
||||
// Overloaded constructor passing current thread
|
||||
MutexLocker(Monitor * mutex, Thread *thread) {
|
||||
assert(mutex->rank() != Mutex::special,
|
||||
"Special ranked mutex should only use MutexLockerEx");
|
||||
_mutex = mutex;
|
||||
_mutex->lock(thread);
|
||||
}
|
||||
|
||||
~MutexLocker() {
|
||||
_mutex->unlock();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// for debugging: check that we're already owning this lock (or are at a safepoint)
|
||||
#ifdef ASSERT
|
||||
void assert_locked_or_safepoint(const Monitor * lock);
|
||||
@ -211,84 +186,89 @@ void assert_lock_strong(const Monitor * lock);
|
||||
#define assert_lock_strong(lock)
|
||||
#endif
|
||||
|
||||
// A MutexLockerEx behaves like a MutexLocker when its constructor is
|
||||
// called with a Mutex. Unlike a MutexLocker, its constructor can also be
|
||||
// called with NULL, in which case the MutexLockerEx is a no-op. There
|
||||
// is also a corresponding MutexUnlockerEx. We want to keep the
|
||||
// basic MutexLocker as fast as possible. MutexLockerEx can also lock
|
||||
// without safepoint check.
|
||||
|
||||
class MutexLockerEx: public StackObj {
|
||||
class MutexLocker: public StackObj {
|
||||
protected:
|
||||
Monitor* _mutex;
|
||||
private:
|
||||
Monitor * _mutex;
|
||||
public:
|
||||
MutexLockerEx(Monitor * mutex, bool no_safepoint_check = !Mutex::_no_safepoint_check_flag) {
|
||||
_mutex = mutex;
|
||||
MutexLocker(Monitor* mutex, Mutex::SafepointCheckFlag flag = Mutex::_safepoint_check_flag) :
|
||||
_mutex(mutex) {
|
||||
bool no_safepoint_check = flag == Mutex::_no_safepoint_check_flag;
|
||||
if (_mutex != NULL) {
|
||||
assert(mutex->rank() > Mutex::special || no_safepoint_check,
|
||||
"Mutexes with rank special or lower should not do safepoint checks");
|
||||
if (no_safepoint_check)
|
||||
assert(_mutex->rank() > Mutex::special || no_safepoint_check,
|
||||
"Mutexes with rank special or lower should not do safepoint checks");
|
||||
if (no_safepoint_check) {
|
||||
_mutex->lock_without_safepoint_check();
|
||||
else
|
||||
} else {
|
||||
_mutex->lock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
~MutexLockerEx() {
|
||||
MutexLocker(Monitor* mutex, Thread* thread, Mutex::SafepointCheckFlag flag = Mutex::_safepoint_check_flag) :
|
||||
_mutex(mutex) {
|
||||
bool no_safepoint_check = flag == Mutex::_no_safepoint_check_flag;
|
||||
if (_mutex != NULL) {
|
||||
assert(_mutex->rank() > Mutex::special || no_safepoint_check,
|
||||
"Mutexes with rank special or lower should not do safepoint checks");
|
||||
if (no_safepoint_check) {
|
||||
_mutex->lock_without_safepoint_check(thread);
|
||||
} else {
|
||||
_mutex->lock(thread);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
~MutexLocker() {
|
||||
if (_mutex != NULL) {
|
||||
assert_lock_strong(_mutex);
|
||||
_mutex->unlock();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// A MonitorLockerEx is like a MutexLockerEx above, except it takes
|
||||
// a possibly null Monitor, and allows wait/notify as well which are
|
||||
// delegated to the underlying Monitor.
|
||||
// A MonitorLocker is like a MutexLocker above, except it allows
|
||||
// wait/notify as well which are delegated to the underlying Monitor.
|
||||
|
||||
class MonitorLockerEx: public MutexLockerEx {
|
||||
private:
|
||||
Monitor * _monitor;
|
||||
class MonitorLocker: public MutexLocker {
|
||||
Mutex::SafepointCheckFlag _flag;
|
||||
public:
|
||||
MonitorLockerEx(Monitor* monitor,
|
||||
bool no_safepoint_check = !Mutex::_no_safepoint_check_flag):
|
||||
MutexLockerEx(monitor, no_safepoint_check),
|
||||
_monitor(monitor) {
|
||||
MonitorLocker(Monitor* monitor, Mutex::SafepointCheckFlag flag = Mutex::_safepoint_check_flag) :
|
||||
MutexLocker(monitor, flag), _flag(flag) {
|
||||
// Superclass constructor did locking
|
||||
}
|
||||
|
||||
~MonitorLockerEx() {
|
||||
#ifdef ASSERT
|
||||
if (_monitor != NULL) {
|
||||
assert_lock_strong(_monitor);
|
||||
}
|
||||
#endif // ASSERT
|
||||
// Superclass destructor will do unlocking
|
||||
MonitorLocker(Monitor* monitor, Thread* thread, Mutex::SafepointCheckFlag flag = Mutex::_safepoint_check_flag) :
|
||||
MutexLocker(monitor, thread, flag), _flag(flag) {
|
||||
// Superclass constructor did locking
|
||||
}
|
||||
|
||||
bool wait(bool no_safepoint_check = !Mutex::_no_safepoint_check_flag,
|
||||
long timeout = 0,
|
||||
bool wait(long timeout = 0,
|
||||
bool as_suspend_equivalent = !Mutex::_as_suspend_equivalent_flag) {
|
||||
if (_monitor != NULL) {
|
||||
return _monitor->wait(no_safepoint_check, timeout, as_suspend_equivalent);
|
||||
if (_mutex != NULL) {
|
||||
if (_flag == Mutex::_safepoint_check_flag) {
|
||||
return _mutex->wait(timeout, as_suspend_equivalent);
|
||||
} else {
|
||||
return _mutex->wait_without_safepoint_check(timeout);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void notify_all() {
|
||||
if (_monitor != NULL) {
|
||||
_monitor->notify_all();
|
||||
if (_mutex != NULL) {
|
||||
_mutex->notify_all();
|
||||
}
|
||||
}
|
||||
|
||||
void notify() {
|
||||
if (_monitor != NULL) {
|
||||
_monitor->notify();
|
||||
if (_mutex != NULL) {
|
||||
_mutex->notify();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// A GCMutexLocker is usually initialized with a mutex that is
|
||||
// automatically acquired in order to do GC. The function that
|
||||
// synchronizes using a GCMutexLocker may be called both during and between
|
||||
@ -297,50 +277,30 @@ class MonitorLockerEx: public MutexLockerEx {
|
||||
|
||||
class GCMutexLocker: public StackObj {
|
||||
private:
|
||||
Monitor * _mutex;
|
||||
Monitor* _mutex;
|
||||
bool _locked;
|
||||
public:
|
||||
GCMutexLocker(Monitor * mutex);
|
||||
GCMutexLocker(Monitor* mutex);
|
||||
~GCMutexLocker() { if (_locked) _mutex->unlock(); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
// A MutexUnlocker temporarily exits a previously
|
||||
// entered mutex for the scope which contains the unlocker.
|
||||
|
||||
class MutexUnlocker: StackObj {
|
||||
private:
|
||||
Monitor * _mutex;
|
||||
Monitor* _mutex;
|
||||
bool _no_safepoint_check;
|
||||
|
||||
public:
|
||||
MutexUnlocker(Monitor * mutex) {
|
||||
_mutex = mutex;
|
||||
MutexUnlocker(Monitor* mutex, Mutex::SafepointCheckFlag flag = Mutex::_safepoint_check_flag) :
|
||||
_mutex(mutex),
|
||||
_no_safepoint_check(flag) {
|
||||
_mutex->unlock();
|
||||
}
|
||||
|
||||
~MutexUnlocker() {
|
||||
_mutex->lock();
|
||||
}
|
||||
};
|
||||
|
||||
// A MutexUnlockerEx temporarily exits a previously
|
||||
// entered mutex for the scope which contains the unlocker.
|
||||
|
||||
class MutexUnlockerEx: StackObj {
|
||||
private:
|
||||
Monitor * _mutex;
|
||||
bool _no_safepoint_check;
|
||||
|
||||
public:
|
||||
MutexUnlockerEx(Monitor * mutex, bool no_safepoint_check = !Mutex::_no_safepoint_check_flag) {
|
||||
_mutex = mutex;
|
||||
_no_safepoint_check = no_safepoint_check;
|
||||
_mutex->unlock();
|
||||
}
|
||||
|
||||
~MutexUnlockerEx() {
|
||||
if (_no_safepoint_check == Mutex::_no_safepoint_check_flag) {
|
||||
if (_no_safepoint_check) {
|
||||
_mutex->lock_without_safepoint_check();
|
||||
} else {
|
||||
_mutex->lock();
|
||||
|
@ -858,7 +858,7 @@ int os::random() {
|
||||
|
||||
void os::start_thread(Thread* thread) {
|
||||
// guard suspend/resume
|
||||
MutexLockerEx ml(thread->SR_lock(), Mutex::_no_safepoint_check_flag);
|
||||
MutexLocker ml(thread->SR_lock(), Mutex::_no_safepoint_check_flag);
|
||||
OSThread* osthread = thread->osthread();
|
||||
osthread->set_state(RUNNABLE);
|
||||
pd_start_thread(thread);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user