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

Nested object literal property maps not reset in optimistic recompilation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 8u102, 9
    • core-libs
    • None
    • b139
    • generic
    • generic

        Reported on nashorn-dev: http://mail.openjdk.java.net/pipermail/nashorn-dev/2016-September/006504.html

        When optimistic conversion is triggered during initialization of an object literal, we have a mechanism to update the property map of the object as the types may (and probably will) have changed.

        However, this is only done for the top-level object in a nested object initializer. There are cases where the map may have to be updated on outer objects as well, as the example code below shows. The reason is that we may have better type information during recompilation because of type evaluation, for instance.

        =================================================================

        var o = {
           a: "LEARN_MORE",
           b: "http:/some.url",
        };

        var m = {
           x: { z: o.a },
           y: o.b
        };

        print(m.x.z);
        print(m.y);

        ===================================================================

        Expected output:

        LEARN_MORE
        http:/some.url

        Actual output:

        LEARN_MORE
        0

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

                Created:
                Updated:
                Resolved: