src/share/vm/memory/universe.cpp

Print this page




 615   // word will never look like that of a real oop.
 616   //
 617   // Using the OS-supplied non-memory-address word (usually 0 or -1)
 618   // will take care of the high bits, however many there are.
 619 
 620   if (_non_oop_bits == 0) {
 621     _non_oop_bits = (intptr_t)os::non_memory_address_word() | 1;
 622   }
 623 
 624   return (void*)_non_oop_bits;
 625 }
 626 
 627 jint universe_init() {
 628   assert(!Universe::_fully_initialized, "called after initialize_vtables");
 629   guarantee(1 << LogHeapWordSize == sizeof(HeapWord),
 630          "LogHeapWordSize is incorrect.");
 631   guarantee(sizeof(oop) >= sizeof(HeapWord), "HeapWord larger than oop?");
 632   guarantee(sizeof(oop) % sizeof(HeapWord) == 0,
 633             "oop size is not not a multiple of HeapWord size");
 634   TraceTime timer("Genesis", TraceStartupTime);
 635   GC_locker::lock();  // do not allow gc during bootstrapping
 636   JavaClasses::compute_hard_coded_offsets();
 637 
 638   jint status = Universe::initialize_heap();
 639   if (status != JNI_OK) {
 640     return status;
 641   }
 642 
 643   Metaspace::global_initialize();
 644 
 645   // Create memory for metadata.  Must be after initializing heap for
 646   // DumpSharedSpaces.
 647   ClassLoaderData::init_null_class_loader_data();
 648 
 649   // We have a heap so create the Method* caches before
 650   // Metaspace::initialize_shared_spaces() tries to populate them.
 651   Universe::_finalizer_register_cache = new LatestMethodCache();
 652   Universe::_loader_addClass_cache    = new LatestMethodCache();
 653   Universe::_pd_implies_cache         = new LatestMethodCache();
 654 
 655   if (UseSharedSpaces) {


1141   // The following is initializing converter functions for serialization in
1142   // JVM.cpp. If we clean up the StrictMath code above we may want to find
1143   // a better solution for this as well.
1144   initialize_converter_functions();
1145 
1146   // This needs to be done before the first scavenge/gc, since
1147   // it's an input to soft ref clearing policy.
1148   {
1149     MutexLocker x(Heap_lock);
1150     Universe::update_heap_info_at_gc();
1151   }
1152 
1153   // ("weak") refs processing infrastructure initialization
1154   Universe::heap()->post_initialize();
1155 
1156   // Initialize performance counters for metaspaces
1157   MetaspaceCounters::initialize_performance_counters();
1158   CompressedClassSpaceCounters::initialize_performance_counters();
1159 
1160   MemoryService::add_metaspace_memory_pools();
1161 
1162   GC_locker::unlock();  // allow gc after bootstrapping
1163 
1164   MemoryService::set_universe_heap(Universe::_collectedHeap);
1165   return true;
1166 }
1167 
1168 
1169 void Universe::compute_base_vtable_size() {
1170   _base_vtable_size = ClassLoader::compute_Object_vtable();
1171 }
1172 
1173 
1174 // %%% The Universe::flush_foo methods belong in CodeCache.
1175 
1176 // Flushes compiled methods dependent on dependee.
1177 void Universe::flush_dependents_on(instanceKlassHandle dependee) {
1178   assert_lock_strong(Compile_lock);
1179 
1180   if (CodeCache::number_of_nmethods_with_dependencies() == 0) return;
1181 
1182   // CodeCache can only be updated by a thread_in_VM and they will all be




 615   // word will never look like that of a real oop.
 616   //
 617   // Using the OS-supplied non-memory-address word (usually 0 or -1)
 618   // will take care of the high bits, however many there are.
 619 
 620   if (_non_oop_bits == 0) {
 621     _non_oop_bits = (intptr_t)os::non_memory_address_word() | 1;
 622   }
 623 
 624   return (void*)_non_oop_bits;
 625 }
 626 
 627 jint universe_init() {
 628   assert(!Universe::_fully_initialized, "called after initialize_vtables");
 629   guarantee(1 << LogHeapWordSize == sizeof(HeapWord),
 630          "LogHeapWordSize is incorrect.");
 631   guarantee(sizeof(oop) >= sizeof(HeapWord), "HeapWord larger than oop?");
 632   guarantee(sizeof(oop) % sizeof(HeapWord) == 0,
 633             "oop size is not not a multiple of HeapWord size");
 634   TraceTime timer("Genesis", TraceStartupTime);

 635   JavaClasses::compute_hard_coded_offsets();
 636 
 637   jint status = Universe::initialize_heap();
 638   if (status != JNI_OK) {
 639     return status;
 640   }
 641 
 642   Metaspace::global_initialize();
 643 
 644   // Create memory for metadata.  Must be after initializing heap for
 645   // DumpSharedSpaces.
 646   ClassLoaderData::init_null_class_loader_data();
 647 
 648   // We have a heap so create the Method* caches before
 649   // Metaspace::initialize_shared_spaces() tries to populate them.
 650   Universe::_finalizer_register_cache = new LatestMethodCache();
 651   Universe::_loader_addClass_cache    = new LatestMethodCache();
 652   Universe::_pd_implies_cache         = new LatestMethodCache();
 653 
 654   if (UseSharedSpaces) {


1140   // The following is initializing converter functions for serialization in
1141   // JVM.cpp. If we clean up the StrictMath code above we may want to find
1142   // a better solution for this as well.
1143   initialize_converter_functions();
1144 
1145   // This needs to be done before the first scavenge/gc, since
1146   // it's an input to soft ref clearing policy.
1147   {
1148     MutexLocker x(Heap_lock);
1149     Universe::update_heap_info_at_gc();
1150   }
1151 
1152   // ("weak") refs processing infrastructure initialization
1153   Universe::heap()->post_initialize();
1154 
1155   // Initialize performance counters for metaspaces
1156   MetaspaceCounters::initialize_performance_counters();
1157   CompressedClassSpaceCounters::initialize_performance_counters();
1158 
1159   MemoryService::add_metaspace_memory_pools();


1160 
1161   MemoryService::set_universe_heap(Universe::_collectedHeap);
1162   return true;
1163 }
1164 
1165 
1166 void Universe::compute_base_vtable_size() {
1167   _base_vtable_size = ClassLoader::compute_Object_vtable();
1168 }
1169 
1170 
1171 // %%% The Universe::flush_foo methods belong in CodeCache.
1172 
1173 // Flushes compiled methods dependent on dependee.
1174 void Universe::flush_dependents_on(instanceKlassHandle dependee) {
1175   assert_lock_strong(Compile_lock);
1176 
1177   if (CodeCache::number_of_nmethods_with_dependencies() == 0) return;
1178 
1179   // CodeCache can only be updated by a thread_in_VM and they will all be