hotspot/src/share/vm/memory/metaspaceShared.cpp
changeset 33148 68fa8b6c4340
parent 31362 8957ccbb5821
child 33628 09241459a8b8
child 33602 16053580a684
equal deleted inserted replaced
33146:77349b58b4c0 33148:68fa8b6c4340
    41 #include "runtime/os.hpp"
    41 #include "runtime/os.hpp"
    42 #include "runtime/signature.hpp"
    42 #include "runtime/signature.hpp"
    43 #include "runtime/vmThread.hpp"
    43 #include "runtime/vmThread.hpp"
    44 #include "runtime/vm_operations.hpp"
    44 #include "runtime/vm_operations.hpp"
    45 #include "utilities/hashtable.inline.hpp"
    45 #include "utilities/hashtable.inline.hpp"
    46 
       
    47 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
       
    48 
    46 
    49 int MetaspaceShared::_max_alignment = 0;
    47 int MetaspaceShared::_max_alignment = 0;
    50 
    48 
    51 ReservedSpace* MetaspaceShared::_shared_rs = NULL;
    49 ReservedSpace* MetaspaceShared::_shared_rs = NULL;
    52 
    50 
   576   MetaspaceShared::serialize(&wc);
   574   MetaspaceShared::serialize(&wc);
   577   md_top = wc.get_top();
   575   md_top = wc.get_top();
   578 
   576 
   579   // Print shared spaces all the time
   577   // Print shared spaces all the time
   580 // To make fmt_space be a syntactic constant (for format warnings), use #define.
   578 // To make fmt_space be a syntactic constant (for format warnings), use #define.
   581 #define fmt_space "%s space: %9d [ %4.1f%% of total] out of %9d bytes [%4.1f%% used] at " INTPTR_FORMAT
   579 #define fmt_space "%s space: " SIZE_FORMAT_W(9) " [ %4.1f%% of total] out of " SIZE_FORMAT_W(9) " bytes [%4.1f%% used] at " INTPTR_FORMAT
   582   Metaspace* ro_space = _loader_data->ro_metaspace();
   580   Metaspace* ro_space = _loader_data->ro_metaspace();
   583   Metaspace* rw_space = _loader_data->rw_metaspace();
   581   Metaspace* rw_space = _loader_data->rw_metaspace();
   584 
   582 
   585   // Allocated size of each space (may not be all occupied)
   583   // Allocated size of each space (may not be all occupied)
   586   const size_t ro_alloced = ro_space->capacity_bytes_slow(Metaspace::NonClassType);
   584   const size_t ro_alloced = ro_space->capacity_bytes_slow(Metaspace::NonClassType);
   609   const double rw_u_perc = rw_bytes / double(rw_alloced) * 100.0;
   607   const double rw_u_perc = rw_bytes / double(rw_alloced) * 100.0;
   610   const double md_u_perc = md_bytes / double(md_alloced) * 100.0;
   608   const double md_u_perc = md_bytes / double(md_alloced) * 100.0;
   611   const double mc_u_perc = mc_bytes / double(mc_alloced) * 100.0;
   609   const double mc_u_perc = mc_bytes / double(mc_alloced) * 100.0;
   612   const double total_u_perc = total_bytes / double(total_alloced) * 100.0;
   610   const double total_u_perc = total_bytes / double(total_alloced) * 100.0;
   613 
   611 
   614   tty->print_cr(fmt_space, "ro", ro_bytes, ro_t_perc, ro_alloced, ro_u_perc, ro_space->bottom());
   612   tty->print_cr(fmt_space, "ro", ro_bytes, ro_t_perc, ro_alloced, ro_u_perc, p2i(ro_space->bottom()));
   615   tty->print_cr(fmt_space, "rw", rw_bytes, rw_t_perc, rw_alloced, rw_u_perc, rw_space->bottom());
   613   tty->print_cr(fmt_space, "rw", rw_bytes, rw_t_perc, rw_alloced, rw_u_perc, p2i(rw_space->bottom()));
   616   tty->print_cr(fmt_space, "md", md_bytes, md_t_perc, md_alloced, md_u_perc, md_low);
   614   tty->print_cr(fmt_space, "md", md_bytes, md_t_perc, md_alloced, md_u_perc, p2i(md_low));
   617   tty->print_cr(fmt_space, "mc", mc_bytes, mc_t_perc, mc_alloced, mc_u_perc, mc_low);
   615   tty->print_cr(fmt_space, "mc", mc_bytes, mc_t_perc, mc_alloced, mc_u_perc, p2i(mc_low));
   618   tty->print_cr(fmt_space, "st", ss_bytes, ss_t_perc, ss_bytes, 100.0, ss_low);
   616   tty->print_cr(fmt_space, "st", ss_bytes, ss_t_perc, ss_bytes,   100.0,     p2i(ss_low));
   619   tty->print_cr("total   : %9d [100.0%% of total] out of %9d bytes [%4.1f%% used]",
   617   tty->print_cr("total   : " SIZE_FORMAT_W(9) " [100.0%% of total] out of " SIZE_FORMAT_W(9) " bytes [%4.1f%% used]",
   620                  total_bytes, total_alloced, total_u_perc);
   618                  total_bytes, total_alloced, total_u_perc);
   621 
   619 
   622   // Update the vtable pointers in all of the Klass objects in the
   620   // Update the vtable pointers in all of the Klass objects in the
   623   // heap. They should point to newly generated vtable.
   621   // heap. They should point to newly generated vtable.
   624   patch_klass_vtables(vtbl_list, vtable);
   622   patch_klass_vtables(vtbl_list, vtable);
   736 // file.
   734 // file.
   737 void MetaspaceShared::preload_and_dump(TRAPS) {
   735 void MetaspaceShared::preload_and_dump(TRAPS) {
   738   TraceTime timer("Dump Shared Spaces", TraceStartupTime);
   736   TraceTime timer("Dump Shared Spaces", TraceStartupTime);
   739   ResourceMark rm;
   737   ResourceMark rm;
   740 
   738 
   741   tty->print_cr("Allocated shared space: %d bytes at " PTR_FORMAT,
   739   tty->print_cr("Allocated shared space: " SIZE_FORMAT " bytes at " PTR_FORMAT,
   742                 MetaspaceShared::shared_rs()->size(),
   740                 MetaspaceShared::shared_rs()->size(),
   743                 MetaspaceShared::shared_rs()->base());
   741                 p2i(MetaspaceShared::shared_rs()->base()));
   744 
   742 
   745   // Preload classes to be shared.
   743   // Preload classes to be shared.
   746   // Should use some os:: method rather than fopen() here. aB.
   744   // Should use some os:: method rather than fopen() here. aB.
   747   const char* class_list_path;
   745   const char* class_list_path;
   748   if (SharedClassListFile == NULL) {
   746   if (SharedClassListFile == NULL) {