< prev index next >

src/hotspot/share/gc/cms/cmsHeap.cpp

Print this page
rev 47864 : 8191564: Refactor GC related servicability code into GC specific subclasses


   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/cms/concurrentMarkSweepThread.hpp"

  27 #include "gc/cms/cmsHeap.hpp"
  28 #include "gc/cms/vmCMSOperations.hpp"
  29 #include "gc/shared/genOopClosures.inline.hpp"
  30 #include "gc/shared/strongRootsScope.hpp"
  31 #include "gc/shared/workgroup.hpp"
  32 #include "oops/oop.inline.hpp"
  33 #include "runtime/vmThread.hpp"
  34 #include "utilities/stack.inline.hpp"
  35 
  36 CMSHeap::CMSHeap(GenCollectorPolicy *policy) : GenCollectedHeap(policy) {
  37   _workers = new WorkGang("GC Thread", ParallelGCThreads,
  38                           /* are_GC_task_threads */true,
  39                           /* are_ConcurrentGC_threads */false);
  40   _workers->initialize_workers();
  41 }
  42 
  43 jint CMSHeap::initialize() {
  44   jint status = GenCollectedHeap::initialize();
  45   if (status != JNI_OK) return status;
  46 


 166 
 167   if (young_gen_as_roots &&
 168       !_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) {
 169     root_closure->set_generation(young_gen());
 170     young_gen()->oop_iterate(root_closure);
 171     root_closure->reset_generation();
 172   }
 173 
 174   _process_strong_tasks->all_tasks_completed(scope->n_threads());
 175 }
 176 
 177 void CMSHeap::gc_prologue(bool full) {
 178   always_do_update_barrier = false;
 179   GenCollectedHeap::gc_prologue(full);
 180 };
 181 
 182 void CMSHeap::gc_epilogue(bool full) {
 183   GenCollectedHeap::gc_epilogue(full);
 184   always_do_update_barrier = true;
 185 };






   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "gc/cms/concurrentMarkSweepThread.hpp"
  27 #include "gc/cms/cmsGCServicabilitySupport.hpp"
  28 #include "gc/cms/cmsHeap.hpp"
  29 #include "gc/cms/vmCMSOperations.hpp"
  30 #include "gc/shared/genOopClosures.inline.hpp"
  31 #include "gc/shared/strongRootsScope.hpp"
  32 #include "gc/shared/workgroup.hpp"
  33 #include "oops/oop.inline.hpp"
  34 #include "runtime/vmThread.hpp"
  35 #include "utilities/stack.inline.hpp"
  36 
  37 CMSHeap::CMSHeap(GenCollectorPolicy *policy) : GenCollectedHeap(policy) {
  38   _workers = new WorkGang("GC Thread", ParallelGCThreads,
  39                           /* are_GC_task_threads */true,
  40                           /* are_ConcurrentGC_threads */false);
  41   _workers->initialize_workers();
  42 }
  43 
  44 jint CMSHeap::initialize() {
  45   jint status = GenCollectedHeap::initialize();
  46   if (status != JNI_OK) return status;
  47 


 167 
 168   if (young_gen_as_roots &&
 169       !_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) {
 170     root_closure->set_generation(young_gen());
 171     young_gen()->oop_iterate(root_closure);
 172     root_closure->reset_generation();
 173   }
 174 
 175   _process_strong_tasks->all_tasks_completed(scope->n_threads());
 176 }
 177 
 178 void CMSHeap::gc_prologue(bool full) {
 179   always_do_update_barrier = false;
 180   GenCollectedHeap::gc_prologue(full);
 181 };
 182 
 183 void CMSHeap::gc_epilogue(bool full) {
 184   GenCollectedHeap::gc_epilogue(full);
 185   always_do_update_barrier = true;
 186 };
 187 
 188 GCServicabilitySupport* CMSHeap::create_servicability_support() {
 189   return new CMSGCServicabilitySupport();
 190 }
< prev index next >