RFR: 8285487: Do not generate trampolines for runtime calls if they are not needed [v2]
Vladimir Kozlov
kvn at openjdk.java.net
Thu Apr 28 18:03:01 UTC 2022
On Wed, 27 Apr 2022 14:34:39 GMT, Evgeny Astigeevich <duke at openjdk.java.net> wrote:
>> [JDK-8280872](https://bugs.openjdk.java.net/browse/JDK-8280872) put the non-nmethod segment between two others. It made trampolines for runtime calls redundant in most cases.
>>
>> This PR uses `target_needs_far_branch()` for runtime calls to check whether they need trampolines. Trampolines are not generated if they are not needed.
>>
>> Testing:
>> - `tier1`...`tier4`: Passed
>> - `compiler/c2/aarch64/TestTrampoline.java`: Passed
>>
>> Note: `compiler/c2/aarch64/TestTrampoline.java` requires the release build. This is because debug builds have the branch range set to 2M which causes always generation of trampolines.
>
> Evgeny Astigeevich has updated the pull request incrementally with one additional commit since the last revision:
>
> XX:ReservedCodeCacheSize=130M for test and update comments
src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp line 407:
> 405: // Once they are generated neither a caller nor a callee address cannot be changed.
> 406: // Check whether a far branch is needed to reach the target.
> 407: return target_needs_far_branch(entry.target());
>From what I understand `target_needs_far_branch()` works only for stubs which are inside CodeCache.
`runtime` method, as you correctly pointed, is code in VM which can be in any distance from CodeCache.
For example, it will give incorrect answer if CodeCache size is small:
https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp#L391
Or I am confused by the name of this method `target_needs_trampoline` and the comment.
Do you actually mean `need_far_branch_for_trampoline`?
-------------
PR: https://git.openjdk.java.net/jdk/pull/8403
More information about the hotspot-dev
mailing list