< prev index next >

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

Print this page

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

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

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

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

1069 }
1070 
1071 bool GenCollectedHeap::is_maximal_no_gc() const {
1072   return _young_gen->is_maximal_no_gc() && _old_gen->is_maximal_no_gc();
1073 }
1074 
1075 void GenCollectedHeap::save_marks() {
1076   _young_gen->save_marks();
1077   _old_gen->save_marks();
1078 }
1079 
1080 GenCollectedHeap* GenCollectedHeap::heap() {
1081   // SerialHeap is the only subtype of GenCollectedHeap.
1082   return named_heap<GenCollectedHeap>(CollectedHeap::Serial);
1083 }
1084 
1085 #if INCLUDE_SERIALGC
1086 void GenCollectedHeap::prepare_for_compaction() {
1087   // Start by compacting into same gen.
1088   CompactPoint cp(_old_gen);

1089   _old_gen->prepare_for_compaction(&cp);
1090   _young_gen->prepare_for_compaction(&cp);
1091 }
1092 #endif // INCLUDE_SERIALGC
1093 
1094 void GenCollectedHeap::verify(VerifyOption option /* ignored */) {
1095   log_debug(gc, verify)("%s", _old_gen->name());
1096   _old_gen->verify();
1097 
1098   log_debug(gc, verify)("%s", _old_gen->name());
1099   _young_gen->verify();
1100 
1101   log_debug(gc, verify)("RemSet");
1102   rem_set()->verify();
1103 }
1104 
1105 void GenCollectedHeap::print_on(outputStream* st) const {
1106   if (_young_gen != NULL) {
1107     _young_gen->print_on(st);
1108   }

  35 #include "gc/shared/cardTableBarrierSet.hpp"
  36 #include "gc/shared/cardTableRS.hpp"
  37 #include "gc/shared/collectedHeap.inline.hpp"
  38 #include "gc/shared/collectorCounters.hpp"
  39 #include "gc/shared/gcId.hpp"
  40 #include "gc/shared/gcLocker.hpp"
  41 #include "gc/shared/gcPolicyCounters.hpp"
  42 #include "gc/shared/gcTrace.hpp"
  43 #include "gc/shared/gcTraceTime.inline.hpp"
  44 #include "gc/shared/genArguments.hpp"
  45 #include "gc/shared/gcVMOperations.hpp"
  46 #include "gc/shared/genCollectedHeap.hpp"
  47 #include "gc/shared/genOopClosures.inline.hpp"
  48 #include "gc/shared/generationSpec.hpp"
  49 #include "gc/shared/gcInitLogger.hpp"
  50 #include "gc/shared/locationPrinter.inline.hpp"
  51 #include "gc/shared/oopStorage.inline.hpp"
  52 #include "gc/shared/oopStorageSet.inline.hpp"
  53 #include "gc/shared/oopStorageParState.inline.hpp"
  54 #include "gc/shared/scavengableNMethods.hpp"
  55 #include "gc/shared/slidingForwarding.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/handles.hpp"
  67 #include "runtime/handles.inline.hpp"
  68 #include "runtime/java.hpp"
  69 #include "runtime/vmThread.hpp"
  70 #include "services/memoryService.hpp"
  71 #include "utilities/autoRestore.hpp"
  72 #include "utilities/debug.hpp"
  73 #include "utilities/formatBuffer.hpp"
  74 #include "utilities/macros.hpp"
  75 #include "utilities/stack.inline.hpp"

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

1071 }
1072 
1073 bool GenCollectedHeap::is_maximal_no_gc() const {
1074   return _young_gen->is_maximal_no_gc() && _old_gen->is_maximal_no_gc();
1075 }
1076 
1077 void GenCollectedHeap::save_marks() {
1078   _young_gen->save_marks();
1079   _old_gen->save_marks();
1080 }
1081 
1082 GenCollectedHeap* GenCollectedHeap::heap() {
1083   // SerialHeap is the only subtype of GenCollectedHeap.
1084   return named_heap<GenCollectedHeap>(CollectedHeap::Serial);
1085 }
1086 
1087 #if INCLUDE_SERIALGC
1088 void GenCollectedHeap::prepare_for_compaction() {
1089   // Start by compacting into same gen.
1090   CompactPoint cp(_old_gen);
1091   _forwarding->clear();
1092   _old_gen->prepare_for_compaction(&cp);
1093   _young_gen->prepare_for_compaction(&cp);
1094 }
1095 #endif // INCLUDE_SERIALGC
1096 
1097 void GenCollectedHeap::verify(VerifyOption option /* ignored */) {
1098   log_debug(gc, verify)("%s", _old_gen->name());
1099   _old_gen->verify();
1100 
1101   log_debug(gc, verify)("%s", _old_gen->name());
1102   _young_gen->verify();
1103 
1104   log_debug(gc, verify)("RemSet");
1105   rem_set()->verify();
1106 }
1107 
1108 void GenCollectedHeap::print_on(outputStream* st) const {
1109   if (_young_gen != NULL) {
1110     _young_gen->print_on(st);
1111   }
< prev index next >