hotspot/src/share/vm/runtime/arguments.cpp
changeset 15936 4fda1079e8a3
parent 15800 55dcad6bc1a5
child 15940 601d4955fa75
equal deleted inserted replaced
15865:adfe8db1e959 15936:4fda1079e8a3
  2271           size_t len2 = strlen(pos+1) + 1; // options start after ':'.  Final zero must be copied.
  2271           size_t len2 = strlen(pos+1) + 1; // options start after ':'.  Final zero must be copied.
  2272           options = (char*)memcpy(NEW_C_HEAP_ARRAY(char, len2, mtInternal), pos+1, len2);
  2272           options = (char*)memcpy(NEW_C_HEAP_ARRAY(char, len2, mtInternal), pos+1, len2);
  2273         }
  2273         }
  2274 #if !INCLUDE_JVMTI
  2274 #if !INCLUDE_JVMTI
  2275         if ((strcmp(name, "hprof") == 0) || (strcmp(name, "jdwp") == 0)) {
  2275         if ((strcmp(name, "hprof") == 0) || (strcmp(name, "jdwp") == 0)) {
  2276           warning("profiling and debugging agents are not supported in this VM");
  2276           jio_fprintf(defaultStream::error_stream(),
  2277         } else
  2277             "Profiling and debugging agents are not supported in this VM\n");
       
  2278           return JNI_ERR;
       
  2279         }
  2278 #endif // !INCLUDE_JVMTI
  2280 #endif // !INCLUDE_JVMTI
  2279           add_init_library(name, options);
  2281         add_init_library(name, options);
  2280       }
  2282       }
  2281     // -agentlib and -agentpath
  2283     // -agentlib and -agentpath
  2282     } else if (match_option(option, "-agentlib:", &tail) ||
  2284     } else if (match_option(option, "-agentlib:", &tail) ||
  2283           (is_absolute_path = match_option(option, "-agentpath:", &tail))) {
  2285           (is_absolute_path = match_option(option, "-agentpath:", &tail))) {
  2284       if(tail != NULL) {
  2286       if(tail != NULL) {
  2291         if(pos != NULL) {
  2293         if(pos != NULL) {
  2292           options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(pos + 1) + 1, mtInternal), pos + 1);
  2294           options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(pos + 1) + 1, mtInternal), pos + 1);
  2293         }
  2295         }
  2294 #if !INCLUDE_JVMTI
  2296 #if !INCLUDE_JVMTI
  2295         if ((strcmp(name, "hprof") == 0) || (strcmp(name, "jdwp") == 0)) {
  2297         if ((strcmp(name, "hprof") == 0) || (strcmp(name, "jdwp") == 0)) {
  2296           warning("profiling and debugging agents are not supported in this VM");
  2298           jio_fprintf(defaultStream::error_stream(),
  2297         } else
  2299             "Profiling and debugging agents are not supported in this VM\n");
       
  2300           return JNI_ERR;
       
  2301         }
  2298 #endif // !INCLUDE_JVMTI
  2302 #endif // !INCLUDE_JVMTI
  2299         add_init_agent(name, options, is_absolute_path);
  2303         add_init_agent(name, options, is_absolute_path);
  2300 
       
  2301       }
  2304       }
  2302     // -javaagent
  2305     // -javaagent
  2303     } else if (match_option(option, "-javaagent:", &tail)) {
  2306     } else if (match_option(option, "-javaagent:", &tail)) {
  2304 #if !INCLUDE_JVMTI
  2307 #if !INCLUDE_JVMTI
  2305       warning("Instrumentation agents are not supported in this VM");
  2308       jio_fprintf(defaultStream::error_stream(),
       
  2309         "Instrumentation agents are not supported in this VM\n");
       
  2310       return JNI_ERR;
  2306 #else
  2311 #else
  2307       if(tail != NULL) {
  2312       if(tail != NULL) {
  2308         char *options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(tail) + 1, mtInternal), tail);
  2313         char *options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(tail) + 1, mtInternal), tail);
  2309         add_init_agent("instrument", options, false);
  2314         add_init_agent("instrument", options, false);
  2310       }
  2315       }
  2441     // -Xprof
  2446     // -Xprof
  2442     } else if (match_option(option, "-Xprof", &tail)) {
  2447     } else if (match_option(option, "-Xprof", &tail)) {
  2443 #if INCLUDE_FPROF
  2448 #if INCLUDE_FPROF
  2444       _has_profile = true;
  2449       _has_profile = true;
  2445 #else // INCLUDE_FPROF
  2450 #else // INCLUDE_FPROF
  2446       // do we have to exit?
  2451       jio_fprintf(defaultStream::error_stream(),
  2447       warning("Flat profiling is not supported in this VM.");
  2452         "Flat profiling is not supported in this VM.\n");
       
  2453       return JNI_ERR;
  2448 #endif // INCLUDE_FPROF
  2454 #endif // INCLUDE_FPROF
  2449     // -Xaprof
  2455     // -Xaprof
  2450     } else if (match_option(option, "-Xaprof", &tail)) {
  2456     } else if (match_option(option, "-Xaprof", &tail)) {
  2451       _has_alloc_profile = true;
  2457       _has_alloc_profile = true;
  2452     // -Xconcurrentio
  2458     // -Xconcurrentio
  2476       // Out of the box management support
  2482       // Out of the box management support
  2477       if (match_option(option, "-Dcom.sun.management", &tail)) {
  2483       if (match_option(option, "-Dcom.sun.management", &tail)) {
  2478 #if INCLUDE_MANAGEMENT
  2484 #if INCLUDE_MANAGEMENT
  2479         FLAG_SET_CMDLINE(bool, ManagementServer, true);
  2485         FLAG_SET_CMDLINE(bool, ManagementServer, true);
  2480 #else
  2486 #else
  2481         vm_exit_during_initialization(
  2487         jio_fprintf(defaultStream::output_stream(),
  2482             "-Dcom.sun.management is not supported in this VM.", NULL);
  2488           "-Dcom.sun.management is not supported in this VM.\n");
       
  2489         return JNI_ERR;
  2483 #endif
  2490 #endif
  2484       }
  2491       }
  2485     // -Xint
  2492     // -Xint
  2486     } else if (match_option(option, "-Xint", &tail)) {
  2493     } else if (match_option(option, "-Xint", &tail)) {
  2487           set_mode_flags(_int);
  2494           set_mode_flags(_int);
  2490           set_mode_flags(_mixed);
  2497           set_mode_flags(_mixed);
  2491     // -Xcomp
  2498     // -Xcomp
  2492     } else if (match_option(option, "-Xcomp", &tail)) {
  2499     } else if (match_option(option, "-Xcomp", &tail)) {
  2493       // for testing the compiler; turn off all flags that inhibit compilation
  2500       // for testing the compiler; turn off all flags that inhibit compilation
  2494           set_mode_flags(_comp);
  2501           set_mode_flags(_comp);
  2495 
       
  2496     // -Xshare:dump
  2502     // -Xshare:dump
  2497     } else if (match_option(option, "-Xshare:dump", &tail)) {
  2503     } else if (match_option(option, "-Xshare:dump", &tail)) {
  2498 #if !INCLUDE_CDS
       
  2499       vm_exit_during_initialization(
       
  2500           "Dumping a shared archive is not supported in this VM.", NULL);
       
  2501 #else
       
  2502       FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true);
  2504       FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true);
  2503       set_mode_flags(_int);     // Prevent compilation, which creates objects
  2505       set_mode_flags(_int);     // Prevent compilation, which creates objects
  2504 #endif
       
  2505     // -Xshare:on
  2506     // -Xshare:on
  2506     } else if (match_option(option, "-Xshare:on", &tail)) {
  2507     } else if (match_option(option, "-Xshare:on", &tail)) {
  2507       FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
  2508       FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
  2508       FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true);
  2509       FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true);
  2509     // -Xshare:auto
  2510     // -Xshare:auto
  2512       FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false);
  2513       FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false);
  2513     // -Xshare:off
  2514     // -Xshare:off
  2514     } else if (match_option(option, "-Xshare:off", &tail)) {
  2515     } else if (match_option(option, "-Xshare:off", &tail)) {
  2515       FLAG_SET_CMDLINE(bool, UseSharedSpaces, false);
  2516       FLAG_SET_CMDLINE(bool, UseSharedSpaces, false);
  2516       FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false);
  2517       FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false);
  2517 
       
  2518     // -Xverify
  2518     // -Xverify
  2519     } else if (match_option(option, "-Xverify", &tail)) {
  2519     } else if (match_option(option, "-Xverify", &tail)) {
  2520       if (strcmp(tail, ":all") == 0 || strcmp(tail, "") == 0) {
  2520       if (strcmp(tail, ":all") == 0 || strcmp(tail, "") == 0) {
  2521         FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, true);
  2521         FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, true);
  2522         FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, true);
  2522         FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, true);
  2826       //       away and will cause VM initialization failures!
  2826       //       away and will cause VM initialization failures!
  2827       warning("-XX:+UseVMInterruptibleIO is obsolete and will be removed in a future release.");
  2827       warning("-XX:+UseVMInterruptibleIO is obsolete and will be removed in a future release.");
  2828       FLAG_SET_CMDLINE(bool, UseVMInterruptibleIO, true);
  2828       FLAG_SET_CMDLINE(bool, UseVMInterruptibleIO, true);
  2829 #if !INCLUDE_MANAGEMENT
  2829 #if !INCLUDE_MANAGEMENT
  2830     } else if (match_option(option, "-XX:+ManagementServer", &tail)) {
  2830     } else if (match_option(option, "-XX:+ManagementServer", &tail)) {
  2831       vm_exit_during_initialization(
  2831         jio_fprintf(defaultStream::error_stream(),
  2832         "ManagementServer is not supported in this VM.", NULL);
  2832           "ManagementServer is not supported in this VM.\n");
       
  2833         return JNI_ERR;
  2833 #endif // INCLUDE_MANAGEMENT
  2834 #endif // INCLUDE_MANAGEMENT
  2834     } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx
  2835     } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx
  2835       // Skip -XX:Flags= since that case has already been handled
  2836       // Skip -XX:Flags= since that case has already been handled
  2836       if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) {
  2837       if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) {
  2837         if (!process_argument(tail, args->ignoreUnrecognized, origin)) {
  2838         if (!process_argument(tail, args->ignoreUnrecognized, origin)) {
  3133     }
  3134     }
  3134     if (match_option(option, "-XX:NativeMemoryTracking", &tail)) {
  3135     if (match_option(option, "-XX:NativeMemoryTracking", &tail)) {
  3135 #if INCLUDE_NMT
  3136 #if INCLUDE_NMT
  3136       MemTracker::init_tracking_options(tail);
  3137       MemTracker::init_tracking_options(tail);
  3137 #else
  3138 #else
  3138       warning("Native Memory Tracking is not supported in this VM");
  3139       jio_fprintf(defaultStream::error_stream(),
       
  3140         "Native Memory Tracking is not supported in this VM\n");
       
  3141       return JNI_ERR;
  3139 #endif
  3142 #endif
  3140     }
  3143     }
  3141 
  3144 
  3142 
  3145 
  3143 #ifndef PRODUCT
  3146 #ifndef PRODUCT
  3252 
  3255 
  3253 #if !INCLUDE_ALL_GCS
  3256 #if !INCLUDE_ALL_GCS
  3254   force_serial_gc();
  3257   force_serial_gc();
  3255 #endif // INCLUDE_ALL_GCS
  3258 #endif // INCLUDE_ALL_GCS
  3256 #if !INCLUDE_CDS
  3259 #if !INCLUDE_CDS
       
  3260   if (DumpSharedSpaces || RequireSharedSpaces) {
       
  3261     jio_fprintf(defaultStream::error_stream(),
       
  3262       "Shared spaces are not supported in this VM\n");
       
  3263     return JNI_ERR;
       
  3264   }
       
  3265   if (UseSharedSpaces || PrintSharedSpaces) {
       
  3266     warning("Shared spaces are not supported in this VM");
       
  3267     FLAG_SET_DEFAULT(UseSharedSpaces, false);
       
  3268     FLAG_SET_DEFAULT(PrintSharedSpaces, false);
       
  3269   }
  3257   no_shared_spaces();
  3270   no_shared_spaces();
  3258 #endif // INCLUDE_CDS
  3271 #endif // INCLUDE_CDS
  3259 
  3272 
  3260   // Set flags based on ergonomics.
  3273   // Set flags based on ergonomics.
  3261   set_ergonomics_flags();
  3274   set_ergonomics_flags();