< prev index next >
src/share/vm/gc/cms/concurrentMarkSweepThread.hpp
Print this page
rev 10297 : [mq]: webrev.01
rev 10298 : [mq]: webrev.02
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2016, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -35,22 +35,18 @@
// The Concurrent Mark Sweep GC Thread
class ConcurrentMarkSweepThread: public ConcurrentGCThread {
friend class VMStructs;
friend class ConcurrentMarkSweepGeneration; // XXX should remove friendship
friend class CMSCollector;
- public:
- virtual void run();
private:
static ConcurrentMarkSweepThread* _cmst;
static CMSCollector* _collector;
static SurrogateLockerThread* _slt;
static SurrogateLockerThread::SLT_msg_type _sltBuffer;
static Monitor* _sltMonitor;
- static bool _should_terminate;
-
enum CMS_flag_type {
CMS_nil = NoBits,
CMS_cms_wants_token = nth_bit(0),
CMS_cms_has_token = nth_bit(1),
CMS_vm_wants_token = nth_bit(2),
@@ -70,10 +66,13 @@
static char _pad_2[64 - sizeof(jint)]; // prevent cache-line sharing
// debugging
void verify_ok_to_terminate() const PRODUCT_RETURN;
+ void run_service();
+ void stop_service();
+
public:
// Constructor
ConcurrentMarkSweepThread(CMSCollector* collector);
static void makeSurrogateLockerThread(TRAPS);
@@ -84,17 +83,23 @@
// Printing
static void print_all_on(outputStream* st);
static void print_all() { print_all_on(tty); }
// Returns the CMS Thread
- static ConcurrentMarkSweepThread* cmst() { return _cmst; }
+ inline static ConcurrentMarkSweepThread* cmst() {
+ if (_cmst != NULL && !_cmst->_has_terminated) {
+ return _cmst;
+ }
+ return NULL;
+ }
+
static CMSCollector* collector() { return _collector; }
// Create and start the CMS Thread, or stop it on shutdown
static ConcurrentMarkSweepThread* start(CMSCollector* collector);
- static void stop();
- static bool should_terminate() { return _should_terminate; }
+ static void stop_all();
+ static bool should_terminate() { return _cmst != NULL && _cmst->_should_terminate; }
// Synchronization using CMS token
static void synchronize(bool is_cms_thread);
static void desynchronize(bool is_cms_thread);
static bool vm_thread_has_cms_token() {
< prev index next >