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

Add test to verify bimorphic inlining happens after morphism changes

XMLWordPrintable

    • master
    • generic
    • generic

      When the tiered compilation is on, the C2 compiler doesn't perform bimorphic inlining at a call site if the call site was monomorphic when a method was compiled by the C1 at tier 3 but then morphism changed.

      Following events trigger the issue:
      - there's a class hierarchy consisting of an abstract base class and two concrete sibling subclasses, each implementing an abstract method;
      - initially, only one of these sibling classes is loaded;
      - a method with a yet monomorphic virtual call is compiled by the C1 and the compiler is capable of resolving a target method, thus the call is inlined;
      - later, a second class is loaded and it it's instance start being a receiver at a call site mentioned above;
      - previously compiled methods are invalidated and at some point the C2 recompiles a method with bimorphic call site, but it does not apply bimorphic inlining there.

      If the problematic call site is bimorphic right from the beginning, or the tiered compilation is off, then the C2 successfully performs bimorphic inlining.

      The benchmark illustrating the problem is attached to this issue, as well as a jtreg test reproducing the problem.

      I was able to reproduce the issue with JDK17, 21 and 23 (built from the main branch recently).

            galder Galder ZamarreƱo
            fzhinkin Filipp Zhinkin
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: