< prev index next >

src/hotspot/share/gc/g1/g1ConcurrentMark.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  *


 994   // Parallel task terminator is set in "set_concurrency_and_phase()"
 995   set_concurrency_and_phase(active_workers, true /* concurrent */);
 996 
 997   G1CMConcurrentMarkingTask marking_task(this, cm_thread());
 998   _concurrent_workers->run_task(&marking_task);
 999   print_stats();
1000 }
1001 
1002 void G1ConcurrentMark::checkpoint_roots_final(bool clear_all_soft_refs) {
1003   // world is stopped at this checkpoint
1004   assert(SafepointSynchronize::is_at_safepoint(),
1005          "world should be stopped");
1006 
1007   G1CollectedHeap* g1h = G1CollectedHeap::heap();
1008 
1009   // If a full collection has happened, we shouldn't do this.
1010   if (has_aborted()) {
1011     g1h->collector_state()->set_mark_in_progress(false); // So bitmap clearing isn't confused
1012     return;
1013   }
1014 
1015   SvcGCMarker sgcm(SvcGCMarker::OTHER);
1016 
1017   if (VerifyDuringGC) {
1018     g1h->verifier()->verify(G1HeapVerifier::G1VerifyRemark, VerifyOption_G1UsePrevMarking, "During GC (before)");
1019   }
1020   g1h->verifier()->check_bitmaps("Remark Start");
1021 
1022   G1Policy* g1p = g1h->g1_policy();
1023   g1p->record_concurrent_mark_remark_start();
1024 
1025   double start = os::elapsedTime();
1026 
1027   checkpoint_roots_final_work();
1028 
1029   double mark_work_end = os::elapsedTime();
1030 
1031   weak_refs_work(clear_all_soft_refs);
1032 
1033   if (has_overflown()) {
1034     // We overflowed.  Restart concurrent marking.
1035     _restart_for_overflow = true;


   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  *


 994   // Parallel task terminator is set in "set_concurrency_and_phase()"
 995   set_concurrency_and_phase(active_workers, true /* concurrent */);
 996 
 997   G1CMConcurrentMarkingTask marking_task(this, cm_thread());
 998   _concurrent_workers->run_task(&marking_task);
 999   print_stats();
1000 }
1001 
1002 void G1ConcurrentMark::checkpoint_roots_final(bool clear_all_soft_refs) {
1003   // world is stopped at this checkpoint
1004   assert(SafepointSynchronize::is_at_safepoint(),
1005          "world should be stopped");
1006 
1007   G1CollectedHeap* g1h = G1CollectedHeap::heap();
1008 
1009   // If a full collection has happened, we shouldn't do this.
1010   if (has_aborted()) {
1011     g1h->collector_state()->set_mark_in_progress(false); // So bitmap clearing isn't confused
1012     return;
1013   }


1014 
1015   if (VerifyDuringGC) {
1016     g1h->verifier()->verify(G1HeapVerifier::G1VerifyRemark, VerifyOption_G1UsePrevMarking, "During GC (before)");
1017   }
1018   g1h->verifier()->check_bitmaps("Remark Start");
1019 
1020   G1Policy* g1p = g1h->g1_policy();
1021   g1p->record_concurrent_mark_remark_start();
1022 
1023   double start = os::elapsedTime();
1024 
1025   checkpoint_roots_final_work();
1026 
1027   double mark_work_end = os::elapsedTime();
1028 
1029   weak_refs_work(clear_all_soft_refs);
1030 
1031   if (has_overflown()) {
1032     // We overflowed.  Restart concurrent marking.
1033     _restart_for_overflow = true;


< prev index next >