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

Access to undefined scoped variables deoptimized too much

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b17
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        JDK-8038396 deoptimizes access to scoped variables that start out as undefined too much.
        E.g.

        var x = foo()
        var a = 3;
        a++; // becomes double instead of optimistic int

        function foo() { return null };

        The reason is that the first deoptimizing recompilation happens when "foo()" is invoked and the return value doesn't fit in an int. At this time, "a" is not yet initialized, so naively observing Undefined value turns its subsequent accessor into Object one. The fix is to avoid inferring expression types for undefined scoped variables (those for which Property.getCurrentType() == null), instead of presuming Object.

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  Created:
                  Updated:
                  Resolved: