RFR: 8253048: AArch64: When CallLeaf, no need to preserve callee-saved registers in caller
Joshua Zhu
jzhu at openjdk.java.net
Wed Sep 23 11:53:51 UTC 2020
On Wed, 23 Sep 2020 11:21:09 GMT, Andrew Dinn <adinn at openjdk.org> wrote:
>> I noticed all Floating-Point and SIMD Registers are defined as SOC
>> registers in c calling convention on AArch64.
>> As AArch64 ABI tells, the bottom 64 bits of v8-v15 are callee-saved.
>>
>> When using CallRuntime, with the help of existing flag "exclude_soe" and
>> function add_call_kills(), SOE registers are killed by the call
>> because values that could show up in the RegisterMap aren't live in
>> callee saved registers.
>> But CallLeaf and CallLeafNoFP are ok because they don't have safepoint
>> and debug info.
>>
>> Therefore I submit this patch that aligns save-policy in c calling
>> convention with AArch64 ABI. It could help eliminate unnecessary SOE
>> registers spilling in caller across CallLeafNode.
>>
>> I wrote a simple test case:
>> http://cr.openjdk.java.net/~jzhu/8253048/Test.java
>> Original OptoAssembly is:
>> http://cr.openjdk.java.net/~jzhu/8253048/old_OptoAssembly
>> With the patch, unnecessary spillings are eliminated:
>> http://cr.openjdk.java.net/~jzhu/8253048/new_OptoAssembly
>>
>> And when a vector is alive across CallLeaf, with the help of existing
>> FatProjectionNode and RA, the whole vector register ( length > 64-bit )
>> is still spilled to stack as usual.
>>
>> A test case using VectorAPI is written to verify:
>> http://cr.openjdk.java.net/~jzhu/8253048/TestVector.java
>> Test patch:
>> http://cr.openjdk.java.net/~jzhu/8253048/patch
>> OptoAssembly dump:
>> http://cr.openjdk.java.net/~jzhu/8253048/TestVector_OptoAssembly
>>
>> I also searched all occurrences of "V8-V15" in aarch64 codes.
>> The stubs for sin/cos don't save v10 before usage.
>> Therefore I replace it with caller-save register v24.
>>
>> Jtreg Testing: hotspot_all_no_apps, jdk_core and langtools:tier1
>>
>> Could you please help review this change?
>>
>> Best Regards,
>> Joshua
>>
>> ---------
>
> Marked as reviewed by adinn (Reviewer).
Aph and Adinn, Thanks a lot for your review!
-------------
PR: https://git.openjdk.java.net/jdk/pull/129
More information about the hotspot-compiler-dev
mailing list