-
Bug
-
Resolution: Fixed
-
P3
-
7
-
b08
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2176850 | 7 | John Rose | P3 | Closed | Fixed | b08 |
JDK-2171911 | 6u4 | John Rose | P3 | Resolved | Fixed | b03 |
Generic types in the Java language are represented by their bounds in the JVM, and mismatches are made up by dynamic casts. These casts are invisible to the programmer but frequent in the bytecodes. We need better optimization of these casts in order to get top performance from generic Java code.
We can do much better if we treat casts like call sites, when profiling and optimizing. If we profile receiver types at casts, we will be able to hoist profiled type information up to the place where a new value is pulled from a generic List or Set, which is typically much earlier than a call site that uses the new value. If the profile is monomorphic (which is a typical case, especially in hot code), then all subsequent type checks will fold away, and all calls will be devirtualized. We have benchmarks where this happens in hot code.
We can do much better if we treat casts like call sites, when profiling and optimizing. If we profile receiver types at casts, we will be able to hoist profiled type information up to the place where a new value is pulled from a generic List or Set, which is typically much earlier than a call site that uses the new value. If the profile is monomorphic (which is a typical case, especially in hot code), then all subsequent type checks will fold away, and all calls will be devirtualized. We have benchmarks where this happens in hot code.
- backported by
-
JDK-2171911 checkcast operations should be profiled to improve code which uses generics
- Resolved
-
JDK-2176850 checkcast operations should be profiled to improve code which uses generics
- Closed
- relates to
-
JDK-6561457 merge-o in fix to 6516101 bogusly sets the null_seen bit.
- Resolved