< prev index next >

hotspot/src/share/vm/memory/universe.cpp

Print this page
rev 6911 : 8065305: Make it possible to extend the G1CollectorPolicy
Summary: Added a G1CollectorPolicyExt where it is possible to extend the class.
Reviewed-by: sjohanss, tschatzl


  61 #include "runtime/fprofiler.hpp"
  62 #include "runtime/handles.inline.hpp"
  63 #include "runtime/init.hpp"
  64 #include "runtime/java.hpp"
  65 #include "runtime/javaCalls.hpp"
  66 #include "runtime/sharedRuntime.hpp"
  67 #include "runtime/synchronizer.hpp"
  68 #include "runtime/thread.inline.hpp"
  69 #include "runtime/timer.hpp"
  70 #include "runtime/vm_operations.hpp"
  71 #include "services/memoryService.hpp"
  72 #include "utilities/copy.hpp"
  73 #include "utilities/events.hpp"
  74 #include "utilities/hashtable.inline.hpp"
  75 #include "utilities/preserveException.hpp"
  76 #include "utilities/macros.hpp"
  77 #if INCLUDE_ALL_GCS
  78 #include "gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp"
  79 #include "gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp"
  80 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
  81 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
  82 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
  83 #endif // INCLUDE_ALL_GCS
  84 
  85 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
  86 
  87 // Known objects
  88 Klass* Universe::_boolArrayKlassObj                 = NULL;
  89 Klass* Universe::_byteArrayKlassObj                 = NULL;
  90 Klass* Universe::_charArrayKlassObj                 = NULL;
  91 Klass* Universe::_intArrayKlassObj                  = NULL;
  92 Klass* Universe::_shortArrayKlassObj                = NULL;
  93 Klass* Universe::_longArrayKlassObj                 = NULL;
  94 Klass* Universe::_singleArrayKlassObj               = NULL;
  95 Klass* Universe::_doubleArrayKlassObj               = NULL;
  96 Klass* Universe::_typeArrayKlassObjs[T_VOID+1]      = { NULL /*, NULL...*/ };
  97 Klass* Universe::_objectArrayKlassObj               = NULL;
  98 oop Universe::_int_mirror                             = NULL;
  99 oop Universe::_float_mirror                           = NULL;
 100 oop Universe::_double_mirror                          = NULL;
 101 oop Universe::_byte_mirror                            = NULL;


 781 #endif //  _WIN64
 782     }
 783   }
 784 #endif
 785 
 786   assert(is_ptr_aligned((char*)base, alignment), "Must be");
 787   return (char*)base; // also return NULL (don't care) for 32-bit VM
 788 }
 789 
 790 jint Universe::initialize_heap() {
 791 
 792   if (UseParallelGC) {
 793 #if INCLUDE_ALL_GCS
 794     Universe::_collectedHeap = new ParallelScavengeHeap();
 795 #else  // INCLUDE_ALL_GCS
 796     fatal("UseParallelGC not supported in this VM.");
 797 #endif // INCLUDE_ALL_GCS
 798 
 799   } else if (UseG1GC) {
 800 #if INCLUDE_ALL_GCS
 801     G1CollectorPolicy* g1p = new G1CollectorPolicy();
 802     g1p->initialize_all();
 803     G1CollectedHeap* g1h = new G1CollectedHeap(g1p);
 804     Universe::_collectedHeap = g1h;
 805 #else  // INCLUDE_ALL_GCS
 806     fatal("UseG1GC not supported in java kernel vm.");
 807 #endif // INCLUDE_ALL_GCS
 808 
 809   } else {
 810     GenCollectorPolicy *gc_policy;
 811 
 812     if (UseSerialGC) {
 813       gc_policy = new MarkSweepPolicy();
 814     } else if (UseConcMarkSweepGC) {
 815 #if INCLUDE_ALL_GCS
 816       if (UseAdaptiveSizePolicy) {
 817         gc_policy = new ASConcurrentMarkSweepPolicy();
 818       } else {
 819         gc_policy = new ConcurrentMarkSweepPolicy();
 820       }
 821 #else  // INCLUDE_ALL_GCS




  61 #include "runtime/fprofiler.hpp"
  62 #include "runtime/handles.inline.hpp"
  63 #include "runtime/init.hpp"
  64 #include "runtime/java.hpp"
  65 #include "runtime/javaCalls.hpp"
  66 #include "runtime/sharedRuntime.hpp"
  67 #include "runtime/synchronizer.hpp"
  68 #include "runtime/thread.inline.hpp"
  69 #include "runtime/timer.hpp"
  70 #include "runtime/vm_operations.hpp"
  71 #include "services/memoryService.hpp"
  72 #include "utilities/copy.hpp"
  73 #include "utilities/events.hpp"
  74 #include "utilities/hashtable.inline.hpp"
  75 #include "utilities/preserveException.hpp"
  76 #include "utilities/macros.hpp"
  77 #if INCLUDE_ALL_GCS
  78 #include "gc_implementation/concurrentMarkSweep/cmsAdaptiveSizePolicy.hpp"
  79 #include "gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp"
  80 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
  81 #include "gc_implementation/g1/g1CollectorPolicy_ext.hpp"
  82 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
  83 #endif // INCLUDE_ALL_GCS
  84 
  85 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
  86 
  87 // Known objects
  88 Klass* Universe::_boolArrayKlassObj                 = NULL;
  89 Klass* Universe::_byteArrayKlassObj                 = NULL;
  90 Klass* Universe::_charArrayKlassObj                 = NULL;
  91 Klass* Universe::_intArrayKlassObj                  = NULL;
  92 Klass* Universe::_shortArrayKlassObj                = NULL;
  93 Klass* Universe::_longArrayKlassObj                 = NULL;
  94 Klass* Universe::_singleArrayKlassObj               = NULL;
  95 Klass* Universe::_doubleArrayKlassObj               = NULL;
  96 Klass* Universe::_typeArrayKlassObjs[T_VOID+1]      = { NULL /*, NULL...*/ };
  97 Klass* Universe::_objectArrayKlassObj               = NULL;
  98 oop Universe::_int_mirror                             = NULL;
  99 oop Universe::_float_mirror                           = NULL;
 100 oop Universe::_double_mirror                          = NULL;
 101 oop Universe::_byte_mirror                            = NULL;


 781 #endif //  _WIN64
 782     }
 783   }
 784 #endif
 785 
 786   assert(is_ptr_aligned((char*)base, alignment), "Must be");
 787   return (char*)base; // also return NULL (don't care) for 32-bit VM
 788 }
 789 
 790 jint Universe::initialize_heap() {
 791 
 792   if (UseParallelGC) {
 793 #if INCLUDE_ALL_GCS
 794     Universe::_collectedHeap = new ParallelScavengeHeap();
 795 #else  // INCLUDE_ALL_GCS
 796     fatal("UseParallelGC not supported in this VM.");
 797 #endif // INCLUDE_ALL_GCS
 798 
 799   } else if (UseG1GC) {
 800 #if INCLUDE_ALL_GCS
 801     G1CollectorPolicyExt* g1p = new G1CollectorPolicyExt();
 802     g1p->initialize_all();
 803     G1CollectedHeap* g1h = new G1CollectedHeap(g1p);
 804     Universe::_collectedHeap = g1h;
 805 #else  // INCLUDE_ALL_GCS
 806     fatal("UseG1GC not supported in java kernel vm.");
 807 #endif // INCLUDE_ALL_GCS
 808 
 809   } else {
 810     GenCollectorPolicy *gc_policy;
 811 
 812     if (UseSerialGC) {
 813       gc_policy = new MarkSweepPolicy();
 814     } else if (UseConcMarkSweepGC) {
 815 #if INCLUDE_ALL_GCS
 816       if (UseAdaptiveSizePolicy) {
 817         gc_policy = new ASConcurrentMarkSweepPolicy();
 818       } else {
 819         gc_policy = new ConcurrentMarkSweepPolicy();
 820       }
 821 #else  // INCLUDE_ALL_GCS


< prev index next >