< prev index next >

src/hotspot/share/memory/universe.cpp

Print this page
rev 47476 : 8183542: Factor out serial GC specific code from GenCollectedHeap into its own subclass


  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/classLoader.hpp"
  28 #include "classfile/classLoaderData.hpp"
  29 #include "classfile/javaClasses.hpp"
  30 #include "classfile/stringTable.hpp"
  31 #include "classfile/systemDictionary.hpp"
  32 #include "classfile/vmSymbols.hpp"
  33 #include "code/codeCache.hpp"
  34 #include "code/dependencies.hpp"

  35 #include "gc/shared/cardTableModRefBS.hpp"
  36 #include "gc/shared/collectedHeap.inline.hpp"
  37 #include "gc/shared/gcLocker.inline.hpp"
  38 #include "gc/shared/genCollectedHeap.hpp"
  39 #include "gc/shared/generation.hpp"
  40 #include "gc/shared/gcTraceTime.inline.hpp"
  41 #include "gc/shared/space.hpp"
  42 #include "interpreter/interpreter.hpp"
  43 #include "logging/log.hpp"
  44 #include "logging/logStream.hpp"
  45 #include "memory/filemap.hpp"
  46 #include "memory/metadataFactory.hpp"
  47 #include "memory/metaspaceClosure.hpp"
  48 #include "memory/metaspaceShared.hpp"
  49 #include "memory/oopFactory.hpp"
  50 #include "memory/resourceArea.hpp"
  51 #include "memory/universe.hpp"
  52 #include "memory/universe.inline.hpp"
  53 #include "oops/constantPool.hpp"
  54 #include "oops/instanceClassLoaderKlass.hpp"
  55 #include "oops/instanceKlass.hpp"
  56 #include "oops/instanceMirrorKlass.hpp"
  57 #include "oops/instanceRefKlass.hpp"
  58 #include "oops/objArrayOop.inline.hpp"


 745 }
 746 
 747 CollectedHeap* Universe::create_heap() {
 748   assert(_collectedHeap == NULL, "Heap already created");
 749 #if !INCLUDE_ALL_GCS
 750   if (UseParallelGC) {
 751     fatal("UseParallelGC not supported in this VM.");
 752   } else if (UseG1GC) {
 753     fatal("UseG1GC not supported in this VM.");
 754   } else if (UseConcMarkSweepGC) {
 755     fatal("UseConcMarkSweepGC not supported in this VM.");
 756 #else
 757   if (UseParallelGC) {
 758     return Universe::create_heap_with_policy<ParallelScavengeHeap, GenerationSizer>();
 759   } else if (UseG1GC) {
 760     return Universe::create_heap_with_policy<G1CollectedHeap, G1CollectorPolicy>();
 761   } else if (UseConcMarkSweepGC) {
 762     return Universe::create_heap_with_policy<CMSHeap, ConcurrentMarkSweepPolicy>();
 763 #endif
 764   } else if (UseSerialGC) {
 765     return Universe::create_heap_with_policy<GenCollectedHeap, MarkSweepPolicy>();
 766   }
 767 
 768   ShouldNotReachHere();
 769   return NULL;
 770 }
 771 
 772 // Choose the heap base address and oop encoding mode
 773 // when compressed oops are used:
 774 // Unscaled  - Use 32-bits oops without encoding when
 775 //     NarrowOopHeapBaseMin + heap_size < 4Gb
 776 // ZeroBased - Use zero based compressed oops with encoding when
 777 //     NarrowOopHeapBaseMin + heap_size < 32Gb
 778 // HeapBased - Use compressed oops with heap base + encoding.
 779 
 780 jint Universe::initialize_heap() {
 781   jint status = JNI_ERR;
 782 
 783   _collectedHeap = create_heap_ext();
 784   if (_collectedHeap == NULL) {
 785     _collectedHeap = create_heap();




  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/classLoader.hpp"
  28 #include "classfile/classLoaderData.hpp"
  29 #include "classfile/javaClasses.hpp"
  30 #include "classfile/stringTable.hpp"
  31 #include "classfile/systemDictionary.hpp"
  32 #include "classfile/vmSymbols.hpp"
  33 #include "code/codeCache.hpp"
  34 #include "code/dependencies.hpp"
  35 #include "gc/serial/serialHeap.hpp"
  36 #include "gc/shared/cardTableModRefBS.hpp"
  37 #include "gc/shared/collectedHeap.inline.hpp"
  38 #include "gc/shared/gcLocker.inline.hpp"

  39 #include "gc/shared/generation.hpp"
  40 #include "gc/shared/gcTraceTime.inline.hpp"
  41 #include "gc/shared/space.hpp"
  42 #include "interpreter/interpreter.hpp"
  43 #include "logging/log.hpp"
  44 #include "logging/logStream.hpp"
  45 #include "memory/filemap.hpp"
  46 #include "memory/metadataFactory.hpp"
  47 #include "memory/metaspaceClosure.hpp"
  48 #include "memory/metaspaceShared.hpp"
  49 #include "memory/oopFactory.hpp"
  50 #include "memory/resourceArea.hpp"
  51 #include "memory/universe.hpp"
  52 #include "memory/universe.inline.hpp"
  53 #include "oops/constantPool.hpp"
  54 #include "oops/instanceClassLoaderKlass.hpp"
  55 #include "oops/instanceKlass.hpp"
  56 #include "oops/instanceMirrorKlass.hpp"
  57 #include "oops/instanceRefKlass.hpp"
  58 #include "oops/objArrayOop.inline.hpp"


 745 }
 746 
 747 CollectedHeap* Universe::create_heap() {
 748   assert(_collectedHeap == NULL, "Heap already created");
 749 #if !INCLUDE_ALL_GCS
 750   if (UseParallelGC) {
 751     fatal("UseParallelGC not supported in this VM.");
 752   } else if (UseG1GC) {
 753     fatal("UseG1GC not supported in this VM.");
 754   } else if (UseConcMarkSweepGC) {
 755     fatal("UseConcMarkSweepGC not supported in this VM.");
 756 #else
 757   if (UseParallelGC) {
 758     return Universe::create_heap_with_policy<ParallelScavengeHeap, GenerationSizer>();
 759   } else if (UseG1GC) {
 760     return Universe::create_heap_with_policy<G1CollectedHeap, G1CollectorPolicy>();
 761   } else if (UseConcMarkSweepGC) {
 762     return Universe::create_heap_with_policy<CMSHeap, ConcurrentMarkSweepPolicy>();
 763 #endif
 764   } else if (UseSerialGC) {
 765     return Universe::create_heap_with_policy<SerialHeap, MarkSweepPolicy>();
 766   }
 767 
 768   ShouldNotReachHere();
 769   return NULL;
 770 }
 771 
 772 // Choose the heap base address and oop encoding mode
 773 // when compressed oops are used:
 774 // Unscaled  - Use 32-bits oops without encoding when
 775 //     NarrowOopHeapBaseMin + heap_size < 4Gb
 776 // ZeroBased - Use zero based compressed oops with encoding when
 777 //     NarrowOopHeapBaseMin + heap_size < 32Gb
 778 // HeapBased - Use compressed oops with heap base + encoding.
 779 
 780 jint Universe::initialize_heap() {
 781   jint status = JNI_ERR;
 782 
 783   _collectedHeap = create_heap_ext();
 784   if (_collectedHeap == NULL) {
 785     _collectedHeap = create_heap();


< prev index next >