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

Code duplication in ReservedSpace::initialize/ReservedHeapSpace::try_reserve_heap

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 15
    • Fix Version/s: tbd
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
      gc

      Description

      The following code block is duplicated in ReservedSpace::initialize/ReservedSpace::try_reserve_heap (sans minor spacing):

        // If OS doesn't support demand paging for large page memory, we need
        // to use reserve_memory_special() to reserve and pin the entire region.
        // If there is a backing file directory for this space then whether
        // large pages are allocated is up to the filesystem of the backing file.
        // So we ignore the UseLargePages flag in this case.
        bool special = large && !os::can_commit_large_page_memory();
        if (special && _fd_for_heap != -1) {
          special = false;
          if (UseLargePages && (!FLAG_IS_DEFAULT(UseLargePages) ||
                                !FLAG_IS_DEFAULT(LargePageSizeInBytes))) {
            log_debug(gc, heap)("Cannot allocate large pages for Java Heap when AllocateHeapAt option is set.");
          }
        }

      Actually some more code below that block seems to be awfully similar too.

      Factor out this code to clean it up.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tschatzl Thomas Schatzl
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: