Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8142675 | emb-9 | Kim Barrett | P4 | Resolved | Fixed | team |
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.
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.
- backported by
-
JDK-8142675 Speed up InstanceKlass subclass discrimination
-
- Resolved
-
- blocks
-
JDK-8138923 Remove oop coupling with InstanceKlass subclasses
-
- Resolved
-
- relates to
-
JDK-8139203 Consistent naming for klass type predicates
-
- Resolved
-