Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp
38921 views
/*1* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_CONCURRENTGCTHREAD_HPP25#define SHARE_VM_GC_IMPLEMENTATION_SHARED_CONCURRENTGCTHREAD_HPP2627#include "utilities/macros.hpp"28#include "gc_implementation/shared/suspendibleThreadSet.hpp"29#include "runtime/thread.hpp"3031class ConcurrentGCThread: public NamedThread {32friend class VMStructs;3334protected:35bool _should_terminate;36bool _has_terminated;3738enum CGC_flag_type {39CGC_nil = 0x0,40CGC_dont_suspend = 0x1,41CGC_CGC_safepoint = 0x2,42CGC_VM_safepoint = 0x443};4445static int _CGC_flag;4647static bool CGC_flag_is_set(int b) { return (_CGC_flag & b) != 0; }48static int set_CGC_flag(int b) { return _CGC_flag |= b; }49static int reset_CGC_flag(int b) { return _CGC_flag &= ~b; }5051// Create and start the thread (setting it's priority high.)52void create_and_start();5354// Do initialization steps in the thread: record stack base and size,55// init thread local storage, set JNI handle block.56void initialize_in_thread();5758// Wait until Universe::is_fully_initialized();59void wait_for_universe_init();6061// Record that the current thread is terminating, and will do more62// concurrent work.63void terminate();6465public:66// Constructor6768ConcurrentGCThread();69~ConcurrentGCThread() {} // Exists to call NamedThread destructor.7071// Tester72bool is_ConcurrentGC_thread() const { return true; }73};7475// The SurrogateLockerThread is used by concurrent GC threads for76// manipulating Java monitors, in particular, currently for77// manipulating the pending_list_lock. XXX78class SurrogateLockerThread: public JavaThread {79friend class VMStructs;80public:81enum SLT_msg_type {82empty = 0, // no message83acquirePLL, // acquire pending list lock84releaseAndNotifyPLL // notify and release pending list lock85};86private:87// the following are shared with the CMSThread88SLT_msg_type _buffer; // communication buffer89Monitor _monitor; // monitor controlling buffer90BasicLock _basicLock; // used for PLL locking9192public:93static SurrogateLockerThread* make(TRAPS);9495// Terminate VM with error message that SLT needed but not yet created.96static void report_missing_slt();9798SurrogateLockerThread();99100bool is_hidden_from_external_view() const { return true; }101102void loop(); // main method103104void manipulatePLL(SLT_msg_type msg);105106};107108#endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_CONCURRENTGCTHREAD_HPP109110111