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

Improve generated code for profile counters

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • None
    • hotspot
    • None
    • b89
    • aarch64

        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.

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

                Created:
                Updated:
                Resolved: