hotspot/src/share/vm/memory/heapInspection.cpp
changeset 1374 4c24294029a9
parent 184 a2da5efb871c
child 1388 3677f5f3d66b
equal deleted inserted replaced
615:570062d730b2 1374:4c24294029a9
   236 void HeapInspection::heap_inspection(outputStream* st) {
   236 void HeapInspection::heap_inspection(outputStream* st) {
   237   ResourceMark rm;
   237   ResourceMark rm;
   238   HeapWord* ref;
   238   HeapWord* ref;
   239 
   239 
   240   CollectedHeap* heap = Universe::heap();
   240   CollectedHeap* heap = Universe::heap();
       
   241   bool is_shared_heap = false;
   241   switch (heap->kind()) {
   242   switch (heap->kind()) {
       
   243     case CollectedHeap::G1CollectedHeap:
   242     case CollectedHeap::GenCollectedHeap: {
   244     case CollectedHeap::GenCollectedHeap: {
   243       GenCollectedHeap* gch = (GenCollectedHeap*)heap;
   245       is_shared_heap = true;
   244       gch->gc_prologue(false /* !full */); // get any necessary locks
   246       SharedHeap* sh = (SharedHeap*)heap;
   245       ref = gch->perm_gen()->used_region().start();
   247       sh->gc_prologue(false /* !full */); // get any necessary locks, etc.
       
   248       ref = sh->perm_gen()->used_region().start();
   246       break;
   249       break;
   247     }
   250     }
   248 #ifndef SERIALGC
   251 #ifndef SERIALGC
   249     case CollectedHeap::ParallelScavengeHeap: {
   252     case CollectedHeap::ParallelScavengeHeap: {
   250       ParallelScavengeHeap* psh = (ParallelScavengeHeap*)heap;
   253       ParallelScavengeHeap* psh = (ParallelScavengeHeap*)heap;
   282   } else {
   285   } else {
   283     st->print_cr("WARNING: Ran out of C-heap; histogram not generated");
   286     st->print_cr("WARNING: Ran out of C-heap; histogram not generated");
   284   }
   287   }
   285   st->flush();
   288   st->flush();
   286 
   289 
   287   if (Universe::heap()->kind() == CollectedHeap::GenCollectedHeap) {
   290   if (is_shared_heap) {
   288     GenCollectedHeap* gch = GenCollectedHeap::heap();
   291     SharedHeap* sh = (SharedHeap*)heap;
   289     gch->gc_epilogue(false /* !full */); // release all acquired locks
   292     sh->gc_epilogue(false /* !full */); // release all acquired locks, etc.
   290   }
   293   }
   291 }
   294 }
   292 
   295 
   293 class FindInstanceClosure : public ObjectClosure {
   296 class FindInstanceClosure : public ObjectClosure {
   294  private:
   297  private: