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

Improve generated code for profile counters

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b89
    • CPU:
      aarch64

      Backports

        Description

        AArch64 generates suboptimal code for profile counters. Here we load the metadata address for a method, then add an offset, then do the increment:

            mov x0, #0x5980 ; {metadata(method data for {method} {0x000003fe3141ba00} 'normalize' '(Ljava/lang/String;)Ljava/lang/String;' in 'java/io/UnixFileSystem')}
            movk x0, #0x314b, lsl #16
            movk x0, #0x3fe, lsl #32
            add xscratch2, x0, #0x218
            ldr xscratch1, [xscratch2]
            add xscratch1, xscratch1, #0x1
            str xscratch1, [xscratch2]

        It can be done like this:

            mov x0, #0x5980 ; {metadata(method data for {method} {0x000003fe3141ba00} 'normalize' '(Ljava/lang/String;)Ljava/lang/String;' in 'java/io/UnixFileSystem')}
            movk x0, #0x314b, lsl #16
            movk x0, #0x3fe, lsl #32
            ldr xscratch1, [x0, #0x218]
            add xscratch1, xscratch1, #0x1
            str xscratch1, [x0, #0x218]

        Although this looks like a very minor improvement, this same pattern is repeated many times in C1-generated code.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  aph Andrew Haley
                  Reporter:
                  aph Andrew Haley
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: