< prev index next >

src/hotspot/share/gc/g1/concurrentMarkThread.cpp

Print this page


   1 /*
   2  * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 250 void ConcurrentMarkThread::run_service() {
 251   _vtime_start = os::elapsedVTime();
 252 
 253   G1CollectedHeap* g1h = G1CollectedHeap::heap();
 254   G1Policy* g1_policy = g1h->g1_policy();
 255 
 256   G1ConcPhaseManager cpmanager(G1ConcurrentPhase::IDLE, this);
 257 
 258   while (!should_terminate()) {
 259     // wait until started is set.
 260     sleepBeforeNextCycle();
 261     if (should_terminate()) {
 262       break;
 263     }
 264 
 265     cpmanager.set_phase(G1ConcurrentPhase::CONCURRENT_CYCLE, false /* force */);
 266 
 267     GCIdMark gc_id_mark;
 268 
 269     cm()->concurrent_cycle_start();
 270 
 271     assert(GCId::current() != GCId::undefined(), "GC id should have been set up by the initial mark GC.");
 272 
 273     GCTraceConcTime(Info, gc) tt("Concurrent Cycle");
 274     {
 275       ResourceMark rm;
 276       HandleMark   hm;
 277       double cycle_start = os::elapsedVTime();
 278 
 279       {
 280         G1ConcPhase p(G1ConcurrentPhase::CLEAR_CLAIMED_MARKS, this);
 281         ClassLoaderDataGraph::clear_claimed_marks();
 282       }
 283 
 284       // We have to ensure that we finish scanning the root regions
 285       // before the next GC takes place. To ensure this we have to
 286       // make sure that we do not join the STS until the root regions
 287       // have been scanned. If we did then it's possible that a
 288       // subsequent GC could block us from joining the STS and proceed
 289       // without the root regions have been scanned which would be a
 290       // correctness issue.
 291 


   1 /*
   2  * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 250 void ConcurrentMarkThread::run_service() {
 251   _vtime_start = os::elapsedVTime();
 252 
 253   G1CollectedHeap* g1h = G1CollectedHeap::heap();
 254   G1Policy* g1_policy = g1h->g1_policy();
 255 
 256   G1ConcPhaseManager cpmanager(G1ConcurrentPhase::IDLE, this);
 257 
 258   while (!should_terminate()) {
 259     // wait until started is set.
 260     sleepBeforeNextCycle();
 261     if (should_terminate()) {
 262       break;
 263     }
 264 
 265     cpmanager.set_phase(G1ConcurrentPhase::CONCURRENT_CYCLE, false /* force */);
 266 
 267     GCIdMark gc_id_mark;
 268 
 269     cm()->concurrent_cycle_start();


 270 
 271     GCTraceConcTime(Info, gc) tt("Concurrent Cycle");
 272     {
 273       ResourceMark rm;
 274       HandleMark   hm;
 275       double cycle_start = os::elapsedVTime();
 276 
 277       {
 278         G1ConcPhase p(G1ConcurrentPhase::CLEAR_CLAIMED_MARKS, this);
 279         ClassLoaderDataGraph::clear_claimed_marks();
 280       }
 281 
 282       // We have to ensure that we finish scanning the root regions
 283       // before the next GC takes place. To ensure this we have to
 284       // make sure that we do not join the STS until the root regions
 285       // have been scanned. If we did then it's possible that a
 286       // subsequent GC could block us from joining the STS and proceed
 287       // without the root regions have been scanned which would be a
 288       // correctness issue.
 289 


< prev index next >