58 #include "runtime/atomic.inline.hpp"
59 #include "runtime/commandLineFlagConstraintList.hpp"
60 #include "runtime/deoptimization.hpp"
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/macros.hpp"
76 #include "utilities/preserveException.hpp"
77 #if INCLUDE_ALL_GCS
78 #include "gc/cms/cmsCollectorPolicy.hpp"
79 #include "gc/g1/g1CollectedHeap.inline.hpp"
80 #include "gc/g1/g1CollectorPolicy.hpp"
81 #include "gc/parallel/parallelScavengeHeap.hpp"
82 #include "gc/shared/adaptiveSizePolicy.hpp"
83 #endif // INCLUDE_ALL_GCS
84 #if INCLUDE_CDS
85 #include "classfile/sharedClassUtil.hpp"
86 #endif
87
88 // Known objects
89 Klass* Universe::_boolArrayKlassObj = NULL;
90 Klass* Universe::_byteArrayKlassObj = NULL;
91 Klass* Universe::_charArrayKlassObj = NULL;
92 Klass* Universe::_intArrayKlassObj = NULL;
93 Klass* Universe::_shortArrayKlassObj = NULL;
94 Klass* Universe::_longArrayKlassObj = NULL;
95 Klass* Universe::_singleArrayKlassObj = NULL;
96 Klass* Universe::_doubleArrayKlassObj = NULL;
97 Klass* Universe::_typeArrayKlassObjs[T_VOID+1] = { NULL /*, NULL...*/ };
686 StringTable::create_table();
687 ClassLoader::create_package_info_table();
688
689 if (DumpSharedSpaces) {
690 MetaspaceShared::prepare_for_dumping();
691 }
692 }
693
694 return JNI_OK;
695 }
696
697 CollectedHeap* Universe::create_heap() {
698 assert(_collectedHeap == NULL, "Heap already created");
699 #if !INCLUDE_ALL_GCS
700 if (UseParallelGC) {
701 fatal("UseParallelGC not supported in this VM.");
702 } else if (UseG1GC) {
703 fatal("UseG1GC not supported in this VM.");
704 } else if (UseConcMarkSweepGC) {
705 fatal("UseConcMarkSweepGC not supported in this VM.");
706 #else
707 if (UseParallelGC) {
708 return Universe::create_heap_with_policy<ParallelScavengeHeap, GenerationSizer>();
709 } else if (UseG1GC) {
710 return Universe::create_heap_with_policy<G1CollectedHeap, G1CollectorPolicy>();
711 } else if (UseConcMarkSweepGC) {
712 return Universe::create_heap_with_policy<GenCollectedHeap, ConcurrentMarkSweepPolicy>();
713 #endif
714 } else if (UseSerialGC) {
715 return Universe::create_heap_with_policy<GenCollectedHeap, MarkSweepPolicy>();
716 }
717
718 ShouldNotReachHere();
719 return NULL;
720 }
721
722 // Choose the heap base address and oop encoding mode
723 // when compressed oops are used:
724 // Unscaled - Use 32-bits oops without encoding when
725 // NarrowOopHeapBaseMin + heap_size < 4Gb
726 // ZeroBased - Use zero based compressed oops with encoding when
727 // NarrowOopHeapBaseMin + heap_size < 32Gb
728 // HeapBased - Use compressed oops with heap base + encoding.
729
730 jint Universe::initialize_heap() {
731 jint status = JNI_ERR;
732
|
58 #include "runtime/atomic.inline.hpp"
59 #include "runtime/commandLineFlagConstraintList.hpp"
60 #include "runtime/deoptimization.hpp"
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/macros.hpp"
76 #include "utilities/preserveException.hpp"
77 #if INCLUDE_ALL_GCS
78 #include "gc/shenandoah/shenandoahHeap.hpp"
79 #include "gc/shenandoah/shenandoahCollectorPolicy.hpp"
80 #include "gc/cms/cmsCollectorPolicy.hpp"
81 #include "gc/g1/g1CollectedHeap.inline.hpp"
82 #include "gc/g1/g1CollectorPolicy.hpp"
83 #include "gc/parallel/parallelScavengeHeap.hpp"
84 #include "gc/shared/adaptiveSizePolicy.hpp"
85 #endif // INCLUDE_ALL_GCS
86 #if INCLUDE_CDS
87 #include "classfile/sharedClassUtil.hpp"
88 #endif
89
90 // Known objects
91 Klass* Universe::_boolArrayKlassObj = NULL;
92 Klass* Universe::_byteArrayKlassObj = NULL;
93 Klass* Universe::_charArrayKlassObj = NULL;
94 Klass* Universe::_intArrayKlassObj = NULL;
95 Klass* Universe::_shortArrayKlassObj = NULL;
96 Klass* Universe::_longArrayKlassObj = NULL;
97 Klass* Universe::_singleArrayKlassObj = NULL;
98 Klass* Universe::_doubleArrayKlassObj = NULL;
99 Klass* Universe::_typeArrayKlassObjs[T_VOID+1] = { NULL /*, NULL...*/ };
688 StringTable::create_table();
689 ClassLoader::create_package_info_table();
690
691 if (DumpSharedSpaces) {
692 MetaspaceShared::prepare_for_dumping();
693 }
694 }
695
696 return JNI_OK;
697 }
698
699 CollectedHeap* Universe::create_heap() {
700 assert(_collectedHeap == NULL, "Heap already created");
701 #if !INCLUDE_ALL_GCS
702 if (UseParallelGC) {
703 fatal("UseParallelGC not supported in this VM.");
704 } else if (UseG1GC) {
705 fatal("UseG1GC not supported in this VM.");
706 } else if (UseConcMarkSweepGC) {
707 fatal("UseConcMarkSweepGC not supported in this VM.");
708 } else if (UseShenandoahGC) {
709 fatal("UseShenandoahGC not supported in this VM.");
710 }
711 #else
712 if (UseParallelGC) {
713 return Universe::create_heap_with_policy<ParallelScavengeHeap, GenerationSizer>();
714 } else if (UseG1GC) {
715 return Universe::create_heap_with_policy<G1CollectedHeap, G1CollectorPolicy>();
716 } else if (UseConcMarkSweepGC) {
717 return Universe::create_heap_with_policy<GenCollectedHeap, ConcurrentMarkSweepPolicy>();
718 } else if (UseShenandoahGC) {
719 return Universe::create_heap_with_policy<ShenandoahHeap, ShenandoahCollectorPolicy>();
720 #endif
721 } else if (UseSerialGC) {
722 return Universe::create_heap_with_policy<GenCollectedHeap, MarkSweepPolicy>();
723 }
724
725 ShouldNotReachHere();
726 return NULL;
727 }
728
729 // Choose the heap base address and oop encoding mode
730 // when compressed oops are used:
731 // Unscaled - Use 32-bits oops without encoding when
732 // NarrowOopHeapBaseMin + heap_size < 4Gb
733 // ZeroBased - Use zero based compressed oops with encoding when
734 // NarrowOopHeapBaseMin + heap_size < 32Gb
735 // HeapBased - Use compressed oops with heap base + encoding.
736
737 jint Universe::initialize_heap() {
738 jint status = JNI_ERR;
739
|