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

Expressions in split literals must never be optimistic

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8, 9
    • Fix Version/s: 10
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b37
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        Nashorn has the capability to split initialization of large object and array literals into multiple parts to work around the method size limit in Java. Optimistic types are not supported in initialization of split literals. However, optimistic type assignment currently walks over split literals and assign optimistic types to expressions contained therein. Since generation of optimistic operations within split literals is suppressed in codegen, this leads to failed optimism failing silently at runtime.

        The quick fix for this is not to do optimistic type assignment within split literals. A better fix might be to implement split literal initialization using JavaScript functions similar to the way it is done for ordinary code splitting, which would allow us to support optimistic types.

        Another lesson from this is that we should have an assertion against optimistic operations being used in a non-optimistic context.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                hannesw Hannes Wallnoefer
                Reporter:
                hannesw Hannes Wallnoefer
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: