src/hotspot/share/memory/metaspaceShared.cpp
changeset 52468 e0fd97beab7e
parent 52465 3e0ebf913679
child 52503 7d3b82b338f7
equal deleted inserted replaced
52467:1256c8d923e8 52468:e0fd97beab7e
  1205   };
  1205   };
  1206 #endif
  1206 #endif
  1207 
  1207 
  1208 public:
  1208 public:
  1209   static void copy_and_compact() {
  1209   static void copy_and_compact() {
  1210     // We should no longer allocate anything from the metaspace, so that
       
  1211     // we can have a stable set of MetaspaceObjs to work with.
       
  1212     Metaspace::freeze();
       
  1213 
       
  1214     ResourceMark rm;
  1210     ResourceMark rm;
  1215     SortedSymbolClosure the_ssc; // StackObj
  1211     SortedSymbolClosure the_ssc; // StackObj
  1216     _ssc = &the_ssc;
  1212     _ssc = &the_ssc;
  1217 
  1213 
  1218     tty->print_cr("Scanning all metaspace objects ... ");
  1214     tty->print_cr("Scanning all metaspace objects ... ");
  1354 
  1350 
  1355   return buckets_top;
  1351   return buckets_top;
  1356 }
  1352 }
  1357 
  1353 
  1358 void VM_PopulateDumpSharedSpace::doit() {
  1354 void VM_PopulateDumpSharedSpace::doit() {
       
  1355   // We should no longer allocate anything from the metaspace, so that:
       
  1356   //
       
  1357   // (1) Metaspace::allocate might trigger GC if we have run out of
       
  1358   //     committed metaspace, but we can't GC because we're running
       
  1359   //     in the VM thread.
       
  1360   // (2) ArchiveCompactor needs to work with a stable set of MetaspaceObjs.
       
  1361   Metaspace::freeze();
       
  1362 
  1359   Thread* THREAD = VMThread::vm_thread();
  1363   Thread* THREAD = VMThread::vm_thread();
  1360 
  1364 
  1361   FileMapInfo::check_nonempty_dir_in_shared_path_table();
  1365   FileMapInfo::check_nonempty_dir_in_shared_path_table();
  1362 
  1366 
  1363   NOT_PRODUCT(SystemDictionary::verify();)
  1367   NOT_PRODUCT(SystemDictionary::verify();)
  1417   tty->print_cr("done. ");
  1421   tty->print_cr("done. ");
  1418 
  1422 
  1419   // We don't support archiving unsafe anonymous classes. Verify that they are not stored in
  1423   // We don't support archiving unsafe anonymous classes. Verify that they are not stored in
  1420   // any dictionaries.
  1424   // any dictionaries.
  1421   NOT_PRODUCT(assert_no_unsafe_anonymous_classes_in_dictionaries());
  1425   NOT_PRODUCT(assert_no_unsafe_anonymous_classes_in_dictionaries());
  1422 
       
  1423   SystemDictionaryShared::finalize_verification_constraints();
       
  1424 
  1426 
  1425   ArchiveCompactor::initialize();
  1427   ArchiveCompactor::initialize();
  1426   ArchiveCompactor::copy_and_compact();
  1428   ArchiveCompactor::copy_and_compact();
  1427 
  1429 
  1428   dump_symbols();
  1430   dump_symbols();
  1715     link_and_cleanup_shared_classes(CATCH);
  1717     link_and_cleanup_shared_classes(CATCH);
  1716     tty->print_cr("Rewriting and linking classes: done");
  1718     tty->print_cr("Rewriting and linking classes: done");
  1717 
  1719 
  1718     SystemDictionary::clear_invoke_method_table();
  1720     SystemDictionary::clear_invoke_method_table();
  1719 
  1721 
       
  1722     SystemDictionaryShared::finalize_verification_constraints();
       
  1723 
  1720     VM_PopulateDumpSharedSpace op;
  1724     VM_PopulateDumpSharedSpace op;
  1721     VMThread::execute(&op);
  1725     VMThread::execute(&op);
  1722   }
  1726   }
  1723 }
  1727 }
  1724 
  1728