66 #include "runtime/init.hpp"
67 #include "runtime/java.hpp"
68 #include "runtime/javaCalls.hpp"
69 #include "runtime/sharedRuntime.hpp"
70 #include "runtime/synchronizer.hpp"
71 #include "runtime/thread.inline.hpp"
72 #include "runtime/timerTrace.hpp"
73 #include "runtime/vm_operations.hpp"
74 #include "services/memoryService.hpp"
75 #include "utilities/align.hpp"
76 #include "utilities/copy.hpp"
77 #include "utilities/debug.hpp"
78 #include "utilities/events.hpp"
79 #include "utilities/formatBuffer.hpp"
80 #include "utilities/hashtable.inline.hpp"
81 #include "utilities/macros.hpp"
82 #include "utilities/ostream.hpp"
83 #include "utilities/preserveException.hpp"
84 #if INCLUDE_ALL_GCS
85 #include "gc/cms/cmsCollectorPolicy.hpp"
86 #include "gc/g1/g1CollectedHeap.inline.hpp"
87 #include "gc/g1/g1CollectorPolicy.hpp"
88 #include "gc/parallel/parallelScavengeHeap.hpp"
89 #include "gc/shared/adaptiveSizePolicy.hpp"
90 #endif // INCLUDE_ALL_GCS
91 #if INCLUDE_CDS
92 #include "classfile/sharedClassUtil.hpp"
93 #endif
94
95 // Known objects
96 Klass* Universe::_boolArrayKlassObj = NULL;
97 Klass* Universe::_byteArrayKlassObj = NULL;
98 Klass* Universe::_charArrayKlassObj = NULL;
99 Klass* Universe::_intArrayKlassObj = NULL;
100 Klass* Universe::_shortArrayKlassObj = NULL;
101 Klass* Universe::_longArrayKlassObj = NULL;
102 Klass* Universe::_singleArrayKlassObj = NULL;
103 Klass* Universe::_doubleArrayKlassObj = NULL;
104 Klass* Universe::_typeArrayKlassObjs[T_VOID+1] = { NULL /*, NULL...*/ };
105 Klass* Universe::_objectArrayKlassObj = NULL;
693 ResolvedMethodTable::create_table();
694
695 return JNI_OK;
696 }
697
698 CollectedHeap* Universe::create_heap() {
699 assert(_collectedHeap == NULL, "Heap already created");
700 #if !INCLUDE_ALL_GCS
701 if (UseParallelGC) {
702 fatal("UseParallelGC not supported in this VM.");
703 } else if (UseG1GC) {
704 fatal("UseG1GC not supported in this VM.");
705 } else if (UseConcMarkSweepGC) {
706 fatal("UseConcMarkSweepGC not supported in this VM.");
707 #else
708 if (UseParallelGC) {
709 return Universe::create_heap_with_policy<ParallelScavengeHeap, GenerationSizer>();
710 } else if (UseG1GC) {
711 return Universe::create_heap_with_policy<G1CollectedHeap, G1CollectorPolicy>();
712 } else if (UseConcMarkSweepGC) {
713 return Universe::create_heap_with_policy<GenCollectedHeap, ConcurrentMarkSweepPolicy>();
714 #endif
715 } else if (UseSerialGC) {
716 return Universe::create_heap_with_policy<GenCollectedHeap, MarkSweepPolicy>();
717 }
718
719 ShouldNotReachHere();
720 return NULL;
721 }
722
723 // Choose the heap base address and oop encoding mode
724 // when compressed oops are used:
725 // Unscaled - Use 32-bits oops without encoding when
726 // NarrowOopHeapBaseMin + heap_size < 4Gb
727 // ZeroBased - Use zero based compressed oops with encoding when
728 // NarrowOopHeapBaseMin + heap_size < 32Gb
729 // HeapBased - Use compressed oops with heap base + encoding.
730
731 jint Universe::initialize_heap() {
732 jint status = JNI_ERR;
733
|
66 #include "runtime/init.hpp"
67 #include "runtime/java.hpp"
68 #include "runtime/javaCalls.hpp"
69 #include "runtime/sharedRuntime.hpp"
70 #include "runtime/synchronizer.hpp"
71 #include "runtime/thread.inline.hpp"
72 #include "runtime/timerTrace.hpp"
73 #include "runtime/vm_operations.hpp"
74 #include "services/memoryService.hpp"
75 #include "utilities/align.hpp"
76 #include "utilities/copy.hpp"
77 #include "utilities/debug.hpp"
78 #include "utilities/events.hpp"
79 #include "utilities/formatBuffer.hpp"
80 #include "utilities/hashtable.inline.hpp"
81 #include "utilities/macros.hpp"
82 #include "utilities/ostream.hpp"
83 #include "utilities/preserveException.hpp"
84 #if INCLUDE_ALL_GCS
85 #include "gc/cms/cmsCollectorPolicy.hpp"
86 #include "gc/cms/cmsHeap.hpp"
87 #include "gc/g1/g1CollectedHeap.inline.hpp"
88 #include "gc/g1/g1CollectorPolicy.hpp"
89 #include "gc/parallel/parallelScavengeHeap.hpp"
90 #include "gc/shared/adaptiveSizePolicy.hpp"
91 #endif // INCLUDE_ALL_GCS
92 #if INCLUDE_CDS
93 #include "classfile/sharedClassUtil.hpp"
94 #endif
95
96 // Known objects
97 Klass* Universe::_boolArrayKlassObj = NULL;
98 Klass* Universe::_byteArrayKlassObj = NULL;
99 Klass* Universe::_charArrayKlassObj = NULL;
100 Klass* Universe::_intArrayKlassObj = NULL;
101 Klass* Universe::_shortArrayKlassObj = NULL;
102 Klass* Universe::_longArrayKlassObj = NULL;
103 Klass* Universe::_singleArrayKlassObj = NULL;
104 Klass* Universe::_doubleArrayKlassObj = NULL;
105 Klass* Universe::_typeArrayKlassObjs[T_VOID+1] = { NULL /*, NULL...*/ };
106 Klass* Universe::_objectArrayKlassObj = NULL;
694 ResolvedMethodTable::create_table();
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
709 if (UseParallelGC) {
710 return Universe::create_heap_with_policy<ParallelScavengeHeap, GenerationSizer>();
711 } else if (UseG1GC) {
712 return Universe::create_heap_with_policy<G1CollectedHeap, G1CollectorPolicy>();
713 } else if (UseConcMarkSweepGC) {
714 return Universe::create_heap_with_policy<CMSHeap, ConcurrentMarkSweepPolicy>();
715 #endif
716 } else if (UseSerialGC) {
717 return Universe::create_heap_with_policy<GenCollectedHeap, MarkSweepPolicy>();
718 }
719
720 ShouldNotReachHere();
721 return NULL;
722 }
723
724 // Choose the heap base address and oop encoding mode
725 // when compressed oops are used:
726 // Unscaled - Use 32-bits oops without encoding when
727 // NarrowOopHeapBaseMin + heap_size < 4Gb
728 // ZeroBased - Use zero based compressed oops with encoding when
729 // NarrowOopHeapBaseMin + heap_size < 32Gb
730 // HeapBased - Use compressed oops with heap base + encoding.
731
732 jint Universe::initialize_heap() {
733 jint status = JNI_ERR;
734
|