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

Change _constMethod and _method_counters in hotspot Method class from pointers to 32-bit values

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P3
    • Resolution: Won't Fix
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:

      Description

      The projected savings are on 64-bit only: 8 bytes savings per hotspot Method instance.

      When allocating a Method class, also allocate the ConstMethod in a consecutive block in metaspace. This guarantees the distance from the Method to its _constMethod is never larger than 32-bits.
      Also, change Method::_method_counters to a 2-level index with a 16bit top and 16bit bottom.

      class Method {
      private:
        jint _const_method_offset;
        ConstMethod* constMethod() const { return (ConstMethod*)(address(this) + _const_method_offset); }
        ushort _method_counter_block;
        ushort _method_counter_index;

        MethodCounters* method_counters() const {
          if (_method_counters_block == 0xffff) {
              return NULL;
          }
          return &(_blocks[_method_counters_block][_method_counter_index]);
        }

        static MethodCounters** _blocks;

         ...
      }

      Note: in a CDS image, the Method and ConstMethod are allocated from two different regions (RW and RO), so they cannot be allocated consecutively. However, we can make sure that the (SharedReadWriteSize + SharedReadOnlySize) is less than 4GB, so _const_method_offset can still fit in 32 bits.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                iklam Ioi Lam
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: