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

checkcast operations should be profiled to improve code which uses generics

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 7
    • Fix Version/s: hs10
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b08
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        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.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                jrose John Rose
                Reporter:
                jrose John Rose
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: