src/share/vm/gc/shared/genCollectedHeap.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/gc/shared

src/share/vm/gc/shared/genCollectedHeap.cpp

Print this page




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

  26 #include "classfile/symbolTable.hpp"
  27 #include "classfile/systemDictionary.hpp"
  28 #include "classfile/vmSymbols.hpp"
  29 #include "code/codeCache.hpp"
  30 #include "code/icBuffer.hpp"
  31 #include "gc/shared/collectedHeap.inline.hpp"
  32 #include "gc/shared/collectorCounters.hpp"
  33 #include "gc/shared/gcId.hpp"
  34 #include "gc/shared/gcLocker.inline.hpp"
  35 #include "gc/shared/gcTrace.hpp"
  36 #include "gc/shared/gcTraceTime.inline.hpp"
  37 #include "gc/shared/genCollectedHeap.hpp"
  38 #include "gc/shared/genOopClosures.inline.hpp"
  39 #include "gc/shared/generationSpec.hpp"
  40 #include "gc/shared/space.hpp"
  41 #include "gc/shared/strongRootsScope.hpp"
  42 #include "gc/shared/vmGCOperations.hpp"
  43 #include "gc/shared/workgroup.hpp"
  44 #include "memory/filemap.hpp"
  45 #include "memory/resourceArea.hpp"


  56 #include "utilities/stack.inline.hpp"
  57 #include "utilities/vmError.hpp"
  58 #if INCLUDE_ALL_GCS
  59 #include "gc/cms/concurrentMarkSweepThread.hpp"
  60 #include "gc/cms/vmCMSOperations.hpp"
  61 #endif // INCLUDE_ALL_GCS
  62 
  63 NOT_PRODUCT(size_t GenCollectedHeap::_skip_header_HeapWords = 0;)
  64 
  65 // The set of potentially parallel tasks in root scanning.
  66 enum GCH_strong_roots_tasks {
  67   GCH_PS_Universe_oops_do,
  68   GCH_PS_JNIHandles_oops_do,
  69   GCH_PS_ObjectSynchronizer_oops_do,
  70   GCH_PS_FlatProfiler_oops_do,
  71   GCH_PS_Management_oops_do,
  72   GCH_PS_SystemDictionary_oops_do,
  73   GCH_PS_ClassLoaderDataGraph_oops_do,
  74   GCH_PS_jvmti_oops_do,
  75   GCH_PS_CodeCache_oops_do,

  76   GCH_PS_younger_gens,
  77   // Leave this one last.
  78   GCH_PS_NumElements
  79 };
  80 
  81 GenCollectedHeap::GenCollectedHeap(GenCollectorPolicy *policy) :
  82   CollectedHeap(),
  83   _rem_set(NULL),
  84   _gen_policy(policy),
  85   _process_strong_tasks(new SubTasksDone(GCH_PS_NumElements)),
  86   _full_collections_completed(0)
  87 {
  88   assert(policy != NULL, "Sanity check");
  89   if (UseConcMarkSweepGC) {
  90     _workers = new WorkGang("GC Thread", ParallelGCThreads,
  91                             /* are_GC_task_threads */true,
  92                             /* are_ConcurrentGC_threads */false);
  93     _workers->initialize_workers();
  94   } else {
  95     // Serial GC does not use workers.


 591   if (!_process_strong_tasks->is_task_claimed(GCH_PS_Universe_oops_do)) {
 592     Universe::oops_do(strong_roots);
 593   }
 594   // Global (strong) JNI handles
 595   if (!_process_strong_tasks->is_task_claimed(GCH_PS_JNIHandles_oops_do)) {
 596     JNIHandles::oops_do(strong_roots);
 597   }
 598 
 599   if (!_process_strong_tasks->is_task_claimed(GCH_PS_ObjectSynchronizer_oops_do)) {
 600     ObjectSynchronizer::oops_do(strong_roots);
 601   }
 602   if (!_process_strong_tasks->is_task_claimed(GCH_PS_FlatProfiler_oops_do)) {
 603     FlatProfiler::oops_do(strong_roots);
 604   }
 605   if (!_process_strong_tasks->is_task_claimed(GCH_PS_Management_oops_do)) {
 606     Management::oops_do(strong_roots);
 607   }
 608   if (!_process_strong_tasks->is_task_claimed(GCH_PS_jvmti_oops_do)) {
 609     JvmtiExport::oops_do(strong_roots);
 610   }



 611 
 612   if (!_process_strong_tasks->is_task_claimed(GCH_PS_SystemDictionary_oops_do)) {
 613     SystemDictionary::roots_oops_do(strong_roots, weak_roots);
 614   }
 615 
 616   if (!_process_strong_tasks->is_task_claimed(GCH_PS_CodeCache_oops_do)) {
 617     if (so & SO_ScavengeCodeCache) {
 618       assert(code_roots != NULL, "must supply closure for code cache");
 619 
 620       // We only visit parts of the CodeCache when scavenging.
 621       CodeCache::scavenge_root_nmethods_do(code_roots);
 622     }
 623     if (so & SO_AllCodeCache) {
 624       assert(code_roots != NULL, "must supply closure for code cache");
 625 
 626       // CMSCollector uses this to do intermediate-strength collections.
 627       // We scan the entire code cache, since CodeCache::do_unloading is not called.
 628       CodeCache::blobs_do(code_roots);
 629     }
 630     // Verify that the code cache contents are not subject to




   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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "aot/aotLoader.hpp"
  27 #include "classfile/symbolTable.hpp"
  28 #include "classfile/systemDictionary.hpp"
  29 #include "classfile/vmSymbols.hpp"
  30 #include "code/codeCache.hpp"
  31 #include "code/icBuffer.hpp"
  32 #include "gc/shared/collectedHeap.inline.hpp"
  33 #include "gc/shared/collectorCounters.hpp"
  34 #include "gc/shared/gcId.hpp"
  35 #include "gc/shared/gcLocker.inline.hpp"
  36 #include "gc/shared/gcTrace.hpp"
  37 #include "gc/shared/gcTraceTime.inline.hpp"
  38 #include "gc/shared/genCollectedHeap.hpp"
  39 #include "gc/shared/genOopClosures.inline.hpp"
  40 #include "gc/shared/generationSpec.hpp"
  41 #include "gc/shared/space.hpp"
  42 #include "gc/shared/strongRootsScope.hpp"
  43 #include "gc/shared/vmGCOperations.hpp"
  44 #include "gc/shared/workgroup.hpp"
  45 #include "memory/filemap.hpp"
  46 #include "memory/resourceArea.hpp"


  57 #include "utilities/stack.inline.hpp"
  58 #include "utilities/vmError.hpp"
  59 #if INCLUDE_ALL_GCS
  60 #include "gc/cms/concurrentMarkSweepThread.hpp"
  61 #include "gc/cms/vmCMSOperations.hpp"
  62 #endif // INCLUDE_ALL_GCS
  63 
  64 NOT_PRODUCT(size_t GenCollectedHeap::_skip_header_HeapWords = 0;)
  65 
  66 // The set of potentially parallel tasks in root scanning.
  67 enum GCH_strong_roots_tasks {
  68   GCH_PS_Universe_oops_do,
  69   GCH_PS_JNIHandles_oops_do,
  70   GCH_PS_ObjectSynchronizer_oops_do,
  71   GCH_PS_FlatProfiler_oops_do,
  72   GCH_PS_Management_oops_do,
  73   GCH_PS_SystemDictionary_oops_do,
  74   GCH_PS_ClassLoaderDataGraph_oops_do,
  75   GCH_PS_jvmti_oops_do,
  76   GCH_PS_CodeCache_oops_do,
  77   GCH_PS_aot_oops_do,
  78   GCH_PS_younger_gens,
  79   // Leave this one last.
  80   GCH_PS_NumElements
  81 };
  82 
  83 GenCollectedHeap::GenCollectedHeap(GenCollectorPolicy *policy) :
  84   CollectedHeap(),
  85   _rem_set(NULL),
  86   _gen_policy(policy),
  87   _process_strong_tasks(new SubTasksDone(GCH_PS_NumElements)),
  88   _full_collections_completed(0)
  89 {
  90   assert(policy != NULL, "Sanity check");
  91   if (UseConcMarkSweepGC) {
  92     _workers = new WorkGang("GC Thread", ParallelGCThreads,
  93                             /* are_GC_task_threads */true,
  94                             /* are_ConcurrentGC_threads */false);
  95     _workers->initialize_workers();
  96   } else {
  97     // Serial GC does not use workers.


 593   if (!_process_strong_tasks->is_task_claimed(GCH_PS_Universe_oops_do)) {
 594     Universe::oops_do(strong_roots);
 595   }
 596   // Global (strong) JNI handles
 597   if (!_process_strong_tasks->is_task_claimed(GCH_PS_JNIHandles_oops_do)) {
 598     JNIHandles::oops_do(strong_roots);
 599   }
 600 
 601   if (!_process_strong_tasks->is_task_claimed(GCH_PS_ObjectSynchronizer_oops_do)) {
 602     ObjectSynchronizer::oops_do(strong_roots);
 603   }
 604   if (!_process_strong_tasks->is_task_claimed(GCH_PS_FlatProfiler_oops_do)) {
 605     FlatProfiler::oops_do(strong_roots);
 606   }
 607   if (!_process_strong_tasks->is_task_claimed(GCH_PS_Management_oops_do)) {
 608     Management::oops_do(strong_roots);
 609   }
 610   if (!_process_strong_tasks->is_task_claimed(GCH_PS_jvmti_oops_do)) {
 611     JvmtiExport::oops_do(strong_roots);
 612   }
 613   if (UseAOT && !_process_strong_tasks->is_task_claimed(GCH_PS_aot_oops_do)) {
 614     AOTLoader::oops_do(strong_roots);
 615   }
 616 
 617   if (!_process_strong_tasks->is_task_claimed(GCH_PS_SystemDictionary_oops_do)) {
 618     SystemDictionary::roots_oops_do(strong_roots, weak_roots);
 619   }
 620 
 621   if (!_process_strong_tasks->is_task_claimed(GCH_PS_CodeCache_oops_do)) {
 622     if (so & SO_ScavengeCodeCache) {
 623       assert(code_roots != NULL, "must supply closure for code cache");
 624 
 625       // We only visit parts of the CodeCache when scavenging.
 626       CodeCache::scavenge_root_nmethods_do(code_roots);
 627     }
 628     if (so & SO_AllCodeCache) {
 629       assert(code_roots != NULL, "must supply closure for code cache");
 630 
 631       // CMSCollector uses this to do intermediate-strength collections.
 632       // We scan the entire code cache, since CodeCache::do_unloading is not called.
 633       CodeCache::blobs_do(code_roots);
 634     }
 635     // Verify that the code cache contents are not subject to


src/share/vm/gc/shared/genCollectedHeap.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File