src/share/vm/utilities/ostream.cpp

changeset 7089
6e0cb14ce59b
parent 6904
0982ec23da03
child 7476
c2844108a708
     1.1 --- a/src/share/vm/utilities/ostream.cpp	Fri Aug 22 12:03:49 2014 -0700
     1.2 +++ b/src/share/vm/utilities/ostream.cpp	Thu Aug 21 13:57:51 2014 -0700
     1.3 @@ -365,6 +365,7 @@
     1.4  xmlStream*   xtty;
     1.5  outputStream* tty;
     1.6  outputStream* gclog_or_tty;
     1.7 +CDS_ONLY(fileStream* classlist_file;) // Only dump the classes that can be stored into the CDS archive
     1.8  extern Mutex* tty_lock;
     1.9  
    1.10  #define EXTRACHARLEN   32
    1.11 @@ -476,7 +477,8 @@
    1.12    return buf;
    1.13  }
    1.14  
    1.15 -// log_name comes from -XX:LogFile=log_name or -Xloggc:log_name
    1.16 +// log_name comes from -XX:LogFile=log_name, -Xloggc:log_name or
    1.17 +// -XX:DumpLoadedClassList=<file_name>
    1.18  // in log_name, %p => pid1234 and
    1.19  //              %t => YYYY-MM-DD_HH-MM-SS
    1.20  static const char* make_log_name(const char* log_name, const char* force_directory) {
    1.21 @@ -1116,6 +1118,16 @@
    1.22      gclog_or_tty = gclog;
    1.23    }
    1.24  
    1.25 +#if INCLUDE_CDS
    1.26 +  // For -XX:DumpLoadedClassList=<file> option
    1.27 +  if (DumpLoadedClassList != NULL) {
    1.28 +    const char* list_name = make_log_name(DumpLoadedClassList, NULL);
    1.29 +    classlist_file = new(ResourceObj::C_HEAP, mtInternal)
    1.30 +                         fileStream(list_name);
    1.31 +    FREE_C_HEAP_ARRAY(char, list_name, mtInternal);
    1.32 +  }
    1.33 +#endif
    1.34 +
    1.35    // If we haven't lazily initialized the logfile yet, do it now,
    1.36    // to avoid the possibility of lazy initialization during a VM
    1.37    // crash, which can affect the stability of the fatal error handler.
    1.38 @@ -1128,6 +1140,11 @@
    1.39    static bool ostream_exit_called = false;
    1.40    if (ostream_exit_called)  return;
    1.41    ostream_exit_called = true;
    1.42 +#if INCLUDE_CDS
    1.43 +  if (classlist_file != NULL) {
    1.44 +    delete classlist_file;
    1.45 +  }
    1.46 +#endif
    1.47    if (gclog_or_tty != tty) {
    1.48        delete gclog_or_tty;
    1.49    }

mercurial