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

C1 should fast-path Object.class.isInstance(obj) to null check

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Unresolved
    • P4
    • tbd
    • 9, 10
    • hotspot

    Description

      Current intrinsic code in C1 optimizes Class.isInstance (and Class.cast, transitively) quite well, but it misses an opportunity in optimizing for Object.class case.

      Benchmark:
       http://cr.openjdk.java.net/~shade/8135033/ClassCastConstants.java

      -XX:TieredStopAtLevel=1:

      myClass_inlined 3.766 ± 0.021 ns/op
      myClass_staticFinal 3.763 ± 0.002 ns/op
      object_inlined 3.086 ± 0.001 ns/op
      object_staticFinal 3.106 ± 0.038 ns/op

      The disassembly for object_* tests show the redundant compare against Object.class.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: