55 #include "oops/objArrayOop.inline.hpp"
56 #include "oops/oop.inline.hpp"
57 #include "oops/typeArrayKlass.hpp"
58 #include "prims/resolvedMethodTable.hpp"
59 #include "runtime/arguments.hpp"
60 #include "runtime/atomic.hpp"
61 #include "runtime/flags/flagSetting.hpp"
62 #include "runtime/flags/jvmFlagConstraintList.hpp"
63 #include "runtime/deoptimization.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/align.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
84 // Known objects
85 Klass* Universe::_boolArrayKlassObj = NULL;
86 Klass* Universe::_byteArrayKlassObj = NULL;
87 Klass* Universe::_charArrayKlassObj = NULL;
88 Klass* Universe::_intArrayKlassObj = NULL;
89 Klass* Universe::_shortArrayKlassObj = NULL;
90 Klass* Universe::_longArrayKlassObj = NULL;
91 Klass* Universe::_singleArrayKlassObj = NULL;
92 Klass* Universe::_doubleArrayKlassObj = NULL;
93 Klass* Universe::_typeArrayKlassObjs[T_VOID+1] = { NULL /*, NULL...*/ };
|
55 #include "oops/objArrayOop.inline.hpp"
56 #include "oops/oop.inline.hpp"
57 #include "oops/typeArrayKlass.hpp"
58 #include "prims/resolvedMethodTable.hpp"
59 #include "runtime/arguments.hpp"
60 #include "runtime/atomic.hpp"
61 #include "runtime/flags/flagSetting.hpp"
62 #include "runtime/flags/jvmFlagConstraintList.hpp"
63 #include "runtime/deoptimization.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/align.hpp"
75 #include "utilities/behaviours.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
85 // Known objects
86 Klass* Universe::_boolArrayKlassObj = NULL;
87 Klass* Universe::_byteArrayKlassObj = NULL;
88 Klass* Universe::_charArrayKlassObj = NULL;
89 Klass* Universe::_intArrayKlassObj = NULL;
90 Klass* Universe::_shortArrayKlassObj = NULL;
91 Klass* Universe::_longArrayKlassObj = NULL;
92 Klass* Universe::_singleArrayKlassObj = NULL;
93 Klass* Universe::_doubleArrayKlassObj = NULL;
94 Klass* Universe::_typeArrayKlassObjs[T_VOID+1] = { NULL /*, NULL...*/ };
|
649
650 void* Universe::non_oop_word() {
651 // Neither the high bits nor the low bits of this value is allowed
652 // to look like (respectively) the high or low bits of a real oop.
653 //
654 // High and low are CPU-specific notions, but low always includes
655 // the low-order bit. Since oops are always aligned at least mod 4,
656 // setting the low-order bit will ensure that the low half of the
657 // word will never look like that of a real oop.
658 //
659 // Using the OS-supplied non-memory-address word (usually 0 or -1)
660 // will take care of the high bits, however many there are.
661
662 if (_non_oop_bits == 0) {
663 _non_oop_bits = (intptr_t)os::non_memory_address_word() | 1;
664 }
665
666 return (void*)_non_oop_bits;
667 }
668
669 jint universe_init() {
670 assert(!Universe::_fully_initialized, "called after initialize_vtables");
671 guarantee(1 << LogHeapWordSize == sizeof(HeapWord),
672 "LogHeapWordSize is incorrect.");
673 guarantee(sizeof(oop) >= sizeof(HeapWord), "HeapWord larger than oop?");
674 guarantee(sizeof(oop) % sizeof(HeapWord) == 0,
675 "oop size is not not a multiple of HeapWord size");
676
677 TraceTime timer("Genesis", TRACETIME_LOG(Info, startuptime));
678
679 JavaClasses::compute_hard_coded_offsets();
680
681 jint status = Universe::initialize_heap();
682 if (status != JNI_OK) {
683 return status;
684 }
685
686 SystemDictionary::initialize_oop_storage();
687
688 Metaspace::global_initialize();
689
690 // Initialize performance counters for metaspaces
691 MetaspaceCounters::initialize_performance_counters();
692 CompressedClassSpaceCounters::initialize_performance_counters();
693
694 AOTLoader::universe_init();
695
696 // Checks 'AfterMemoryInit' constraints.
697 if (!JVMFlagConstraintList::check_constraints(JVMFlagConstraint::AfterMemoryInit)) {
698 return JNI_EINVAL;
|
650
651 void* Universe::non_oop_word() {
652 // Neither the high bits nor the low bits of this value is allowed
653 // to look like (respectively) the high or low bits of a real oop.
654 //
655 // High and low are CPU-specific notions, but low always includes
656 // the low-order bit. Since oops are always aligned at least mod 4,
657 // setting the low-order bit will ensure that the low half of the
658 // word will never look like that of a real oop.
659 //
660 // Using the OS-supplied non-memory-address word (usually 0 or -1)
661 // will take care of the high bits, however many there are.
662
663 if (_non_oop_bits == 0) {
664 _non_oop_bits = (intptr_t)os::non_memory_address_word() | 1;
665 }
666
667 return (void*)_non_oop_bits;
668 }
669
670 BehaviourProviderCollection* Universe::_vm_behaviours = NULL;
671 BehaviourProviderCollection* Universe::_gc_behaviours = NULL;
672
673 void Universe::initialize_global_behaviours() {
674 // During VM bootstrap
675 _vm_behaviours = new BehaviourProviderCollection();
676 _gc_behaviours = new BehaviourProviderCollection();
677 Behaviours::register_global_provider(*_vm_behaviours);
678 Behaviours::register_global_provider(*_gc_behaviours);
679 }
680
681 jint universe_init() {
682 assert(!Universe::_fully_initialized, "called after initialize_vtables");
683 guarantee(1 << LogHeapWordSize == sizeof(HeapWord),
684 "LogHeapWordSize is incorrect.");
685 guarantee(sizeof(oop) >= sizeof(HeapWord), "HeapWord larger than oop?");
686 guarantee(sizeof(oop) % sizeof(HeapWord) == 0,
687 "oop size is not not a multiple of HeapWord size");
688
689 TraceTime timer("Genesis", TRACETIME_LOG(Info, startuptime));
690
691 JavaClasses::compute_hard_coded_offsets();
692
693 Universe::initialize_global_behaviours();
694
695 jint status = Universe::initialize_heap();
696 if (status != JNI_OK) {
697 return status;
698 }
699
700 SystemDictionary::initialize_oop_storage();
701
702 Metaspace::global_initialize();
703
704 // Initialize performance counters for metaspaces
705 MetaspaceCounters::initialize_performance_counters();
706 CompressedClassSpaceCounters::initialize_performance_counters();
707
708 AOTLoader::universe_init();
709
710 // Checks 'AfterMemoryInit' constraints.
711 if (!JVMFlagConstraintList::check_constraints(JVMFlagConstraint::AfterMemoryInit)) {
712 return JNI_EINVAL;
|