38 #include "gc/shared/generation.hpp"
39 #include "gc/shared/gcTraceTime.inline.hpp"
40 #include "gc/shared/space.hpp"
41 #include "interpreter/interpreter.hpp"
42 #include "logging/log.hpp"
43 #include "memory/filemap.hpp"
44 #include "memory/metadataFactory.hpp"
45 #include "memory/metaspaceShared.hpp"
46 #include "memory/oopFactory.hpp"
47 #include "memory/resourceArea.hpp"
48 #include "memory/universe.hpp"
49 #include "memory/universe.inline.hpp"
50 #include "oops/constantPool.hpp"
51 #include "oops/instanceClassLoaderKlass.hpp"
52 #include "oops/instanceKlass.hpp"
53 #include "oops/instanceMirrorKlass.hpp"
54 #include "oops/instanceRefKlass.hpp"
55 #include "oops/objArrayOop.inline.hpp"
56 #include "oops/oop.inline.hpp"
57 #include "oops/typeArrayKlass.hpp"
58 #include "runtime/arguments.hpp"
59 #include "runtime/atomic.hpp"
60 #include "runtime/commandLineFlagConstraintList.hpp"
61 #include "runtime/deoptimization.hpp"
62 #include "runtime/fprofiler.hpp"
63 #include "runtime/handles.inline.hpp"
64 #include "runtime/init.hpp"
65 #include "runtime/java.hpp"
66 #include "runtime/javaCalls.hpp"
67 #include "runtime/sharedRuntime.hpp"
68 #include "runtime/synchronizer.hpp"
69 #include "runtime/thread.inline.hpp"
70 #include "runtime/timerTrace.hpp"
71 #include "runtime/vm_operations.hpp"
72 #include "services/memoryService.hpp"
73 #include "utilities/copy.hpp"
74 #include "utilities/events.hpp"
75 #include "utilities/hashtable.inline.hpp"
76 #include "utilities/macros.hpp"
77 #include "utilities/ostream.hpp"
654
655 jint universe_init() {
656 assert(!Universe::_fully_initialized, "called after initialize_vtables");
657 guarantee(1 << LogHeapWordSize == sizeof(HeapWord),
658 "LogHeapWordSize is incorrect.");
659 guarantee(sizeof(oop) >= sizeof(HeapWord), "HeapWord larger than oop?");
660 guarantee(sizeof(oop) % sizeof(HeapWord) == 0,
661 "oop size is not not a multiple of HeapWord size");
662
663 TraceTime timer("Genesis", TRACETIME_LOG(Info, startuptime));
664
665 JavaClasses::compute_hard_coded_offsets();
666
667 jint status = Universe::initialize_heap();
668 if (status != JNI_OK) {
669 return status;
670 }
671
672 Metaspace::global_initialize();
673
674 // Checks 'AfterMemoryInit' constraints.
675 if (!CommandLineFlagConstraintList::check_constraints(CommandLineFlagConstraint::AfterMemoryInit)) {
676 return JNI_EINVAL;
677 }
678
679 // Create memory for metadata. Must be after initializing heap for
680 // DumpSharedSpaces.
681 ClassLoaderData::init_null_class_loader_data();
682
683 // We have a heap so create the Method* caches before
684 // Metaspace::initialize_shared_spaces() tries to populate them.
685 Universe::_finalizer_register_cache = new LatestMethodCache();
686 Universe::_loader_addClass_cache = new LatestMethodCache();
687 Universe::_pd_implies_cache = new LatestMethodCache();
688 Universe::_throw_illegal_access_error_cache = new LatestMethodCache();
689 Universe::_do_stack_walk_cache = new LatestMethodCache();
690
691 if (UseSharedSpaces) {
692 // Read the data structures supporting the shared spaces (shared
693 // system dictionary, symbol table, etc.). After that, access to
|
38 #include "gc/shared/generation.hpp"
39 #include "gc/shared/gcTraceTime.inline.hpp"
40 #include "gc/shared/space.hpp"
41 #include "interpreter/interpreter.hpp"
42 #include "logging/log.hpp"
43 #include "memory/filemap.hpp"
44 #include "memory/metadataFactory.hpp"
45 #include "memory/metaspaceShared.hpp"
46 #include "memory/oopFactory.hpp"
47 #include "memory/resourceArea.hpp"
48 #include "memory/universe.hpp"
49 #include "memory/universe.inline.hpp"
50 #include "oops/constantPool.hpp"
51 #include "oops/instanceClassLoaderKlass.hpp"
52 #include "oops/instanceKlass.hpp"
53 #include "oops/instanceMirrorKlass.hpp"
54 #include "oops/instanceRefKlass.hpp"
55 #include "oops/objArrayOop.inline.hpp"
56 #include "oops/oop.inline.hpp"
57 #include "oops/typeArrayKlass.hpp"
58 #include "aot/aotLoader.hpp"
59 #include "runtime/arguments.hpp"
60 #include "runtime/atomic.hpp"
61 #include "runtime/commandLineFlagConstraintList.hpp"
62 #include "runtime/deoptimization.hpp"
63 #include "runtime/fprofiler.hpp"
64 #include "runtime/handles.inline.hpp"
65 #include "runtime/init.hpp"
66 #include "runtime/java.hpp"
67 #include "runtime/javaCalls.hpp"
68 #include "runtime/sharedRuntime.hpp"
69 #include "runtime/synchronizer.hpp"
70 #include "runtime/thread.inline.hpp"
71 #include "runtime/timerTrace.hpp"
72 #include "runtime/vm_operations.hpp"
73 #include "services/memoryService.hpp"
74 #include "utilities/copy.hpp"
75 #include "utilities/events.hpp"
76 #include "utilities/hashtable.inline.hpp"
77 #include "utilities/macros.hpp"
78 #include "utilities/ostream.hpp"
655
656 jint universe_init() {
657 assert(!Universe::_fully_initialized, "called after initialize_vtables");
658 guarantee(1 << LogHeapWordSize == sizeof(HeapWord),
659 "LogHeapWordSize is incorrect.");
660 guarantee(sizeof(oop) >= sizeof(HeapWord), "HeapWord larger than oop?");
661 guarantee(sizeof(oop) % sizeof(HeapWord) == 0,
662 "oop size is not not a multiple of HeapWord size");
663
664 TraceTime timer("Genesis", TRACETIME_LOG(Info, startuptime));
665
666 JavaClasses::compute_hard_coded_offsets();
667
668 jint status = Universe::initialize_heap();
669 if (status != JNI_OK) {
670 return status;
671 }
672
673 Metaspace::global_initialize();
674
675 AOTLoader::universe_init();
676
677 // Checks 'AfterMemoryInit' constraints.
678 if (!CommandLineFlagConstraintList::check_constraints(CommandLineFlagConstraint::AfterMemoryInit)) {
679 return JNI_EINVAL;
680 }
681
682 // Create memory for metadata. Must be after initializing heap for
683 // DumpSharedSpaces.
684 ClassLoaderData::init_null_class_loader_data();
685
686 // We have a heap so create the Method* caches before
687 // Metaspace::initialize_shared_spaces() tries to populate them.
688 Universe::_finalizer_register_cache = new LatestMethodCache();
689 Universe::_loader_addClass_cache = new LatestMethodCache();
690 Universe::_pd_implies_cache = new LatestMethodCache();
691 Universe::_throw_illegal_access_error_cache = new LatestMethodCache();
692 Universe::_do_stack_walk_cache = new LatestMethodCache();
693
694 if (UseSharedSpaces) {
695 // Read the data structures supporting the shared spaces (shared
696 // system dictionary, symbol table, etc.). After that, access to
|