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

Remove explicit code cache options processing

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9, 10
    • Fix Version/s: 10
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b36

      Description

      XX:CodeCacheExpansionSize, XX:NonNMethodCodeHeapSize, XX:ProfiledCodeHeapSize and XX:NonProfiledCodeHeapSize options explictly processed in the hotspot/src/share/vm/runtime/arguments.cpp file:
          } else if (match_option(option, "-XX:CodeCacheExpansionSize=", &tail)) {
            julong long_CodeCacheExpansionSize = 0;
            ArgsRange errcode = parse_memory_size(tail, &long_CodeCacheExpansionSize, os::vm_page_size());
            if (errcode != arg_in_range) {
              jio_fprintf(defaultStream::error_stream(),
                         "Invalid argument: %s. Must be at least %luK.\n", option->optionString,
                         os::vm_page_size()/K);
              return JNI_EINVAL;
            }
            if (FLAG_SET_CMDLINE(uintx, CodeCacheExpansionSize, (uintx)long_CodeCacheExpansionSize) != Flag::SUCCESS) {
              return JNI_EINVAL;
            }
      ...
            // -XX:NonNMethodCodeHeapSize=
          } else if (match_option(option, "-XX:NonNMethodCodeHeapSize=", &tail)) {
            julong long_NonNMethodCodeHeapSize = 0;

            ArgsRange errcode = parse_memory_size(tail, &long_NonNMethodCodeHeapSize, 1);
            if (errcode != arg_in_range) {
              jio_fprintf(defaultStream::error_stream(),
                          "Invalid maximum non-nmethod code heap size: %s.\n", option->optionString);
              return JNI_EINVAL;
            }
            if (FLAG_SET_CMDLINE(uintx, NonNMethodCodeHeapSize, (uintx)long_NonNMethodCodeHeapSize) != Flag::SUCCESS) {
              return JNI_EINVAL;
            }
            // -XX:ProfiledCodeHeapSize=
          } else if (match_option(option, "-XX:ProfiledCodeHeapSize=", &tail)) {
            julong long_ProfiledCodeHeapSize = 0;

            ArgsRange errcode = parse_memory_size(tail, &long_ProfiledCodeHeapSize, 1);
            if (errcode != arg_in_range) {
              jio_fprintf(defaultStream::error_stream(),
                          "Invalid maximum profiled code heap size: %s.\n", option->optionString);
              return JNI_EINVAL;
            }
            if (FLAG_SET_CMDLINE(uintx, ProfiledCodeHeapSize, (uintx)long_ProfiledCodeHeapSize) != Flag::SUCCESS) {
              return JNI_EINVAL;
            }
            // -XX:NonProfiledCodeHeapSizee=
          } else if (match_option(option, "-XX:NonProfiledCodeHeapSize=", &tail)) {
            julong long_NonProfiledCodeHeapSize = 0;
            ArgsRange errcode = parse_memory_size(tail, &long_NonProfiledCodeHeapSize, 1);
            if (errcode != arg_in_range) {
              jio_fprintf(defaultStream::error_stream(),
                          "Invalid maximum non-profiled code heap size: %s.\n", option->optionString);
              return JNI_EINVAL;
            }
            if (FLAG_SET_CMDLINE(uintx, NonProfiledCodeHeapSize, (uintx)long_NonProfiledCodeHeapSize) != Flag::SUCCESS) {
              return JNI_EINVAL;
            }

      It seems that explicit processing can be deleted, because generic option processing can process numeric and memory values(10m) and JEP-245 allow to specify valid ranges(e.g. min value).
      Currently min value for these options is specified to 0(in hotspot/src/src/share/vm/runtime/globals.hpp file), but it can be adjusted according to the values in processing code in arguments.cpp file.

      Removing explicit processing of these options makes very big if statement more simple.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                thartmann Tobias Hartmann
                Reporter:
                ddmitriev Dmitry Dmitriev
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: