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

[lworld] C1 should avoid allocation when reading a field from a flattened field

XMLWordPrintable

      When C1 compiles the following code

          inline class Point {int x, ..... }
          class Holder { Point point; }

          int x = holder.point.x

      it first allocates a temporary Point object, copy the value of holder.point.x to the temp object, and then read x from the temp object. This should be simplified into a single load instruction

          x = ((int*)(holder))[offset of point.x];

            fparain Frederic Parain
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: