src/hotspot/share/runtime/serviceThread.cpp
author chegar
Thu, 17 Oct 2019 20:54:25 +0100
branchdatagramsocketimpl-branch
changeset 58679 9c3209ff7550
parent 58678 9cf78a70fa4f
parent 58504 94dd00d2da29
permissions -rw-r--r--
datagramsocketimpl-branch: merge with default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8110
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
     1
/*
53582
881c5fbeb849 8218041: Assorted wrong/missing includes
rehn
parents: 52421
diff changeset
     2
 * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
8110
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
     4
 *
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
     7
 * published by the Free Software Foundation.
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
     8
 *
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    13
 * accompanied this code).
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    14
 *
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    18
 *
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    21
 * questions.
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    22
 *
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    23
 */
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    24
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    25
#include "precompiled.hpp"
51610
cdef4df6b0e7 8206424: Use locking for cleaning ProtectionDomainTable
pchilanomate
parents: 51472
diff changeset
    26
#include "classfile/protectionDomainCache.hpp"
50445
bd6b78feb6a3 8195097: Make it possible to process StringTable outside safepoint
rehn
parents: 50217
diff changeset
    27
#include "classfile/stringTable.hpp"
51405
8b23aa7cef47 8195100: Use a low latency hashtable for SymbolTable
gziemski
parents: 50445
diff changeset
    28
#include "classfile/symbolTable.hpp"
51610
cdef4df6b0e7 8206424: Use locking for cleaning ProtectionDomainTable
pchilanomate
parents: 51472
diff changeset
    29
#include "classfile/systemDictionary.hpp"
57828
35db8fba55f9 8227054: ServiceThread needs to know about all OopStorage objects
kbarrett
parents: 55740
diff changeset
    30
#include "gc/shared/oopStorage.hpp"
35db8fba55f9 8227054: ServiceThread needs to know about all OopStorage objects
kbarrett
parents: 55740
diff changeset
    31
#include "gc/shared/oopStorageSet.hpp"
54786
ebf733a324d4 8223624: Cleanup includes of universe.hpp
stefank
parents: 54623
diff changeset
    32
#include "memory/universe.hpp"
53582
881c5fbeb849 8218041: Assorted wrong/missing includes
rehn
parents: 52421
diff changeset
    33
#include "runtime/handles.inline.hpp"
49449
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 49054
diff changeset
    34
#include "runtime/interfaceSupport.inline.hpp"
8110
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    35
#include "runtime/javaCalls.hpp"
52421
3021c1ad958b 8210986: Add OopStorage cleanup to ServiceThread
kbarrett
parents: 51813
diff changeset
    36
#include "runtime/jniHandles.hpp"
8110
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    37
#include "runtime/serviceThread.hpp"
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    38
#include "runtime/mutexLocker.hpp"
22758
c6b6abb73544 7182040: volano29 limited by os resource on Linux - need better diagnostic message
iklam
parents: 17296
diff changeset
    39
#include "runtime/os.hpp"
8110
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    40
#include "prims/jvmtiImpl.hpp"
51472
eb97d1a319f9 8206423: Use locking for cleaning ResolvedMethodTable
pchilanomate
parents: 51405
diff changeset
    41
#include "prims/resolvedMethodTable.hpp"
17296
68557efd8583 8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents: 9623
diff changeset
    42
#include "services/diagnosticArgument.hpp"
68557efd8583 8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents: 9623
diff changeset
    43
#include "services/diagnosticFramework.hpp"
29081
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents: 26843
diff changeset
    44
#include "services/gcNotifier.hpp"
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents: 26843
diff changeset
    45
#include "services/lowMemoryDetector.hpp"
58504
94dd00d2da29 8231666: ThreadIdTable::grow() invokes invalid thread transition
dtitov
parents: 58503
diff changeset
    46
#include "services/threadIdTable.hpp"
8110
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    47
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    48
ServiceThread* ServiceThread::_instance = NULL;
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    49
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    50
void ServiceThread::initialize() {
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    51
  EXCEPTION_MARK;
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    52
25057
f38210f84f8c 8031819: Remove legacy jdk checks and code
hseigel
parents: 22758
diff changeset
    53
  const char* name = "Service Thread";
8110
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    54
  Handle string = java_lang_String::create_from_str(name, CHECK);
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    55
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    56
  // Initialize thread_oop to put it into the system threadGroup
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    57
  Handle thread_group (THREAD, Universe::system_thread_group());
50217
843fc56f4686 8203381: Replace InstanceKlass::allocate_instance_handle with JavaCalls::construct_new_instance
iklam
parents: 49449
diff changeset
    58
  Handle thread_oop = JavaCalls::construct_new_instance(
843fc56f4686 8203381: Replace InstanceKlass::allocate_instance_handle with JavaCalls::construct_new_instance
iklam
parents: 49449
diff changeset
    59
                          SystemDictionary::Thread_klass(),
8110
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    60
                          vmSymbols::threadgroup_string_void_signature(),
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    61
                          thread_group,
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    62
                          string,
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    63
                          CHECK);
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    64
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    65
  {
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    66
    MutexLocker mu(Threads_lock);
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    67
    ServiceThread* thread =  new ServiceThread(&service_thread_entry);
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    68
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    69
    // At this point it may be possible that no osthread was created for the
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    70
    // JavaThread due to lack of memory. We would have to throw an exception
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    71
    // in that case. However, since this must work and we do not allow
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    72
    // exceptions anyway, check and abort if this fails.
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    73
    if (thread == NULL || thread->osthread() == NULL) {
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    74
      vm_exit_during_initialization("java.lang.OutOfMemoryError",
22758
c6b6abb73544 7182040: volano29 limited by os resource on Linux - need better diagnostic message
iklam
parents: 17296
diff changeset
    75
                                    os::native_thread_creation_failed_msg());
8110
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    76
    }
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    77
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    78
    java_lang_Thread::set_thread(thread_oop(), thread);
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    79
    java_lang_Thread::set_priority(thread_oop(), NearMaxPriority);
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    80
    java_lang_Thread::set_daemon(thread_oop());
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    81
    thread->set_threadObj(thread_oop());
8660
de3c4dedef24 7024234: 2/3 jvmti tests fail assert(!_oops_are_stale) failed: oops are stale on Win-AMD64
dcubed
parents: 8110
diff changeset
    82
    _instance = thread;
8110
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    83
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    84
    Threads::add(thread);
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    85
    Thread::start(thread);
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    86
  }
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    87
}
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    88
57828
35db8fba55f9 8227054: ServiceThread needs to know about all OopStorage objects
kbarrett
parents: 55740
diff changeset
    89
static void cleanup_oopstorages() {
35db8fba55f9 8227054: ServiceThread needs to know about all OopStorage objects
kbarrett
parents: 55740
diff changeset
    90
  OopStorageSet::Iterator it = OopStorageSet::all_iterator();
35db8fba55f9 8227054: ServiceThread needs to know about all OopStorage objects
kbarrett
parents: 55740
diff changeset
    91
  for ( ; !it.is_end(); ++it) {
35db8fba55f9 8227054: ServiceThread needs to know about all OopStorage objects
kbarrett
parents: 55740
diff changeset
    92
    it->delete_empty_blocks();
52421
3021c1ad958b 8210986: Add OopStorage cleanup to ServiceThread
kbarrett
parents: 51813
diff changeset
    93
  }
3021c1ad958b 8210986: Add OopStorage cleanup to ServiceThread
kbarrett
parents: 51813
diff changeset
    94
}
3021c1ad958b 8210986: Add OopStorage cleanup to ServiceThread
kbarrett
parents: 51813
diff changeset
    95
8110
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    96
void ServiceThread::service_thread_entry(JavaThread* jt, TRAPS) {
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    97
  while (true) {
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    98
    bool sensors_changed = false;
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
    99
    bool has_jvmti_events = false;
9623
151c0b638488 7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents: 8660
diff changeset
   100
    bool has_gc_notification_event = false;
17296
68557efd8583 8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents: 9623
diff changeset
   101
    bool has_dcmd_notification_event = false;
50445
bd6b78feb6a3 8195097: Make it possible to process StringTable outside safepoint
rehn
parents: 50217
diff changeset
   102
    bool stringtable_work = false;
51405
8b23aa7cef47 8195100: Use a low latency hashtable for SymbolTable
gziemski
parents: 50445
diff changeset
   103
    bool symboltable_work = false;
51472
eb97d1a319f9 8206423: Use locking for cleaning ResolvedMethodTable
pchilanomate
parents: 51405
diff changeset
   104
    bool resolved_method_table_work = false;
58504
94dd00d2da29 8231666: ThreadIdTable::grow() invokes invalid thread transition
dtitov
parents: 58503
diff changeset
   105
    bool thread_id_table_work = false;
51610
cdef4df6b0e7 8206424: Use locking for cleaning ProtectionDomainTable
pchilanomate
parents: 51472
diff changeset
   106
    bool protection_domain_table_work = false;
52421
3021c1ad958b 8210986: Add OopStorage cleanup to ServiceThread
kbarrett
parents: 51813
diff changeset
   107
    bool oopstorage_work = false;
8110
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   108
    JvmtiDeferredEvent jvmti_event;
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   109
    {
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   110
      // Need state transition ThreadBlockInVM so that this thread
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   111
      // will be handled by safepoint correctly when this thread is
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   112
      // notified at a safepoint.
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   113
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   114
      // This ThreadBlockInVM object is not also considered to be
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   115
      // suspend-equivalent because ServiceThread is not visible to
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   116
      // external suspension.
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   117
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   118
      ThreadBlockInVM tbivm(jt);
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   119
54623
1126f0607c70 8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents: 54511
diff changeset
   120
      MonitorLocker ml(Service_lock, Mutex::_no_safepoint_check_flag);
51813
cfa50d6a6fba 8210889: Some service thread cleanups can be starved
kbarrett
parents: 51610
diff changeset
   121
      // Process all available work on each (outer) iteration, rather than
cfa50d6a6fba 8210889: Some service thread cleanups can be starved
kbarrett
parents: 51610
diff changeset
   122
      // only the first recognized bit of work, to avoid frequently true early
cfa50d6a6fba 8210889: Some service thread cleanups can be starved
kbarrett
parents: 51610
diff changeset
   123
      // tests from potentially starving later work.  Hence the use of
cfa50d6a6fba 8210889: Some service thread cleanups can be starved
kbarrett
parents: 51610
diff changeset
   124
      // arithmetic-or to combine results; we don't want short-circuiting.
58503
726a3945e934 8170299: Debugger does not stop inside the low memory notifications code
dtitov
parents: 57906
diff changeset
   125
      while (((sensors_changed = (!UseNotificationThread && LowMemoryDetector::has_pending_requests())) |
51813
cfa50d6a6fba 8210889: Some service thread cleanups can be starved
kbarrett
parents: 51610
diff changeset
   126
              (has_jvmti_events = JvmtiDeferredEventQueue::has_events()) |
58503
726a3945e934 8170299: Debugger does not stop inside the low memory notifications code
dtitov
parents: 57906
diff changeset
   127
              (has_gc_notification_event = (!UseNotificationThread && GCNotifier::has_event())) |
726a3945e934 8170299: Debugger does not stop inside the low memory notifications code
dtitov
parents: 57906
diff changeset
   128
              (has_dcmd_notification_event = (!UseNotificationThread && DCmdFactory::has_pending_jmx_notification())) |
51813
cfa50d6a6fba 8210889: Some service thread cleanups can be starved
kbarrett
parents: 51610
diff changeset
   129
              (stringtable_work = StringTable::has_work()) |
cfa50d6a6fba 8210889: Some service thread cleanups can be starved
kbarrett
parents: 51610
diff changeset
   130
              (symboltable_work = SymbolTable::has_work()) |
cfa50d6a6fba 8210889: Some service thread cleanups can be starved
kbarrett
parents: 51610
diff changeset
   131
              (resolved_method_table_work = ResolvedMethodTable::has_work()) |
58504
94dd00d2da29 8231666: ThreadIdTable::grow() invokes invalid thread transition
dtitov
parents: 58503
diff changeset
   132
              (thread_id_table_work = ThreadIdTable::has_work()) |
52421
3021c1ad958b 8210986: Add OopStorage cleanup to ServiceThread
kbarrett
parents: 51813
diff changeset
   133
              (protection_domain_table_work = SystemDictionary::pd_cache_table()->has_work()) |
57906
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57828
diff changeset
   134
              (oopstorage_work = OopStorage::has_cleanup_work_and_reset())
e17f768b3b71 8230184: rename, whitespace, indent and comments changes in preparation for lock free Monitor lists
dcubed
parents: 57828
diff changeset
   135
             ) == 0) {
51813
cfa50d6a6fba 8210889: Some service thread cleanups can be starved
kbarrett
parents: 51610
diff changeset
   136
        // Wait until notified that there is some work to do.
54623
1126f0607c70 8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents: 54511
diff changeset
   137
        ml.wait();
8110
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   138
      }
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   139
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   140
      if (has_jvmti_events) {
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   141
        jvmti_event = JvmtiDeferredEventQueue::dequeue();
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   142
      }
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   143
    }
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   144
50445
bd6b78feb6a3 8195097: Make it possible to process StringTable outside safepoint
rehn
parents: 50217
diff changeset
   145
    if (stringtable_work) {
bd6b78feb6a3 8195097: Make it possible to process StringTable outside safepoint
rehn
parents: 50217
diff changeset
   146
      StringTable::do_concurrent_work(jt);
bd6b78feb6a3 8195097: Make it possible to process StringTable outside safepoint
rehn
parents: 50217
diff changeset
   147
    }
bd6b78feb6a3 8195097: Make it possible to process StringTable outside safepoint
rehn
parents: 50217
diff changeset
   148
51405
8b23aa7cef47 8195100: Use a low latency hashtable for SymbolTable
gziemski
parents: 50445
diff changeset
   149
    if (symboltable_work) {
8b23aa7cef47 8195100: Use a low latency hashtable for SymbolTable
gziemski
parents: 50445
diff changeset
   150
      SymbolTable::do_concurrent_work(jt);
8b23aa7cef47 8195100: Use a low latency hashtable for SymbolTable
gziemski
parents: 50445
diff changeset
   151
    }
8b23aa7cef47 8195100: Use a low latency hashtable for SymbolTable
gziemski
parents: 50445
diff changeset
   152
8110
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   153
    if (has_jvmti_events) {
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   154
      jvmti_event.post();
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   155
    }
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   156
58503
726a3945e934 8170299: Debugger does not stop inside the low memory notifications code
dtitov
parents: 57906
diff changeset
   157
    if (!UseNotificationThread) {
726a3945e934 8170299: Debugger does not stop inside the low memory notifications code
dtitov
parents: 57906
diff changeset
   158
      if (sensors_changed) {
726a3945e934 8170299: Debugger does not stop inside the low memory notifications code
dtitov
parents: 57906
diff changeset
   159
        LowMemoryDetector::process_sensor_changes(jt);
726a3945e934 8170299: Debugger does not stop inside the low memory notifications code
dtitov
parents: 57906
diff changeset
   160
      }
9623
151c0b638488 7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
fparain
parents: 8660
diff changeset
   161
58503
726a3945e934 8170299: Debugger does not stop inside the low memory notifications code
dtitov
parents: 57906
diff changeset
   162
      if(has_gc_notification_event) {
726a3945e934 8170299: Debugger does not stop inside the low memory notifications code
dtitov
parents: 57906
diff changeset
   163
        GCNotifier::sendNotification(CHECK);
726a3945e934 8170299: Debugger does not stop inside the low memory notifications code
dtitov
parents: 57906
diff changeset
   164
      }
17296
68557efd8583 8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents: 9623
diff changeset
   165
58503
726a3945e934 8170299: Debugger does not stop inside the low memory notifications code
dtitov
parents: 57906
diff changeset
   166
      if(has_dcmd_notification_event) {
726a3945e934 8170299: Debugger does not stop inside the low memory notifications code
dtitov
parents: 57906
diff changeset
   167
        DCmdFactory::send_notification(CHECK);
726a3945e934 8170299: Debugger does not stop inside the low memory notifications code
dtitov
parents: 57906
diff changeset
   168
      }
17296
68557efd8583 8004095: Add support for JMX interface to Diagnostic Framework and Commands
fparain
parents: 9623
diff changeset
   169
    }
51472
eb97d1a319f9 8206423: Use locking for cleaning ResolvedMethodTable
pchilanomate
parents: 51405
diff changeset
   170
eb97d1a319f9 8206423: Use locking for cleaning ResolvedMethodTable
pchilanomate
parents: 51405
diff changeset
   171
    if (resolved_method_table_work) {
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53582
diff changeset
   172
      ResolvedMethodTable::do_concurrent_work(jt);
51472
eb97d1a319f9 8206423: Use locking for cleaning ResolvedMethodTable
pchilanomate
parents: 51405
diff changeset
   173
    }
51610
cdef4df6b0e7 8206424: Use locking for cleaning ProtectionDomainTable
pchilanomate
parents: 51472
diff changeset
   174
58504
94dd00d2da29 8231666: ThreadIdTable::grow() invokes invalid thread transition
dtitov
parents: 58503
diff changeset
   175
    if (thread_id_table_work) {
94dd00d2da29 8231666: ThreadIdTable::grow() invokes invalid thread transition
dtitov
parents: 58503
diff changeset
   176
      ThreadIdTable::do_concurrent_work(jt);
94dd00d2da29 8231666: ThreadIdTable::grow() invokes invalid thread transition
dtitov
parents: 58503
diff changeset
   177
    }
94dd00d2da29 8231666: ThreadIdTable::grow() invokes invalid thread transition
dtitov
parents: 58503
diff changeset
   178
51610
cdef4df6b0e7 8206424: Use locking for cleaning ProtectionDomainTable
pchilanomate
parents: 51472
diff changeset
   179
    if (protection_domain_table_work) {
cdef4df6b0e7 8206424: Use locking for cleaning ProtectionDomainTable
pchilanomate
parents: 51472
diff changeset
   180
      SystemDictionary::pd_cache_table()->unlink();
cdef4df6b0e7 8206424: Use locking for cleaning ProtectionDomainTable
pchilanomate
parents: 51472
diff changeset
   181
    }
52421
3021c1ad958b 8210986: Add OopStorage cleanup to ServiceThread
kbarrett
parents: 51813
diff changeset
   182
3021c1ad958b 8210986: Add OopStorage cleanup to ServiceThread
kbarrett
parents: 51813
diff changeset
   183
    if (oopstorage_work) {
57828
35db8fba55f9 8227054: ServiceThread needs to know about all OopStorage objects
kbarrett
parents: 55740
diff changeset
   184
      cleanup_oopstorages();
52421
3021c1ad958b 8210986: Add OopStorage cleanup to ServiceThread
kbarrett
parents: 51813
diff changeset
   185
    }
8110
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   186
  }
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   187
}
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   188
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   189
bool ServiceThread::is_service_thread(Thread* thread) {
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   190
  return thread == _instance;
c992c8d52344 6766644: Redefinition of compiled method fails with assertion "Can not load classes with the Compiler thread"
kamg
parents:
diff changeset
   191
}