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

Simplify CDS heap region address calculation

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Won't Fix
    • P4
    • 20
    • 20
    • hotspot

    Description

      The runtime location of a CDS heap region is calculated using this field:

      https://github.com/openjdk/jdk/blob/4999f2cb164743ebf4badd3848a862609528dde3/src/hotspot/share/include/cds.h#L53-L55

      typedef struct CDSFileMapRegion {
        size_t _mapping_offset; // This region should be mapped at this offset from the base address
                                    // - for non-heap regions, the base address is SharedBaseAddress
                                    // - for heap regions, the base address is the compressed oop encoding base

      using very convoluted code:

      https://github.com/openjdk/jdk/blob/4999f2cb164743ebf4badd3848a862609528dde3/src/hotspot/share/cds/filemap.cpp#L2063-L2071

      address FileMapInfo::decode_start_address(FileMapRegion* spc, bool with_current_oop_encoding_mode) {
        size_t offset = spc->mapping_offset();
        narrowOop n = CompressedOops::narrow_oop_cast(offset);
        if (with_current_oop_encoding_mode) {
          return cast_from_oop<address>(CompressedOops::decode_raw_not_null(n));
        } else {
          return cast_from_oop<address>(ArchiveHeapLoader::decode_from_archive(n));
        }
      }

      =========================
      This can be greatly simplified:

      For each heap region, save its dumptime address in CDSFileMapRegion.

      At runtime, the address for this region = (dumptime address) + ArchiveHeapLoader::runtime_delta();

      Attachments

        Issue Links

          Activity

            People

              iklam Ioi Lam
              iklam Ioi Lam
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: