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

[lworld] Ineffective codegeneration for flattened arrays checks causes large performance regression on List iteration

    Details

      Description

      Benchmarks location: http://cr.openjdk.java.net/~skuksenko/valhalla/legacy/benchmarks/
      Benchmarks: org.openjdk.list.ListIter
      Performance regression on Valhalla from -30% to -70%.
      Reasons typechecks (to Integer and SampleTask, which are classes not arrays):
      1. Loading class ptr is not hoisted out of loop
      movabs $0x7f93e3b32200,%r11 ; {metadata('org/openjdk/valhalla/tofind0/ListIter$SampleTask')}
      At the same moment r11 is not used and maybe initialized out of loop. In case -XX:-EnableValhalla it is done.

      2. Clearing ArrayStorageProperties bits before class ptr comparision:
      0x00007f9523f78b2b: mov 0x8(%r12),%r10
      0x00007f9523f78b30: shl $0x3,%r10
      0x00007f9523f78b34: sar $0x3,%r10
      0x00007f9523f78b38: movabs $0x7f93e3b32200,%r11 ; {metadata('org/openjdk/valhalla/tofind0/ListIter$SampleTask')}
      0x00007f9523f78b42: cmp %r11,%r10
      0x00007f9523f78b45: jne 0x00007f9523f78ce2 ;*checkcast

      In reality we don't need to clear that bits at all. Final comparison is performed with class pointer (not array) and doesn't depends on that bits.

      Two issues about covers ListIter::hash and ListIter::sum benchmarks.
      ListIter::tasks besides has other issues as loading this$0, modCound are also could be moved out of loop.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                roland Roland Westrelin
                Reporter:
                skuksenko Sergey Kuksenko
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: