comparison src/share/vm/runtime/arguments.cpp @ 8746:0631ebcc45f0 hs25-b23

Merge
author amurillo
date Fri, 15 Mar 2013 11:18:39 -0700
parents 11d5942ef9c7 15401203db6b
children 36376b540a98 7f16d1812865
comparison
equal deleted inserted replaced
8707:5ee744831dcb 8746:0631ebcc45f0
1379 return true; 1379 return true;
1380 } 1380 }
1381 return false; 1381 return false;
1382 } 1382 }
1383 1383
1384 void Arguments::set_use_compressed_oops() {
1385 #ifndef ZERO
1386 #ifdef _LP64
1387 // MaxHeapSize is not set up properly at this point, but
1388 // the only value that can override MaxHeapSize if we are
1389 // to use UseCompressedOops is InitialHeapSize.
1390 size_t max_heap_size = MAX2(MaxHeapSize, InitialHeapSize);
1391
1392 if (max_heap_size <= max_heap_for_compressed_oops()) {
1393 #if !defined(COMPILER1) || defined(TIERED)
1394 if (FLAG_IS_DEFAULT(UseCompressedOops)) {
1395 FLAG_SET_ERGO(bool, UseCompressedOops, true);
1396 }
1397 #endif
1398 #ifdef _WIN64
1399 if (UseLargePages && UseCompressedOops) {
1400 // Cannot allocate guard pages for implicit checks in indexed addressing
1401 // mode, when large pages are specified on windows.
1402 // This flag could be switched ON if narrow oop base address is set to 0,
1403 // see code in Universe::initialize_heap().
1404 Universe::set_narrow_oop_use_implicit_null_checks(false);
1405 }
1406 #endif // _WIN64
1407 } else {
1408 if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) {
1409 warning("Max heap size too large for Compressed Oops");
1410 FLAG_SET_DEFAULT(UseCompressedOops, false);
1411 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
1412 }
1413 }
1414 #endif // _LP64
1415 #endif // ZERO
1416 }
1417
1384 void Arguments::set_ergonomics_flags() { 1418 void Arguments::set_ergonomics_flags() {
1385 1419
1386 if (os::is_server_class_machine()) { 1420 if (os::is_server_class_machine()) {
1387 // If no other collector is requested explicitly, 1421 // If no other collector is requested explicitly,
1388 // let the VM select the collector based on 1422 // let the VM select the collector based on
1408 } 1442 }
1409 } 1443 }
1410 1444
1411 #ifndef ZERO 1445 #ifndef ZERO
1412 #ifdef _LP64 1446 #ifdef _LP64
1413 // Check that UseCompressedOops can be set with the max heap size allocated 1447 set_use_compressed_oops();
1414 // by ergonomics.
1415 if (MaxHeapSize <= max_heap_for_compressed_oops()) {
1416 #if !defined(COMPILER1) || defined(TIERED)
1417 if (FLAG_IS_DEFAULT(UseCompressedOops)) {
1418 FLAG_SET_ERGO(bool, UseCompressedOops, true);
1419 }
1420 #endif
1421 #ifdef _WIN64
1422 if (UseLargePages && UseCompressedOops) {
1423 // Cannot allocate guard pages for implicit checks in indexed addressing
1424 // mode, when large pages are specified on windows.
1425 // This flag could be switched ON if narrow oop base address is set to 0,
1426 // see code in Universe::initialize_heap().
1427 Universe::set_narrow_oop_use_implicit_null_checks(false);
1428 }
1429 #endif // _WIN64
1430 } else {
1431 if (UseCompressedOops && !FLAG_IS_DEFAULT(UseCompressedOops)) {
1432 warning("Max heap size too large for Compressed Oops");
1433 FLAG_SET_DEFAULT(UseCompressedOops, false);
1434 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
1435 }
1436 }
1437 // UseCompressedOops must be on for UseCompressedKlassPointers to be on. 1448 // UseCompressedOops must be on for UseCompressedKlassPointers to be on.
1438 if (!UseCompressedOops) { 1449 if (!UseCompressedOops) {
1439 if (UseCompressedKlassPointers) { 1450 if (UseCompressedKlassPointers) {
1440 warning("UseCompressedKlassPointers requires UseCompressedOops"); 1451 warning("UseCompressedKlassPointers requires UseCompressedOops");
1441 } 1452 }
1808 "and will likely be removed in a future release"); 1819 "and will likely be removed in a future release");
1809 } 1820 }
1810 1821
1811 if (CMSIncrementalMode) { 1822 if (CMSIncrementalMode) {
1812 warning("Using incremental CMS is deprecated and will likely be removed in a future release"); 1823 warning("Using incremental CMS is deprecated and will likely be removed in a future release");
1824 }
1825 }
1826
1827 void Arguments::check_deprecated_gc_flags() {
1828 if (FLAG_IS_CMDLINE(MaxGCMinorPauseMillis)) {
1829 warning("Using MaxGCMinorPauseMillis as minor pause goal is deprecated"
1830 "and will likely be removed in future release");
1813 } 1831 }
1814 } 1832 }
1815 1833
1816 // Check stack pages settings 1834 // Check stack pages settings
1817 bool Arguments::check_stack_pages() 1835 bool Arguments::check_stack_pages()
2271 size_t len2 = strlen(pos+1) + 1; // options start after ':'. Final zero must be copied. 2289 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); 2290 options = (char*)memcpy(NEW_C_HEAP_ARRAY(char, len2, mtInternal), pos+1, len2);
2273 } 2291 }
2274 #if !INCLUDE_JVMTI 2292 #if !INCLUDE_JVMTI
2275 if ((strcmp(name, "hprof") == 0) || (strcmp(name, "jdwp") == 0)) { 2293 if ((strcmp(name, "hprof") == 0) || (strcmp(name, "jdwp") == 0)) {
2276 warning("profiling and debugging agents are not supported in this VM"); 2294 jio_fprintf(defaultStream::error_stream(),
2277 } else 2295 "Profiling and debugging agents are not supported in this VM\n");
2296 return JNI_ERR;
2297 }
2278 #endif // !INCLUDE_JVMTI 2298 #endif // !INCLUDE_JVMTI
2279 add_init_library(name, options); 2299 add_init_library(name, options);
2280 } 2300 }
2281 // -agentlib and -agentpath 2301 // -agentlib and -agentpath
2282 } else if (match_option(option, "-agentlib:", &tail) || 2302 } else if (match_option(option, "-agentlib:", &tail) ||
2283 (is_absolute_path = match_option(option, "-agentpath:", &tail))) { 2303 (is_absolute_path = match_option(option, "-agentpath:", &tail))) {
2284 if(tail != NULL) { 2304 if(tail != NULL) {
2291 if(pos != NULL) { 2311 if(pos != NULL) {
2292 options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(pos + 1) + 1, mtInternal), pos + 1); 2312 options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(pos + 1) + 1, mtInternal), pos + 1);
2293 } 2313 }
2294 #if !INCLUDE_JVMTI 2314 #if !INCLUDE_JVMTI
2295 if ((strcmp(name, "hprof") == 0) || (strcmp(name, "jdwp") == 0)) { 2315 if ((strcmp(name, "hprof") == 0) || (strcmp(name, "jdwp") == 0)) {
2296 warning("profiling and debugging agents are not supported in this VM"); 2316 jio_fprintf(defaultStream::error_stream(),
2297 } else 2317 "Profiling and debugging agents are not supported in this VM\n");
2318 return JNI_ERR;
2319 }
2298 #endif // !INCLUDE_JVMTI 2320 #endif // !INCLUDE_JVMTI
2299 add_init_agent(name, options, is_absolute_path); 2321 add_init_agent(name, options, is_absolute_path);
2300
2301 } 2322 }
2302 // -javaagent 2323 // -javaagent
2303 } else if (match_option(option, "-javaagent:", &tail)) { 2324 } else if (match_option(option, "-javaagent:", &tail)) {
2304 #if !INCLUDE_JVMTI 2325 #if !INCLUDE_JVMTI
2305 warning("Instrumentation agents are not supported in this VM"); 2326 jio_fprintf(defaultStream::error_stream(),
2327 "Instrumentation agents are not supported in this VM\n");
2328 return JNI_ERR;
2306 #else 2329 #else
2307 if(tail != NULL) { 2330 if(tail != NULL) {
2308 char *options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(tail) + 1, mtInternal), tail); 2331 char *options = strcpy(NEW_C_HEAP_ARRAY(char, strlen(tail) + 1, mtInternal), tail);
2309 add_init_agent("instrument", options, false); 2332 add_init_agent("instrument", options, false);
2310 } 2333 }
2441 // -Xprof 2464 // -Xprof
2442 } else if (match_option(option, "-Xprof", &tail)) { 2465 } else if (match_option(option, "-Xprof", &tail)) {
2443 #if INCLUDE_FPROF 2466 #if INCLUDE_FPROF
2444 _has_profile = true; 2467 _has_profile = true;
2445 #else // INCLUDE_FPROF 2468 #else // INCLUDE_FPROF
2446 // do we have to exit? 2469 jio_fprintf(defaultStream::error_stream(),
2447 warning("Flat profiling is not supported in this VM."); 2470 "Flat profiling is not supported in this VM.\n");
2471 return JNI_ERR;
2448 #endif // INCLUDE_FPROF 2472 #endif // INCLUDE_FPROF
2449 // -Xaprof 2473 // -Xaprof
2450 } else if (match_option(option, "-Xaprof", &tail)) { 2474 } else if (match_option(option, "-Xaprof", &tail)) {
2451 _has_alloc_profile = true; 2475 _has_alloc_profile = true;
2452 // -Xconcurrentio 2476 // -Xconcurrentio
2476 // Out of the box management support 2500 // Out of the box management support
2477 if (match_option(option, "-Dcom.sun.management", &tail)) { 2501 if (match_option(option, "-Dcom.sun.management", &tail)) {
2478 #if INCLUDE_MANAGEMENT 2502 #if INCLUDE_MANAGEMENT
2479 FLAG_SET_CMDLINE(bool, ManagementServer, true); 2503 FLAG_SET_CMDLINE(bool, ManagementServer, true);
2480 #else 2504 #else
2481 vm_exit_during_initialization( 2505 jio_fprintf(defaultStream::output_stream(),
2482 "-Dcom.sun.management is not supported in this VM.", NULL); 2506 "-Dcom.sun.management is not supported in this VM.\n");
2507 return JNI_ERR;
2483 #endif 2508 #endif
2484 } 2509 }
2485 // -Xint 2510 // -Xint
2486 } else if (match_option(option, "-Xint", &tail)) { 2511 } else if (match_option(option, "-Xint", &tail)) {
2487 set_mode_flags(_int); 2512 set_mode_flags(_int);
2490 set_mode_flags(_mixed); 2515 set_mode_flags(_mixed);
2491 // -Xcomp 2516 // -Xcomp
2492 } else if (match_option(option, "-Xcomp", &tail)) { 2517 } else if (match_option(option, "-Xcomp", &tail)) {
2493 // for testing the compiler; turn off all flags that inhibit compilation 2518 // for testing the compiler; turn off all flags that inhibit compilation
2494 set_mode_flags(_comp); 2519 set_mode_flags(_comp);
2495
2496 // -Xshare:dump 2520 // -Xshare:dump
2497 } else if (match_option(option, "-Xshare:dump", &tail)) { 2521 } 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); 2522 FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true);
2503 set_mode_flags(_int); // Prevent compilation, which creates objects 2523 set_mode_flags(_int); // Prevent compilation, which creates objects
2504 #endif
2505 // -Xshare:on 2524 // -Xshare:on
2506 } else if (match_option(option, "-Xshare:on", &tail)) { 2525 } else if (match_option(option, "-Xshare:on", &tail)) {
2507 FLAG_SET_CMDLINE(bool, UseSharedSpaces, true); 2526 FLAG_SET_CMDLINE(bool, UseSharedSpaces, true);
2508 FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true); 2527 FLAG_SET_CMDLINE(bool, RequireSharedSpaces, true);
2509 // -Xshare:auto 2528 // -Xshare:auto
2512 FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false); 2531 FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false);
2513 // -Xshare:off 2532 // -Xshare:off
2514 } else if (match_option(option, "-Xshare:off", &tail)) { 2533 } else if (match_option(option, "-Xshare:off", &tail)) {
2515 FLAG_SET_CMDLINE(bool, UseSharedSpaces, false); 2534 FLAG_SET_CMDLINE(bool, UseSharedSpaces, false);
2516 FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false); 2535 FLAG_SET_CMDLINE(bool, RequireSharedSpaces, false);
2517
2518 // -Xverify 2536 // -Xverify
2519 } else if (match_option(option, "-Xverify", &tail)) { 2537 } else if (match_option(option, "-Xverify", &tail)) {
2520 if (strcmp(tail, ":all") == 0 || strcmp(tail, "") == 0) { 2538 if (strcmp(tail, ":all") == 0 || strcmp(tail, "") == 0) {
2521 FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, true); 2539 FLAG_SET_CMDLINE(bool, BytecodeVerificationLocal, true);
2522 FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, true); 2540 FLAG_SET_CMDLINE(bool, BytecodeVerificationRemote, true);
2826 // away and will cause VM initialization failures! 2844 // away and will cause VM initialization failures!
2827 warning("-XX:+UseVMInterruptibleIO is obsolete and will be removed in a future release."); 2845 warning("-XX:+UseVMInterruptibleIO is obsolete and will be removed in a future release.");
2828 FLAG_SET_CMDLINE(bool, UseVMInterruptibleIO, true); 2846 FLAG_SET_CMDLINE(bool, UseVMInterruptibleIO, true);
2829 #if !INCLUDE_MANAGEMENT 2847 #if !INCLUDE_MANAGEMENT
2830 } else if (match_option(option, "-XX:+ManagementServer", &tail)) { 2848 } else if (match_option(option, "-XX:+ManagementServer", &tail)) {
2831 vm_exit_during_initialization( 2849 jio_fprintf(defaultStream::error_stream(),
2832 "ManagementServer is not supported in this VM.", NULL); 2850 "ManagementServer is not supported in this VM.\n");
2851 return JNI_ERR;
2833 #endif // INCLUDE_MANAGEMENT 2852 #endif // INCLUDE_MANAGEMENT
2834 } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx 2853 } else if (match_option(option, "-XX:", &tail)) { // -XX:xxxx
2835 // Skip -XX:Flags= since that case has already been handled 2854 // Skip -XX:Flags= since that case has already been handled
2836 if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) { 2855 if (strncmp(tail, "Flags=", strlen("Flags=")) != 0) {
2837 if (!process_argument(tail, args->ignoreUnrecognized, origin)) { 2856 if (!process_argument(tail, args->ignoreUnrecognized, origin)) {
3133 } 3152 }
3134 if (match_option(option, "-XX:NativeMemoryTracking", &tail)) { 3153 if (match_option(option, "-XX:NativeMemoryTracking", &tail)) {
3135 #if INCLUDE_NMT 3154 #if INCLUDE_NMT
3136 MemTracker::init_tracking_options(tail); 3155 MemTracker::init_tracking_options(tail);
3137 #else 3156 #else
3138 warning("Native Memory Tracking is not supported in this VM"); 3157 jio_fprintf(defaultStream::error_stream(),
3158 "Native Memory Tracking is not supported in this VM\n");
3159 return JNI_ERR;
3139 #endif 3160 #endif
3140 } 3161 }
3141 3162
3142 3163
3143 #ifndef PRODUCT 3164 #ifndef PRODUCT
3252 3273
3253 #if !INCLUDE_ALL_GCS 3274 #if !INCLUDE_ALL_GCS
3254 force_serial_gc(); 3275 force_serial_gc();
3255 #endif // INCLUDE_ALL_GCS 3276 #endif // INCLUDE_ALL_GCS
3256 #if !INCLUDE_CDS 3277 #if !INCLUDE_CDS
3278 if (DumpSharedSpaces || RequireSharedSpaces) {
3279 jio_fprintf(defaultStream::error_stream(),
3280 "Shared spaces are not supported in this VM\n");
3281 return JNI_ERR;
3282 }
3283 if ((UseSharedSpaces && FLAG_IS_CMDLINE(UseSharedSpaces)) || PrintSharedSpaces) {
3284 warning("Shared spaces are not supported in this VM");
3285 FLAG_SET_DEFAULT(UseSharedSpaces, false);
3286 FLAG_SET_DEFAULT(PrintSharedSpaces, false);
3287 }
3257 no_shared_spaces(); 3288 no_shared_spaces();
3258 #endif // INCLUDE_CDS 3289 #endif // INCLUDE_CDS
3259 3290
3260 // Set flags based on ergonomics. 3291 // Set flags based on ergonomics.
3261 set_ergonomics_flags(); 3292 set_ergonomics_flags();
3290 set_parnew_gc_flags(); 3321 set_parnew_gc_flags();
3291 } else if (UseG1GC) { 3322 } else if (UseG1GC) {
3292 set_g1_gc_flags(); 3323 set_g1_gc_flags();
3293 } 3324 }
3294 check_deprecated_gcs(); 3325 check_deprecated_gcs();
3326 check_deprecated_gc_flags();
3295 #else // INCLUDE_ALL_GCS 3327 #else // INCLUDE_ALL_GCS
3296 assert(verify_serial_gc_flags(), "SerialGC unset"); 3328 assert(verify_serial_gc_flags(), "SerialGC unset");
3297 #endif // INCLUDE_ALL_GCS 3329 #endif // INCLUDE_ALL_GCS
3298 3330
3299 // Set bytecode rewriting flags 3331 // Set bytecode rewriting flags