< prev index next >

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

Print this page

  36 #include "gc/shared/cardTableRS.hpp"
  37 #include "gc/shared/collectedHeap.inline.hpp"
  38 #include "gc/shared/collectorCounters.hpp"
  39 #include "gc/shared/continuationGCSupport.inline.hpp"
  40 #include "gc/shared/gcId.hpp"
  41 #include "gc/shared/gcLocker.hpp"
  42 #include "gc/shared/gcPolicyCounters.hpp"
  43 #include "gc/shared/gcTrace.hpp"
  44 #include "gc/shared/gcTraceTime.inline.hpp"
  45 #include "gc/shared/genArguments.hpp"
  46 #include "gc/shared/gcVMOperations.hpp"
  47 #include "gc/shared/genCollectedHeap.hpp"
  48 #include "gc/shared/genOopClosures.inline.hpp"
  49 #include "gc/shared/generationSpec.hpp"
  50 #include "gc/shared/gcInitLogger.hpp"
  51 #include "gc/shared/locationPrinter.inline.hpp"
  52 #include "gc/shared/oopStorage.inline.hpp"
  53 #include "gc/shared/oopStorageSet.inline.hpp"
  54 #include "gc/shared/oopStorageParState.inline.hpp"
  55 #include "gc/shared/scavengableNMethods.hpp"

  56 #include "gc/shared/space.hpp"
  57 #include "gc/shared/strongRootsScope.hpp"
  58 #include "gc/shared/weakProcessor.hpp"
  59 #include "gc/shared/workerThread.hpp"
  60 #include "memory/iterator.hpp"
  61 #include "memory/metaspaceCounters.hpp"
  62 #include "memory/metaspaceUtils.hpp"
  63 #include "memory/resourceArea.hpp"
  64 #include "memory/universe.hpp"
  65 #include "oops/oop.inline.hpp"
  66 #include "runtime/continuation.hpp"
  67 #include "runtime/handles.hpp"
  68 #include "runtime/handles.inline.hpp"
  69 #include "runtime/java.hpp"
  70 #include "runtime/threads.hpp"
  71 #include "runtime/vmThread.hpp"
  72 #include "services/memoryService.hpp"
  73 #include "utilities/autoRestore.hpp"
  74 #include "utilities/debug.hpp"
  75 #include "utilities/formatBuffer.hpp"

 106 
 107 jint GenCollectedHeap::initialize() {
 108   // While there are no constraints in the GC code that HeapWordSize
 109   // be any particular value, there are multiple other areas in the
 110   // system which believe this to be true (e.g. oop->object_size in some
 111   // cases incorrectly returns the size in wordSize units rather than
 112   // HeapWordSize).
 113   guarantee(HeapWordSize == wordSize, "HeapWordSize must equal wordSize");
 114 
 115   // Allocate space for the heap.
 116 
 117   ReservedHeapSpace heap_rs = allocate(HeapAlignment);
 118 
 119   if (!heap_rs.is_reserved()) {
 120     vm_shutdown_during_initialization(
 121       "Could not reserve enough space for object heap");
 122     return JNI_ENOMEM;
 123   }
 124 
 125   initialize_reserved_region(heap_rs);

 126 
 127   _rem_set = create_rem_set(heap_rs.region());
 128   _rem_set->initialize();
 129   CardTableBarrierSet *bs = new CardTableBarrierSet(_rem_set);
 130   bs->initialize();
 131   BarrierSet::set_barrier_set(bs);
 132 
 133   ReservedSpace young_rs = heap_rs.first_part(_young_gen_spec->max_size());
 134   _young_gen = _young_gen_spec->init(young_rs, rem_set());
 135   ReservedSpace old_rs = heap_rs.last_part(_young_gen_spec->max_size());
 136 
 137   old_rs = old_rs.first_part(_old_gen_spec->max_size());
 138   _old_gen = _old_gen_spec->init(old_rs, rem_set());
 139 
 140   GCInitLogger::print();
 141 
 142   return JNI_OK;
 143 }
 144 
 145 CardTableRS* GenCollectedHeap::create_rem_set(const MemRegion& reserved_region) {

1053 }
1054 
1055 bool GenCollectedHeap::is_maximal_no_gc() const {
1056   return _young_gen->is_maximal_no_gc() && _old_gen->is_maximal_no_gc();
1057 }
1058 
1059 void GenCollectedHeap::save_marks() {
1060   _young_gen->save_marks();
1061   _old_gen->save_marks();
1062 }
1063 
1064 GenCollectedHeap* GenCollectedHeap::heap() {
1065   // SerialHeap is the only subtype of GenCollectedHeap.
1066   return named_heap<GenCollectedHeap>(CollectedHeap::Serial);
1067 }
1068 
1069 #if INCLUDE_SERIALGC
1070 void GenCollectedHeap::prepare_for_compaction() {
1071   // Start by compacting into same gen.
1072   CompactPoint cp(_old_gen);

1073   _old_gen->prepare_for_compaction(&cp);
1074   _young_gen->prepare_for_compaction(&cp);
1075 }
1076 #endif // INCLUDE_SERIALGC
1077 
1078 void GenCollectedHeap::verify(VerifyOption option /* ignored */) {
1079   log_debug(gc, verify)("%s", _old_gen->name());
1080   _old_gen->verify();
1081 
1082   log_debug(gc, verify)("%s", _old_gen->name());
1083   _young_gen->verify();
1084 
1085   log_debug(gc, verify)("RemSet");
1086   rem_set()->verify();
1087 }
1088 
1089 void GenCollectedHeap::print_on(outputStream* st) const {
1090   if (_young_gen != NULL) {
1091     _young_gen->print_on(st);
1092   }

  36 #include "gc/shared/cardTableRS.hpp"
  37 #include "gc/shared/collectedHeap.inline.hpp"
  38 #include "gc/shared/collectorCounters.hpp"
  39 #include "gc/shared/continuationGCSupport.inline.hpp"
  40 #include "gc/shared/gcId.hpp"
  41 #include "gc/shared/gcLocker.hpp"
  42 #include "gc/shared/gcPolicyCounters.hpp"
  43 #include "gc/shared/gcTrace.hpp"
  44 #include "gc/shared/gcTraceTime.inline.hpp"
  45 #include "gc/shared/genArguments.hpp"
  46 #include "gc/shared/gcVMOperations.hpp"
  47 #include "gc/shared/genCollectedHeap.hpp"
  48 #include "gc/shared/genOopClosures.inline.hpp"
  49 #include "gc/shared/generationSpec.hpp"
  50 #include "gc/shared/gcInitLogger.hpp"
  51 #include "gc/shared/locationPrinter.inline.hpp"
  52 #include "gc/shared/oopStorage.inline.hpp"
  53 #include "gc/shared/oopStorageSet.inline.hpp"
  54 #include "gc/shared/oopStorageParState.inline.hpp"
  55 #include "gc/shared/scavengableNMethods.hpp"
  56 #include "gc/shared/slidingForwarding.hpp"
  57 #include "gc/shared/space.hpp"
  58 #include "gc/shared/strongRootsScope.hpp"
  59 #include "gc/shared/weakProcessor.hpp"
  60 #include "gc/shared/workerThread.hpp"
  61 #include "memory/iterator.hpp"
  62 #include "memory/metaspaceCounters.hpp"
  63 #include "memory/metaspaceUtils.hpp"
  64 #include "memory/resourceArea.hpp"
  65 #include "memory/universe.hpp"
  66 #include "oops/oop.inline.hpp"
  67 #include "runtime/continuation.hpp"
  68 #include "runtime/handles.hpp"
  69 #include "runtime/handles.inline.hpp"
  70 #include "runtime/java.hpp"
  71 #include "runtime/threads.hpp"
  72 #include "runtime/vmThread.hpp"
  73 #include "services/memoryService.hpp"
  74 #include "utilities/autoRestore.hpp"
  75 #include "utilities/debug.hpp"
  76 #include "utilities/formatBuffer.hpp"

 107 
 108 jint GenCollectedHeap::initialize() {
 109   // While there are no constraints in the GC code that HeapWordSize
 110   // be any particular value, there are multiple other areas in the
 111   // system which believe this to be true (e.g. oop->object_size in some
 112   // cases incorrectly returns the size in wordSize units rather than
 113   // HeapWordSize).
 114   guarantee(HeapWordSize == wordSize, "HeapWordSize must equal wordSize");
 115 
 116   // Allocate space for the heap.
 117 
 118   ReservedHeapSpace heap_rs = allocate(HeapAlignment);
 119 
 120   if (!heap_rs.is_reserved()) {
 121     vm_shutdown_during_initialization(
 122       "Could not reserve enough space for object heap");
 123     return JNI_ENOMEM;
 124   }
 125 
 126   initialize_reserved_region(heap_rs);
 127   _forwarding = new SlidingForwarding(_reserved);
 128 
 129   _rem_set = create_rem_set(heap_rs.region());
 130   _rem_set->initialize();
 131   CardTableBarrierSet *bs = new CardTableBarrierSet(_rem_set);
 132   bs->initialize();
 133   BarrierSet::set_barrier_set(bs);
 134 
 135   ReservedSpace young_rs = heap_rs.first_part(_young_gen_spec->max_size());
 136   _young_gen = _young_gen_spec->init(young_rs, rem_set());
 137   ReservedSpace old_rs = heap_rs.last_part(_young_gen_spec->max_size());
 138 
 139   old_rs = old_rs.first_part(_old_gen_spec->max_size());
 140   _old_gen = _old_gen_spec->init(old_rs, rem_set());
 141 
 142   GCInitLogger::print();
 143 
 144   return JNI_OK;
 145 }
 146 
 147 CardTableRS* GenCollectedHeap::create_rem_set(const MemRegion& reserved_region) {

1055 }
1056 
1057 bool GenCollectedHeap::is_maximal_no_gc() const {
1058   return _young_gen->is_maximal_no_gc() && _old_gen->is_maximal_no_gc();
1059 }
1060 
1061 void GenCollectedHeap::save_marks() {
1062   _young_gen->save_marks();
1063   _old_gen->save_marks();
1064 }
1065 
1066 GenCollectedHeap* GenCollectedHeap::heap() {
1067   // SerialHeap is the only subtype of GenCollectedHeap.
1068   return named_heap<GenCollectedHeap>(CollectedHeap::Serial);
1069 }
1070 
1071 #if INCLUDE_SERIALGC
1072 void GenCollectedHeap::prepare_for_compaction() {
1073   // Start by compacting into same gen.
1074   CompactPoint cp(_old_gen);
1075   _forwarding->clear();
1076   _old_gen->prepare_for_compaction(&cp);
1077   _young_gen->prepare_for_compaction(&cp);
1078 }
1079 #endif // INCLUDE_SERIALGC
1080 
1081 void GenCollectedHeap::verify(VerifyOption option /* ignored */) {
1082   log_debug(gc, verify)("%s", _old_gen->name());
1083   _old_gen->verify();
1084 
1085   log_debug(gc, verify)("%s", _old_gen->name());
1086   _young_gen->verify();
1087 
1088   log_debug(gc, verify)("RemSet");
1089   rem_set()->verify();
1090 }
1091 
1092 void GenCollectedHeap::print_on(outputStream* st) const {
1093   if (_young_gen != NULL) {
1094     _young_gen->print_on(st);
1095   }
< prev index next >