65 #include "runtime/handles.inline.hpp"
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/copy.hpp"
76 #include "utilities/debug.hpp"
77 #include "utilities/events.hpp"
78 #include "utilities/formatBuffer.hpp"
79 #include "utilities/hashtable.inline.hpp"
80 #include "utilities/macros.hpp"
81 #include "utilities/ostream.hpp"
82 #include "utilities/preserveException.hpp"
83 #if INCLUDE_ALL_GCS
84 #include "gc/cms/cmsCollectorPolicy.hpp"
85 #include "gc/g1/g1CollectedHeap.inline.hpp"
86 #include "gc/g1/g1CollectorPolicy.hpp"
87 #include "gc/parallel/parallelScavengeHeap.hpp"
88 #include "gc/shared/adaptiveSizePolicy.hpp"
89 #endif // INCLUDE_ALL_GCS
90 #if INCLUDE_CDS
91 #include "classfile/sharedClassUtil.hpp"
92 #endif
93
94 // Known objects
95 Klass* Universe::_boolArrayKlassObj = NULL;
96 Klass* Universe::_byteArrayKlassObj = NULL;
97 Klass* Universe::_charArrayKlassObj = NULL;
98 Klass* Universe::_intArrayKlassObj = NULL;
99 Klass* Universe::_shortArrayKlassObj = NULL;
100 Klass* Universe::_longArrayKlassObj = NULL;
101 Klass* Universe::_singleArrayKlassObj = NULL;
102 Klass* Universe::_doubleArrayKlassObj = NULL;
103 Klass* Universe::_typeArrayKlassObjs[T_VOID+1] = { NULL /*, NULL...*/ };
104 Klass* Universe::_objectArrayKlassObj = NULL;
692 ResolvedMethodTable::create_table();
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
|
65 #include "runtime/handles.inline.hpp"
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/copy.hpp"
76 #include "utilities/debug.hpp"
77 #include "utilities/events.hpp"
78 #include "utilities/formatBuffer.hpp"
79 #include "utilities/hashtable.inline.hpp"
80 #include "utilities/macros.hpp"
81 #include "utilities/ostream.hpp"
82 #include "utilities/preserveException.hpp"
83 #if INCLUDE_ALL_GCS
84 #include "gc/cms/cmsCollectorPolicy.hpp"
85 #include "gc/cms/cmsHeap.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<CMSHeap, 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
|