comparison src/share/vm/runtime/arguments.cpp @ 8037:9425ba04792d

Merge
author brutisso
date Thu, 07 Feb 2013 18:40:45 -0800
parents f64ffbf81af5 10d5f25a7c67
children a83cd101fd62
comparison
equal deleted inserted replaced
8035:f64ffbf81af5 8037:9425ba04792d
825 825
826 if (parse_argument(arg, origin) || ignore_unrecognized) { 826 if (parse_argument(arg, origin) || ignore_unrecognized) {
827 return true; 827 return true;
828 } 828 }
829 829
830 const char * const argname = *arg == '+' || *arg == '-' ? arg + 1 : arg; 830 bool has_plus_minus = (*arg == '+' || *arg == '-');
831 const char* const argname = has_plus_minus ? arg + 1 : arg;
831 if (is_newly_obsolete(arg, &since)) { 832 if (is_newly_obsolete(arg, &since)) {
832 char version[256]; 833 char version[256];
833 since.to_string(version, sizeof(version)); 834 since.to_string(version, sizeof(version));
834 warning("ignoring option %s; support was removed in %s", argname, version); 835 warning("ignoring option %s; support was removed in %s", argname, version);
835 return true; 836 return true;
836 } 837 }
837 838
838 // For locked flags, report a custom error message if available. 839 // For locked flags, report a custom error message if available.
839 // Otherwise, report the standard unrecognized VM option. 840 // Otherwise, report the standard unrecognized VM option.
840 841
841 Flag* locked_flag = Flag::find_flag((char*)argname, strlen(argname), true); 842 size_t arg_len;
842 if (locked_flag != NULL) { 843 const char* equal_sign = strchr(argname, '=');
844 if (equal_sign == NULL) {
845 arg_len = strlen(argname);
846 } else {
847 arg_len = equal_sign - argname;
848 }
849
850 Flag* found_flag = Flag::find_flag((char*)argname, arg_len, true);
851 if (found_flag != NULL) {
843 char locked_message_buf[BUFLEN]; 852 char locked_message_buf[BUFLEN];
844 locked_flag->get_locked_message(locked_message_buf, BUFLEN); 853 found_flag->get_locked_message(locked_message_buf, BUFLEN);
845 if (strlen(locked_message_buf) == 0) { 854 if (strlen(locked_message_buf) == 0) {
846 jio_fprintf(defaultStream::error_stream(), 855 if (found_flag->is_bool() && !has_plus_minus) {
847 "Unrecognized VM option '%s'\n", argname); 856 jio_fprintf(defaultStream::error_stream(),
857 "Missing +/- setting for VM option '%s'\n", argname);
858 } else if (!found_flag->is_bool() && has_plus_minus) {
859 jio_fprintf(defaultStream::error_stream(),
860 "Unexpected +/- setting in VM option '%s'\n", argname);
861 } else {
862 jio_fprintf(defaultStream::error_stream(),
863 "Improperly specified VM option '%s'\n", argname);
864 }
848 } else { 865 } else {
849 jio_fprintf(defaultStream::error_stream(), "%s", locked_message_buf); 866 jio_fprintf(defaultStream::error_stream(), "%s", locked_message_buf);
850 } 867 }
851 } else { 868 } else {
852 jio_fprintf(defaultStream::error_stream(), 869 jio_fprintf(defaultStream::error_stream(),
1427 if (FLAG_IS_DEFAULT(UseCompressedKlassPointers)) { 1444 if (FLAG_IS_DEFAULT(UseCompressedKlassPointers)) {
1428 FLAG_SET_ERGO(bool, UseCompressedKlassPointers, true); 1445 FLAG_SET_ERGO(bool, UseCompressedKlassPointers, true);
1429 } 1446 }
1430 // Set the ClassMetaspaceSize to something that will not need to be 1447 // Set the ClassMetaspaceSize to something that will not need to be
1431 // expanded, since it cannot be expanded. 1448 // expanded, since it cannot be expanded.
1432 if (UseCompressedKlassPointers && FLAG_IS_DEFAULT(ClassMetaspaceSize)) { 1449 if (UseCompressedKlassPointers) {
1433 // 100,000 classes seems like a good size, so 100M assumes around 1K 1450 if (ClassMetaspaceSize > KlassEncodingMetaspaceMax) {
1434 // per klass. The vtable and oopMap is embedded so we don't have a fixed 1451 warning("Class metaspace size is too large for UseCompressedKlassPointers");
1435 // size per klass. Eventually, this will be parameterized because it 1452 FLAG_SET_DEFAULT(UseCompressedKlassPointers, false);
1436 // would also be useful to determine the optimal size of the 1453 } else if (FLAG_IS_DEFAULT(ClassMetaspaceSize)) {
1437 // systemDictionary. 1454 // 100,000 classes seems like a good size, so 100M assumes around 1K
1438 FLAG_SET_ERGO(uintx, ClassMetaspaceSize, 100*M); 1455 // per klass. The vtable and oopMap is embedded so we don't have a fixed
1456 // size per klass. Eventually, this will be parameterized because it
1457 // would also be useful to determine the optimal size of the
1458 // systemDictionary.
1459 FLAG_SET_ERGO(uintx, ClassMetaspaceSize, 100*M);
1460 }
1439 } 1461 }
1440 } 1462 }
1441 // Also checks that certain machines are slower with compressed oops 1463 // Also checks that certain machines are slower with compressed oops
1442 // in vm_version initialization code. 1464 // in vm_version initialization code.
1443 #endif // _LP64 1465 #endif // _LP64
2470 // for testing the compiler; turn off all flags that inhibit compilation 2492 // for testing the compiler; turn off all flags that inhibit compilation
2471 set_mode_flags(_comp); 2493 set_mode_flags(_comp);
2472 2494
2473 // -Xshare:dump 2495 // -Xshare:dump
2474 } else if (match_option(option, "-Xshare:dump", &tail)) { 2496 } else if (match_option(option, "-Xshare:dump", &tail)) {
2475 #if defined(KERNEL) 2497 #if !INCLUDE_CDS
2476 vm_exit_during_initialization(
2477 "Dumping a shared archive is not supported on the Kernel JVM.", NULL);
2478 #elif !INCLUDE_CDS
2479 vm_exit_during_initialization( 2498 vm_exit_during_initialization(
2480 "Dumping a shared archive is not supported in this VM.", NULL); 2499 "Dumping a shared archive is not supported in this VM.", NULL);
2481 #else 2500 #else
2482 FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true); 2501 FLAG_SET_CMDLINE(bool, DumpSharedSpaces, true);
2483 set_mode_flags(_int); // Prevent compilation, which creates objects 2502 set_mode_flags(_int); // Prevent compilation, which creates objects
3461 } 3480 }
3462 3481
3463 PropertyList_add(plist, k, v); 3482 PropertyList_add(plist, k, v);
3464 } 3483 }
3465 3484
3466 #ifdef KERNEL
3467 char *Arguments::get_kernel_properties() {
3468 // Find properties starting with kernel and append them to string
3469 // We need to find out how long they are first because the URL's that they
3470 // might point to could get long.
3471 int length = 0;
3472 SystemProperty* prop;
3473 for (prop = _system_properties; prop != NULL; prop = prop->next()) {
3474 if (strncmp(prop->key(), "kernel.", 7 ) == 0) {
3475 length += (strlen(prop->key()) + strlen(prop->value()) + 5); // "-D ="
3476 }
3477 }
3478 // Add one for null terminator.
3479 char *props = AllocateHeap(length + 1, mtInternal);
3480 if (length != 0) {
3481 int pos = 0;
3482 for (prop = _system_properties; prop != NULL; prop = prop->next()) {
3483 if (strncmp(prop->key(), "kernel.", 7 ) == 0) {
3484 jio_snprintf(&props[pos], length-pos,
3485 "-D%s=%s ", prop->key(), prop->value());
3486 pos = strlen(props);
3487 }
3488 }
3489 }
3490 // null terminate props in case of null
3491 props[length] = '\0';
3492 return props;
3493 }
3494 #endif // KERNEL
3495
3496 // Copies src into buf, replacing "%%" with "%" and "%p" with pid 3485 // Copies src into buf, replacing "%%" with "%" and "%p" with pid
3497 // Returns true if all of the source pointed by src has been copied over to 3486 // Returns true if all of the source pointed by src has been copied over to
3498 // the destination buffer pointed by buf. Otherwise, returns false. 3487 // the destination buffer pointed by buf. Otherwise, returns false.
3499 // Notes: 3488 // Notes:
3500 // 1. If the length (buflen) of the destination buffer excluding the 3489 // 1. If the length (buflen) of the destination buffer excluding the