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

klassVtable and klassItable should be ValueObj

    XMLWordPrintable

    Details

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

      Description

      We have a start-up benchmark that shows Klass::vtable() was called 32458 times, and cost about 2~3% of a elapsed time of 720 ms.

      klassVtable* Klass::vtable() const {
        return new klassVtable(const_cast<Klass*>(this), start_of_vtable(), vtable_length() / vtableEntry::size());
      }

      Because the THREAD is not known here, in order to allocate from resource, we need to call Thread::current(), which is expensive.

      klassVtable is a fixed-size object with only 4 fields. It should be changed to a ValueObj and passed around as a plain old struct:

      klassVtable Klass::vtable() const {
        return klassVtable(const_cast<Klass*>(this), start_of_vtable(), vtable_length() / vtableEntry::size());
      }

      A similar optimization can be done to InstanceKlass::itable() to avoid resource allocation there.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: