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"
65 #include "runtime/deoptimization.hpp"
66 #include "runtime/handles.inline.hpp"
67 #include "runtime/init.hpp"
68 #include "runtime/java.hpp"
69 #include "runtime/javaCalls.hpp"
70 #include "runtime/sharedRuntime.hpp"
71 #include "runtime/synchronizer.hpp"
72 #include "runtime/thread.inline.hpp"
73 #include "runtime/timerTrace.hpp"
74 #include "runtime/vm_operations.hpp"
75 #include "services/memoryService.hpp"
76 #include "utilities/align.hpp"
77 #include "utilities/copy.hpp"
78 #include "utilities/debug.hpp"
79 #include "utilities/events.hpp"
80 #include "utilities/formatBuffer.hpp"
81 #include "utilities/hashtable.inline.hpp"
82 #include "utilities/macros.hpp"
83 #include "utilities/ostream.hpp"
84 #include "utilities/preserveException.hpp"
85 #if INCLUDE_ALL_GCS
86 #include "gc/cms/cmsCollectorPolicy.hpp"
87 #include "gc/cms/cmsHeap.hpp"
88 #include "gc/g1/g1CollectedHeap.inline.hpp"
89 #include "gc/g1/g1CollectorPolicy.hpp"
90 #include "gc/parallel/parallelScavengeHeap.hpp"
91 #include "gc/shared/adaptiveSizePolicy.hpp"
92 #endif // INCLUDE_ALL_GCS
93 #if INCLUDE_CDS
94 #include "classfile/sharedClassUtil.hpp"
95 #endif
96
97 // Known objects
98 Klass* Universe::_boolArrayKlassObj = NULL;
99 Klass* Universe::_byteArrayKlassObj = NULL;
100 Klass* Universe::_charArrayKlassObj = NULL;
101 Klass* Universe::_intArrayKlassObj = NULL;
102 Klass* Universe::_shortArrayKlassObj = NULL;
103 Klass* Universe::_longArrayKlassObj = NULL;
104 Klass* Universe::_singleArrayKlassObj = NULL;
105 Klass* Universe::_doubleArrayKlassObj = NULL;
106 Klass* Universe::_typeArrayKlassObjs[T_VOID+1] = { NULL /*, NULL...*/ };
107 Klass* Universe::_objectArrayKlassObj = NULL;
108 oop Universe::_int_mirror = NULL;
109 oop Universe::_float_mirror = NULL;
110 oop Universe::_double_mirror = NULL;
111 oop Universe::_byte_mirror = NULL;
112 oop Universe::_bool_mirror = NULL;
729 SymbolTable::create_table();
730 StringTable::create_table();
731
732 #if INCLUDE_CDS
733 if (DumpSharedSpaces) {
734 MetaspaceShared::prepare_for_dumping();
735 }
736 #endif
737 }
738 if (strlen(VerifySubSet) > 0) {
739 Universe::initialize_verify_flags();
740 }
741
742 ResolvedMethodTable::create_table();
743
744 return JNI_OK;
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();
786 }
787
788 status = _collectedHeap->initialize();
789 if (status != JNI_OK) {
|
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/gcArguments.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"
65 #include "runtime/deoptimization.hpp"
66 #include "runtime/handles.inline.hpp"
67 #include "runtime/init.hpp"
68 #include "runtime/java.hpp"
69 #include "runtime/javaCalls.hpp"
70 #include "runtime/sharedRuntime.hpp"
71 #include "runtime/synchronizer.hpp"
72 #include "runtime/thread.inline.hpp"
73 #include "runtime/timerTrace.hpp"
74 #include "runtime/vm_operations.hpp"
75 #include "services/memoryService.hpp"
76 #include "utilities/align.hpp"
77 #include "utilities/copy.hpp"
78 #include "utilities/debug.hpp"
79 #include "utilities/events.hpp"
80 #include "utilities/formatBuffer.hpp"
81 #include "utilities/hashtable.inline.hpp"
82 #include "utilities/macros.hpp"
83 #include "utilities/ostream.hpp"
84 #include "utilities/preserveException.hpp"
85 #if INCLUDE_CDS
86 #include "classfile/sharedClassUtil.hpp"
87 #endif
88
89 // Known objects
90 Klass* Universe::_boolArrayKlassObj = NULL;
91 Klass* Universe::_byteArrayKlassObj = NULL;
92 Klass* Universe::_charArrayKlassObj = NULL;
93 Klass* Universe::_intArrayKlassObj = NULL;
94 Klass* Universe::_shortArrayKlassObj = NULL;
95 Klass* Universe::_longArrayKlassObj = NULL;
96 Klass* Universe::_singleArrayKlassObj = NULL;
97 Klass* Universe::_doubleArrayKlassObj = NULL;
98 Klass* Universe::_typeArrayKlassObjs[T_VOID+1] = { NULL /*, NULL...*/ };
99 Klass* Universe::_objectArrayKlassObj = NULL;
100 oop Universe::_int_mirror = NULL;
101 oop Universe::_float_mirror = NULL;
102 oop Universe::_double_mirror = NULL;
103 oop Universe::_byte_mirror = NULL;
104 oop Universe::_bool_mirror = NULL;
721 SymbolTable::create_table();
722 StringTable::create_table();
723
724 #if INCLUDE_CDS
725 if (DumpSharedSpaces) {
726 MetaspaceShared::prepare_for_dumping();
727 }
728 #endif
729 }
730 if (strlen(VerifySubSet) > 0) {
731 Universe::initialize_verify_flags();
732 }
733
734 ResolvedMethodTable::create_table();
735
736 return JNI_OK;
737 }
738
739 CollectedHeap* Universe::create_heap() {
740 assert(_collectedHeap == NULL, "Heap already created");
741 assert(GCArguments::is_initialized(), "GC must be initialized here");
742 return GCArguments::arguments()->create_heap();
743 }
744
745 // Choose the heap base address and oop encoding mode
746 // when compressed oops are used:
747 // Unscaled - Use 32-bits oops without encoding when
748 // NarrowOopHeapBaseMin + heap_size < 4Gb
749 // ZeroBased - Use zero based compressed oops with encoding when
750 // NarrowOopHeapBaseMin + heap_size < 32Gb
751 // HeapBased - Use compressed oops with heap base + encoding.
752
753 jint Universe::initialize_heap() {
754 jint status = JNI_ERR;
755
756 _collectedHeap = create_heap_ext();
757 if (_collectedHeap == NULL) {
758 _collectedHeap = create_heap();
759 }
760
761 status = _collectedHeap->initialize();
762 if (status != JNI_OK) {
|