Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8142691 | emb-9 | Andrew Haley | P4 | Resolved | Fixed | team |
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.
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.
- backported by
-
JDK-8142691 Improve generated code for profile counters
-
- Resolved
-