Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8060256

The loop in Arguments::parse() can be enhanced

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • hotspot
    • None
    • b38
    • generic
    • generic
    • Not verified

        The following loop in Arguments::parse() can be optimized with 'continue' at the end of each matching option:

          for (index = 0; index < args->nOptions; index++) {
            const JavaVMOption *option = args->options + index;
            if (match_option(option, "-XX:Flags=", &tail)) {
              flags_file = tail;
              settings_file_specified = true;
            }
            if (match_option(option, "-XX:+PrintVMOptions", &tail)) {
              PrintVMOptions = true;
            }
            if (match_option(option, "-XX:-PrintVMOptions", &tail)) {
              PrintVMOptions = false;
            }
            if (match_option(option, "-XX:+IgnoreUnrecognizedVMOptions", &tail)) {
              IgnoreUnrecognizedVMOptions = true;
            }
            if (match_option(option, "-XX:-IgnoreUnrecognizedVMOptions", &tail)) {
              IgnoreUnrecognizedVMOptions = false;
            }
            if (match_option(option, "-XX:+PrintFlagsInitial", &tail)) {
              CommandLineFlags::printFlags(tty, false);
              vm_exit(0);
            }
        #if INCLUDE_NMT
            if (match_option(option, "-XX:NativeMemoryTracking", &tail)) {
              // The launcher did not setup nmt environment variable properly.
              if (!MemTracker::check_launcher_nmt_support(tail)) {
                warning("Native Memory Tracking did not setup properly, using wrong launcher?");
              }

              // Verify if nmt option is valid.
              if (MemTracker::verify_nmt_option()) {
                // Late initialization, still in single-threaded mode.
                if (MemTracker::tracking_level() >= NMT_summary) {
                  MemTracker::init();
                }
              } else {
                vm_exit_during_initialization("Syntax error, expecting -XX:NativeMemoryTracking=[off|summary|detail]", NULL);
              }
            }
        #endif

        #ifndef PRODUCT
            if (match_option(option, "-XX:+PrintFlagsWithComments", &tail)) {
              CommandLineFlags::printFlags(tty, true);
              vm_exit(0);
            }
        #endif
          }

              jiangli Jiangli Zhou
              jiangli Jiangli Zhou
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: