RFR: Streamline LRB midpath
Aleksey Shipilev
shade at redhat.com
Wed Mar 6 17:21:34 UTC 2019
On 3/6/19 4:51 PM, Roman Kennke wrote:
> We have some issues with generated code quality in the LRB barrier
> midpath. Specifically, we made a mess on the return path, and we
> generated an explicit null-check where an implicit null-check would do.
> See Aleksey's findings and related discussions here:
>
> https://mail.openjdk.java.net/pipermail/shenandoah-dev/2019-March/008924.html
>
> Regarding the null-check, it turned out that I mistakenly removed some
> code from lcm.cpp (see webrev). This potentially affects other
> null-checks too.
>
> With this patch, the return path is clean and returns straight back to
> where it came from, and the null-check is implicit now.
>
> http://cr.openjdk.java.net/~rkennke/streamline-lrb-midpath/webrev.00/
Yes, midpath looks much better now. Compare with:
https://mail.openjdk.java.net/pipermail/shenandoah-dev/2019-March/008924.html
-XX:-UseCompressedOops
[Verified Entry Point]
6.53% 0x00007fda43a14530: mov %eax,-0x14000(%rsp)
5.04% 0x00007fda43a14537: push %rbp
6.81% 0x00007fda43a14538: sub $0x10,%rsp
4.55% 0x00007fda43a1453c: mov 0x10(%rsi),%rax
.......................... LRB fastpath check ..........................
1.22% 0x00007fda43a14540: testb $0x1,0x20(%r15)
6.18% ╭ 0x00007fda43a14545: jne 0x00007fda43a1455a
.........│......... LRB fastpath ends, store to %rax follows ...........
0.41% │↗ ↗↗ 0x00007fda43a14547: movl $0x2a,0x20(%rax)
11.89% ││ ││ 0x00007fda43a1454e: add $0x10,%rsp
0.50% ││ ││ 0x00007fda43a14552: pop %rbp
4.96% ││ ││ 0x00007fda43a14553: test %eax,0x17646aa7(%rip)
0.28% ││ ││ 0x00007fda43a14559: retq
---------││--││----------- LRB midpath starts --------------------------
.........││..││............ checking in-cset ...........................
↘│ ││ 0x00007fda43a1455a: mov %rax,%r10
│ ││ 0x00007fda43a1455d: shr $0x17,%r10
│ ││ 0x00007fda43a14561: movabs $0x7fda5308cd88,%r11
│ ││ 0x00007fda43a1456b: cmpb $0x0,(%r11,%r10,1)
╰ ││ 0x00007fda43a14570: je 0x00007fda43a14547
.............││.......... checking is-forwarded ........................
╭ ││ 0x00007fda43a14572: mov -0x8(%rax),%rdi
│ ││ 0x00007fda43a14576: cmp %rax,%rdi
│╭││ 0x00007fda43a14579: je 0x00007fda43a14580
││││ 0x00007fda43a1457b: mov %rdi,%rax
││╰│ 0x00007fda43a1457e: jmp 0x00007fda43a14547
...........││.│............ slowpath call ..............................
│↘ │ 0x00007fda43a14580: movabs $0x7fda59985d90,%r10
│ │ 0x00007fda43a1458a: callq *%r10
│ ╰ 0x00007fda43a1458d: jmp 0x00007fda43a14547
↘ 0x00007fda43a1458f: mov $0xfffffff6,%esi
-XX:+UseCompressedOops:
[Verified Entry Point]
4.07% 0x00007fbb9c470950: mov %eax,-0x14000(%rsp)
8.91% 0x00007fbb9c470957: push %rbp
2.08% 0x00007fbb9c470958: sub $0x10,%rsp
4.90% 0x00007fbb9c47095c: mov 0xc(%rsi),%r11d
4.90% 0x00007fbb9c470960: mov %r11,%r9
1.95% 0x00007fbb9c470963: shl $0x3,%r9
.......................... LRB fastpath check ..........................
2.47% 0x00007fbb9c470967: testb $0x1,0x20(%r15)
3.14% ╭ 0x00007fbb9c47096c: jne 0x00007fbb9c470982
.........│......... LRB fastpath ends, store to %r9 follows ...........
4.68% │↗ ↗↗ 0x00007fbb9c47096e: movl $0x2a,0xc(%r9)
7.37% ││ ││ 0x00007fbb9c470976: add $0x10,%rsp
2.06% ││ ││ 0x00007fbb9c47097a: pop %rbp
2.69% ││ ││ 0x00007fbb9c47097b: test %eax,0x198e467f(%rip)
3.73% ││ ││ 0x00007fbb9c470981: retq
---------││-││----------- LRB midpath starts --------------------------
.........││.││............ checking in-cset ...........................
↘│ ││ 0x00007fbb9c470982: mov %r9,%r10
│ ││ 0x00007fbb9c470985: shr $0x17,%r10
│ ││ 0x00007fbb9c470989: movabs $0x7fbbac0871c0,%r8
│ ││ 0x00007fbb9c470993: cmpb $0x0,(%r8,%r10,1)
╰ ││ 0x00007fbb9c470998: je 0x00007fbb9c47096e
............││.......... checking is-forwarded ........................
╭││ 0x00007fbb9c47099a: mov -0x8(%r12,%r11,8),%r9
│││ 0x00007fbb9c47099f: lea (%r12,%r11,8),%r10
│││ 0x00007fbb9c4709a3: cmp %r10,%r9
│╰│ 0x00007fbb9c4709a6: jne 0x00007fbb9c47096e
...........│.│............ slowpath call ..............................
│ │ 0x00007fbb9c4709a8: mov %r9,%rdi
│ │ 0x00007fbb9c4709ab: movabs $0x7fbbb467fd90,%r10
│ │ 0x00007fbb9c4709b5: callq *%r10
│ │ 0x00007fbb9c4709b8: mov %rax,%r9
│ ╰ 0x00007fbb9c4709bb: jmp 0x00007fbb9c47096e
Thanks,
-Aleksey
More information about the shenandoah-dev
mailing list