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

Speed up InstanceKlass subclass discrimination

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b89
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        There are four kinds of InstanceKlass: concrete InstanceKlass, InstanceRefKlass, InstanceMirrorKlass, and InstanceClassLoaderKlass.

        Klass provides virtual functions oop_is_xxx for determing whether a klass is one of the latter three. This means that multiple virtual function calls are needed to dispatch among these types. In particular, concrete InstanceKlass, which is the most frequently occurring, always requires 3 virtual function calls to select.

        Certain operations might be sped up by having a faster mechanism for dispatching among these classes, and in particular detecting the concrete InstanceKlass case quickly. One way to address these would be to add operation-specific virtual functions. That doesn't scale well as the number of such operations increases, and also introduces tight coupling between the Klass hierarchy and whatever subsystem needs the dispatch.

        A different solution involves associating a unique value with each of those four classes, and providing an accessor for that value.

        This could be expanded to include ObjArrayKlass and TypeArrayKlass, or the existing layout_helper-based discrimination can be used to discriminate among InstanceKlass (or subclass) and the array klasses.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                kbarrett Kim Barrett
                Reporter:
                kbarrett Kim Barrett
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: