8008310: Some adjustments needed to minimal VM warnings and errors for unsupported command line options

Wed, 06 Mar 2013 13:38:17 -0500

author
jprovino
date
Wed, 06 Mar 2013 13:38:17 -0500
changeset 4720
fad90b102190
parent 4685
5cf033ff06c4
child 4721
47bc9800972c

8008310: Some adjustments needed to minimal VM warnings and errors for unsupported command line options
Summary: Changes to arguments.cpp for warnings vs. errors. Changes for CDS arguments.
Reviewed-by: coleenp, cjplummer

make/excludeSrc.make file | annotate | diff | comparison | revisions
src/share/vm/memory/filemap.hpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/arguments.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/make/excludeSrc.make	Fri Mar 01 14:06:47 2013 -0500
     1.2 +++ b/make/excludeSrc.make	Wed Mar 06 13:38:17 2013 -0500
     1.3 @@ -69,7 +69,7 @@
     1.4        CXXFLAGS += -DINCLUDE_CDS=0
     1.5        CFLAGS += -DINCLUDE_CDS=0
     1.6  
     1.7 -      Src_Files_EXCLUDE += metaspaceShared.cpp
     1.8 +      Src_Files_EXCLUDE += filemap.cpp metaspaceShared.cpp
     1.9  endif
    1.10  
    1.11  ifeq ($(INCLUDE_ALL_GCS), false)
     2.1 --- a/src/share/vm/memory/filemap.hpp	Fri Mar 01 14:06:47 2013 -0500
     2.2 +++ b/src/share/vm/memory/filemap.hpp	Wed Mar 06 13:38:17 2013 -0500
     2.3 @@ -112,12 +112,19 @@
     2.4    char*  region_base(int i)           { return _header._space[i]._base; }
     2.5    struct FileMapHeader* header()      { return &_header; }
     2.6  
     2.7 -  static void set_current_info(FileMapInfo* info)  { _current_info = info; }
     2.8 -  static FileMapInfo* current_info()  { return _current_info; }
     2.9 +  static void set_current_info(FileMapInfo* info) {
    2.10 +    CDS_ONLY(_current_info = info;)
    2.11 +  }
    2.12 +
    2.13 +  static FileMapInfo* current_info() {
    2.14 +    CDS_ONLY(return _current_info;)
    2.15 +    NOT_CDS(return NULL;)
    2.16 +  }
    2.17 +
    2.18    static void assert_mark(bool check);
    2.19  
    2.20    // File manipulation.
    2.21 -  bool  initialize();
    2.22 +  bool  initialize() NOT_CDS_RETURN_(false);
    2.23    bool  open_for_read();
    2.24    void  open_for_write();
    2.25    void  write_header();
    2.26 @@ -141,7 +148,7 @@
    2.27    void fail_continue(const char *msg, ...);
    2.28  
    2.29    // Return true if given address is in the mapped shared space.
    2.30 -  bool is_in_shared_space(const void* p);
    2.31 +  bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false);
    2.32  };
    2.33  
    2.34  #endif // SHARE_VM_MEMORY_FILEMAP_HPP
     3.1 --- a/src/share/vm/runtime/arguments.cpp	Fri Mar 01 14:06:47 2013 -0500
     3.2 +++ b/src/share/vm/runtime/arguments.cpp	Wed Mar 06 13:38:17 2013 -0500
     3.3 @@ -2273,10 +2273,12 @@
     3.4          }
     3.5  #if !INCLUDE_JVMTI
     3.6          if ((strcmp(name, "hprof") == 0) || (strcmp(name, "jdwp") == 0)) {
     3.7 -          warning("profiling and debugging agents are not supported in this VM");
     3.8 -        } else
     3.9 +          jio_fprintf(defaultStream::error_stream(),
    3.10 +            "Profiling and debugging agents are not supported in this VM\n");
    3.11 +          return JNI_ERR;
    3.12 +        }
    3.13  #endif // !INCLUDE_JVMTI
    3.14 -          add_init_library(name, options);
    3.15 +        add_init_library(name, options);
    3.16        }
    3.17      // -agentlib and -agentpath
    3.18      } else if (match_option(option, "-agentlib:", &tail) ||
    3.19 @@ -2293,16 +2295,19 @@
    3.20          }
    3.21  #if !INCLUDE_JVMTI
    3.22          if ((strcmp(name, "hprof") == 0) || (strcmp(name, "jdwp") == 0)) {
    3.23 -          warning("profiling and debugging agents are not supported in this VM");
    3.24 -        } else
    3.25 +          jio_fprintf(defaultStream::error_stream(),
    3.26 +            "Profiling and debugging agents are not supported in this VM\n");
    3.27 +          return JNI_ERR;
    3.28 +        }
    3.29  #endif // !INCLUDE_JVMTI
    3.30          add_init_agent(name, options, is_absolute_path);
    3.31 -
    3.32        }
    3.33      // -javaagent
    3.34      } else if (match_option(option, "-javaagent:", &tail)) {
    3.35  #if !INCLUDE_JVMTI
    3.36 -      warning("Instrumentation agents are not supported in this VM");
    3.37 +      jio_fprintf(defaultStream::error_stream(),
    3.38 +        "Instrumentation agents are not supported in this VM\n");
    3.39 +      return JNI_ERR;
    3.40  #else
    3.41        if(tail != NULL) {
    3.42          char *options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(tail) + 1, mtInternal), tail);
    3.43 @@ -2443,8 +2448,9 @@
    3.44  #if INCLUDE_FPROF
    3.45        _has_profile = true;
    3.46  #else // INCLUDE_FPROF
    3.47 -      // do we have to exit?
    3.48 -      warning("Flat profiling is not supported in this VM.");
    3.49 +      jio_fprintf(defaultStream::error_stream(),
    3.50 +        "Flat profiling is not supported in this VM.\n");
    3.51 +      return JNI_ERR;
    3.52  #endif // INCLUDE_FPROF
    3.53      // -Xaprof
    3.54      } else if (match_option(option, "-Xaprof", &tail)) {
    3.55 @@ -2478,8 +2484,9 @@
    3.56  #if INCLUDE_MANAGEMENT
    3.57          FLAG_SET_CMDLINE(bool, ManagementServer, true);
    3.58  #else
    3.59 -        vm_exit_during_initialization(
    3.60 -            "-Dcom.sun.management is not supported in this VM.", NULL);
    3.61 +        jio_fprintf(defaultStream::output_stream(),
    3.62 +          "-Dcom.sun.management is not supported in this VM.\n");
    3.63 +        return JNI_ERR;
    3.64  #endif
    3.65        }
    3.66      // -Xint
    3.67 @@ -2492,16 +2499,10 @@
    3.68      } else if (match_option(option, "-Xcomp", &tail)) {
    3.69        // for testing the compiler; turn off all flags that inhibit compilation
    3.70            set_mode_flags(_comp);
    3.71 -
    3.72      // -Xshare:dump
    3.73      } else if (match_option(option, "-Xshare:dump", &tail)) {
    3.74 -#if !INCLUDE_CDS
    3.75 -      vm_exit_during_initialization(
    3.76 -          "Dumping a shared archive is not supported in this VM.", NULL);
    3.77 -#else
    3.78        FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true);
    3.79        set_mode_flags(_int);     // Prevent compilation, which creates objects
    3.80 -#endif
    3.81      // -Xshare:on
    3.82      } else if (match_option(option, "-Xshare:on", &tail)) {
    3.83        FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
    3.84 @@ -2514,7 +2515,6 @@
    3.85      } else if (match_option(option, "-Xshare:off", &tail)) {
    3.86        FLAG_SET_CMDLINE(bool, UseSharedSpaces, false);
    3.87        FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false);
    3.88 -
    3.89      // -Xverify
    3.90      } else if (match_option(option, "-Xverify", &tail)) {
    3.91        if (strcmp(tail, ":all") == 0 || strcmp(tail, "") == 0) {
    3.92 @@ -2828,8 +2828,9 @@
    3.93        FLAG_SET_CMDLINE(bool, UseVMInterruptibleIO, true);
    3.94  #if !INCLUDE_MANAGEMENT
    3.95      } else if (match_option(option, "-XX:+ManagementServer", &tail)) {
    3.96 -      vm_exit_during_initialization(
    3.97 -        "ManagementServer is not supported in this VM.", NULL);
    3.98 +        jio_fprintf(defaultStream::error_stream(),
    3.99 +          "ManagementServer is not supported in this VM.\n");
   3.100 +        return JNI_ERR;
   3.101  #endif // INCLUDE_MANAGEMENT
   3.102      } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx
   3.103        // Skip -XX:Flags= since that case has already been handled
   3.104 @@ -3135,7 +3136,9 @@
   3.105  #if INCLUDE_NMT
   3.106        MemTracker::init_tracking_options(tail);
   3.107  #else
   3.108 -      warning("Native Memory Tracking is not supported in this VM");
   3.109 +      jio_fprintf(defaultStream::error_stream(),
   3.110 +        "Native Memory Tracking is not supported in this VM\n");
   3.111 +      return JNI_ERR;
   3.112  #endif
   3.113      }
   3.114  
   3.115 @@ -3254,6 +3257,16 @@
   3.116    force_serial_gc();
   3.117  #endif // INCLUDE_ALL_GCS
   3.118  #if !INCLUDE_CDS
   3.119 +  if (DumpSharedSpaces || RequireSharedSpaces) {
   3.120 +    jio_fprintf(defaultStream::error_stream(),
   3.121 +      "Shared spaces are not supported in this VM\n");
   3.122 +    return JNI_ERR;
   3.123 +  }
   3.124 +  if (UseSharedSpaces || PrintSharedSpaces) {
   3.125 +    warning("Shared spaces are not supported in this VM");
   3.126 +    FLAG_SET_DEFAULT(UseSharedSpaces, false);
   3.127 +    FLAG_SET_DEFAULT(PrintSharedSpaces, false);
   3.128 +  }
   3.129    no_shared_spaces();
   3.130  #endif // INCLUDE_CDS
   3.131  

mercurial