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

Expressions in large array initializers aren't optimistic

    XMLWordPrintable

Details

    • Bug
    • Resolution: Future Project
    • P4
    • tbd
    • None
    • core-libs
    • None

    Description

      When large array initializers are split, their initializer expressions are not optimistic. It is currently not possible to have such initializers be subjected to deoptimizing recompilation. It is possible to introduce a transformation that will make individual ArrayUnit fragments into separate anonymous functions (similar to how optimistic splitter works), but since then the initializer expressions become part of assignments to array elements in separate statements in separate functions, a deoptimization in an expression won't inform the initial allocated type of the array. The consequence of this is that the array will always be allocated with the narrowest type allowed by its constant elements (the ones in the pre-set), and if any of the calculated (post-set) expressions deoptimize it further then its backing array will be widened on every initialization. If such arrays are only initialized once, then the overhead is insignificant, but for frequently evaluated large array literals, it might be a significant performance issue. (We can still do it that way.)

      Longer term, we can try to figure out a way to communicate the optimistic array element type back into the top-level method that allocates the array. One way to do this is to introduce optimism at the array element type level, and have split fragments return underlying arrays, as then widening in the element type in a split fragment would cause deoptimization in the caller (array allocating) function too.

      Attachments

        Issue Links

          Activity

            People

              attila Attila Szegedi
              attila Attila Szegedi
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: