RFR: 8287425: Remove unnecessary register push for MacroAssembler::check_klass_subtype_slow_path

Xiaolin Zheng xlinzheng at openjdk.java.net
Thu Jun 2 09:53:25 UTC 2022


On Fri, 27 May 2022 09:10:48 GMT, Xiaolin Zheng <xlinzheng at openjdk.org> wrote:

> Hi team,
> 
> ![AE98A8E7-9F6F-4722-B310-299A9A96A957](https://user-images.githubusercontent.com/38156692/170670906-2ce37a13-af21-4cf8-acbd-ca24528bc3a9.png)
> 
> Some perf results show unnecessary pushes in `MacroAssembler::check_klass_subtype_slow_path()` under `UseCompressedOops`. History logs show the original code is like [1], and it gets refactored in [JDK-6813212](https://bugs.openjdk.java.net/browse/JDK-6813212), and the counterparts of the `UseCompressedOops` in the diff are at [2] and [3], and we could see the push of rax is just because `encode_heap_oop_not_null()` would kill it, so here needs a push and restore. After that, [JDK-6964458](https://bugs.openjdk.java.net/browse/JDK-6964458) (removal of perm gen) at [4] removed [3] so that there is no need to do UseCompressedOops work in `MacroAssembler::check_klass_subtype_slow_path()`; but in that patch [2] didn't get removed, so we finally come here. As a result, [2] could also be safely removed.
> 
> (Files in [4] are folded because the patch is too large. We could manually unfold `hotspot/src/cpu/x86/vm/assembler_x86.cpp` to see that diff)
> 
> I was wondering if this minor change could be sponsored?
> 
> This enhancement is raised on behalf of Wei Kuai <kuaiwei.kw at alibaba-inc.com>.
> 
> Tested x86_64 hotspot tier1~tier4 twice, aarch64 hotspot tier1~tier4 once with another jdk tier1 once, and riscv64 hotspot tier1~tier4 once.
> 
> Thanks,
> Xiaolin
> 
> [1] https://github.com/openjdk/jdk/blob/de67e5294982ce197f2abd051cbb1c8aa6c29499/hotspot/src/cpu/x86/vm/interp_masm_x86_64.cpp#L273-L284
> [2] https://github.com/openjdk/jdk/commit/b8dbe8d8f650124b61a4ce8b70286b5b444a3316#diff-beb6684583b0a552a99bbe4b5a21828489a6d689b32a05e1a9af8c3be9f463c3R7441-R7444
> [3] https://github.com/openjdk/jdk/commit/b8dbe8d8f650124b61a4ce8b70286b5b444a3316#diff-beb6684583b0a552a99bbe4b5a21828489a6d689b32a05e1a9af8c3be9f463c3R7466-R7477
> [4] https://github.com/openjdk/jdk/commit/5c58d27aac7b291b879a7a3ff6f39fca25619103#diff-beb6684583b0a552a99bbe4b5a21828489a6d689b32a05e1a9af8c3be9f463c3L9347-L9361

Thank you for reviewing, Vladimir! Then I'd merge this trivial enhancement if no other comments.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8915


More information about the hotspot-compiler-dev mailing list