RFR: 8285487: Do not generate trampolines for runtime calls if they are not needed

Boris Ulasevich bulasevich at openjdk.java.net
Wed Apr 27 08:47:33 UTC 2022


On Tue, 26 Apr 2022 16:14:44 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.

src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp line 406:

> 404:   // If CodeCache size > 128M, such calls must have reserved trampolines for the case:
> 405:   // C2 compiled method calls C1 compiled method.
> 406:   return  (entry.rspec().type() == relocInfo::runtime_call_type) ? target_needs_far_branch(entry.target())

Why is target_needs_far_branch() applied for runtime_call_type only?

test/hotspot/jtreg/compiler/c2/aarch64/TestTrampoline.java line 57:

> 55:         // As the non-nmethod segment is put between other two segments,
> 56:         // ReservedCodeCacheSize=240M guarantees no trampolines for runtime calls to the non-nmethod segment.
> 57:         command.add("-XX:ReservedCodeCacheSize=240M");

To reduce memory load on the test machines, I would reduce the ReservedCodeCacheSize to 140M.

Minor stylistic comment: let us remove empty lines 59, 61, 63, 65, 67 below.

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

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


More information about the hotspot-dev mailing list