< prev index next >

src/hotspot/share/runtime/arguments.cpp

Print this page




 657 const char* Arguments::real_flag_name(const char *flag_name) {
 658   for (size_t i = 0; aliased_jvm_flags[i].alias_name != NULL; i++) {
 659     const AliasedFlag& flag_status = aliased_jvm_flags[i];
 660     if (strcmp(flag_status.alias_name, flag_name) == 0) {
 661         return flag_status.real_name;
 662     }
 663   }
 664   return flag_name;
 665 }
 666 
 667 #ifdef ASSERT
 668 static bool lookup_special_flag(const char *flag_name, size_t skip_index) {
 669   for (size_t i = 0; special_jvm_flags[i].name != NULL; i++) {
 670     if ((i != skip_index) && (strcmp(special_jvm_flags[i].name, flag_name) == 0)) {
 671       return true;
 672     }
 673   }
 674   return false;
 675 }
 676 








 677 static bool verify_special_jvm_flags() {
 678   bool success = true;
 679   for (size_t i = 0; special_jvm_flags[i].name != NULL; i++) {
 680     const SpecialFlag& flag = special_jvm_flags[i];
 681     if (lookup_special_flag(flag.name, i)) {
 682       warning("Duplicate special flag declaration \"%s\"", flag.name);
 683       success = false;
 684     }
 685     if (flag.deprecated_in.is_undefined() &&
 686         flag.obsolete_in.is_undefined()) {
 687       warning("Special flag entry \"%s\" must declare version deprecated and/or obsoleted in.", flag.name);
 688       success = false;
 689     }
 690 
 691     if (!flag.deprecated_in.is_undefined()) {
 692       if (!version_less_than(flag.deprecated_in, flag.obsolete_in)) {
 693         warning("Special flag entry \"%s\" must be deprecated before obsoleted.", flag.name);
 694         success = false;
 695       }
 696 
 697       if (!version_less_than(flag.deprecated_in, flag.expired_in)) {
 698         warning("Special flag entry \"%s\" must be deprecated before expired.", flag.name);
 699         success = false;
 700       }
 701     }
 702 
 703     if (!flag.obsolete_in.is_undefined()) {
 704       if (!version_less_than(flag.obsolete_in, flag.expired_in)) {
 705         warning("Special flag entry \"%s\" must be obsoleted before expired.", flag.name);
 706         success = false;
 707       }
 708 
 709       // if flag has become obsolete it should not have a "globals" flag defined anymore.
 710       if (!version_less_than(JDK_Version::current(), flag.obsolete_in)) {
 711         if (Flag::find_flag(flag.name) != NULL) {
 712           warning("Global variable for obsolete special flag entry \"%s\" should be removed", flag.name);
 713           success = false;
 714         }
 715       }
 716     }
 717 
 718     if (!flag.expired_in.is_undefined()) {
 719       // if flag has become expired it should not have a "globals" flag defined anymore.
 720       if (!version_less_than(JDK_Version::current(), flag.expired_in)) {
 721         if (Flag::find_flag(flag.name) != NULL) {
 722           warning("Global variable for expired flag entry \"%s\" should be removed", flag.name);
 723           success = false;
 724         }
 725       }
 726     }
 727 
 728   }
 729   return success;
 730 }
 731 #endif
 732 
 733 // Parses a size specification string.
 734 bool Arguments::atojulong(const char *s, julong* result) {
 735   julong n = 0;
 736 
 737   // First char must be a digit. Don't allow negative numbers or leading spaces.
 738   if (!isdigit(*s)) {
 739     return false;
 740   }
 741 
 742   bool is_hex = (s[0] == '0' && (s[1] == 'x' || s[1] == 'X'));
 743   char* remainder;




 657 const char* Arguments::real_flag_name(const char *flag_name) {
 658   for (size_t i = 0; aliased_jvm_flags[i].alias_name != NULL; i++) {
 659     const AliasedFlag& flag_status = aliased_jvm_flags[i];
 660     if (strcmp(flag_status.alias_name, flag_name) == 0) {
 661         return flag_status.real_name;
 662     }
 663   }
 664   return flag_name;
 665 }
 666 
 667 #ifdef ASSERT
 668 static bool lookup_special_flag(const char *flag_name, size_t skip_index) {
 669   for (size_t i = 0; special_jvm_flags[i].name != NULL; i++) {
 670     if ((i != skip_index) && (strcmp(special_jvm_flags[i].name, flag_name) == 0)) {
 671       return true;
 672     }
 673   }
 674   return false;
 675 }
 676 
 677 // Verifies the correctness of the entries in the special_jvm_flags table.
 678 // If there is a semantic error (i.e. a bug in the table) such as the obsoletion
 679 // version being earlier than the deprecation version, then a warning is issued
 680 // and verification fails - by returning false. If it is detected that the table
 681 // is out of date, with respect to the current version, then a warning is issued
 682 // but verification does not fail. This allows the VM to operate when the version
 683 // is first updated, without needing to update all the impacted flags at the
 684 // same time.
 685 static bool verify_special_jvm_flags() {
 686   bool success = true;
 687   for (size_t i = 0; special_jvm_flags[i].name != NULL; i++) {
 688     const SpecialFlag& flag = special_jvm_flags[i];
 689     if (lookup_special_flag(flag.name, i)) {
 690       warning("Duplicate special flag declaration \"%s\"", flag.name);
 691       success = false;
 692     }
 693     if (flag.deprecated_in.is_undefined() &&
 694         flag.obsolete_in.is_undefined()) {
 695       warning("Special flag entry \"%s\" must declare version deprecated and/or obsoleted in.", flag.name);
 696       success = false;
 697     }
 698 
 699     if (!flag.deprecated_in.is_undefined()) {
 700       if (!version_less_than(flag.deprecated_in, flag.obsolete_in)) {
 701         warning("Special flag entry \"%s\" must be deprecated before obsoleted.", flag.name);
 702         success = false;
 703       }
 704 
 705       if (!version_less_than(flag.deprecated_in, flag.expired_in)) {
 706         warning("Special flag entry \"%s\" must be deprecated before expired.", flag.name);
 707         success = false;
 708       }
 709     }
 710 
 711     if (!flag.obsolete_in.is_undefined()) {
 712       if (!version_less_than(flag.obsolete_in, flag.expired_in)) {
 713         warning("Special flag entry \"%s\" must be obsoleted before expired.", flag.name);
 714         success = false;
 715       }
 716 
 717       // if flag has become obsolete it should not have a "globals" flag defined anymore.
 718       if (!version_less_than(JDK_Version::current(), flag.obsolete_in)) {
 719         if (Flag::find_flag(flag.name) != NULL) {
 720           warning("Global variable for obsolete special flag entry \"%s\" should be removed", flag.name);

 721         }
 722       }
 723     }
 724 
 725     if (!flag.expired_in.is_undefined()) {
 726       // if flag has become expired it should not have a "globals" flag defined anymore.
 727       if (!version_less_than(JDK_Version::current(), flag.expired_in)) {
 728         if (Flag::find_flag(flag.name) != NULL) {
 729           warning("Global variable for expired flag entry \"%s\" should be removed", flag.name);

 730         }
 731       }
 732     }
 733 
 734   }
 735   return success;
 736 }
 737 #endif
 738 
 739 // Parses a size specification string.
 740 bool Arguments::atojulong(const char *s, julong* result) {
 741   julong n = 0;
 742 
 743   // First char must be a digit. Don't allow negative numbers or leading spaces.
 744   if (!isdigit(*s)) {
 745     return false;
 746   }
 747 
 748   bool is_hex = (s[0] == '0' && (s[1] == 'x' || s[1] == 'X'));
 749   char* remainder;


< prev index next >