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

Further simplify NMT backend

    XMLWordPrintable

Details

    • b12

    Backports

      Description

        NMT backend can be further simplified and cleaned out.

        - some entry points require the nmt tracking level, some use the internal global tracking level. Ultimately, every part of NMT always uses the global tracking level, so in many cases we can remove method arguments where the tracking level is passed in.
        - `MemTracker::malloc_header_size(level)` + `MemTracker::malloc_footer_size(level)` can be fused into a single function
        - when putting stuff into the `MallocSiteTable`, it hands out a shortcut to the entry containing the callstack. That shortcut is stored verbatim in the malloc header. It consists of two 16-bit values (bucket index and chain position). That tupel finds its way as arguments into many functions. It can be simplified into single 32-bit opaque marker. Code outside the MallocSiteTable does not need to know what it is.
        - Currently, the `MallocHeader` class contains a lot of logic. It takes care, in the constructor and in `MallocHeader::release()`, of the actual accounting work. It would simplify the code if `MallocHeader` were just a dumb data carrier and the `MallocTracker` would do the actual work.
        - `MallocHeader` can be simplified, almost all members made constant and modifying accessors removed.
        - In a number of places we handle argument errors gracefully where we should assert instead
        - In a number of places expressions like `MemTracker::tracking_level() != NMT_off` can be simplified to `MemTracker::enabled()`.
        - MemTracker::malloc_base (all variants) can be removed. Note that we have MallocTracker::malloc_header, which achieves the same and does not require casting to the header.

        Attachments

          Issue Links

            Activity

              People

                stuefe Thomas Stuefe
                stuefe Thomas Stuefe
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: