United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6516101 checkcast operations should be profiled to improve code which uses generics
JDK-6516101 : checkcast operations should be profiled to improve code which uses generics

Details
Type:
Bug
Submit Date:
2007-01-22
Status:
Resolved
Updated Date:
2010-05-20
Project Name:
JDK
Resolved Date:
2007-02-17
Component:
hotspot
OS:
generic
Sub-Component:
compiler
CPU:
generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:
hs10 (b08)

Related Reports
Backport:
Backport:
Relates:

Sub Tasks

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.

                                    

Comments
SUGGESTED FIX

http://prt-web.sfbay.sun.com/net/prt-archiver.sfbay/data/archived_workspaces/main/c2_baseline/2007/20070206090659.jrose.dolphin-optimizer/workspace/webrevs/webrev-2007.02.06/index.html
                                     
2007-02-15
EVALUATION

yes, done
*** (#1 of 1): [ UNSAVED ] ###@###.###
                                     
2007-02-15



Hardware and Software, Engineered to Work Together