RFR: 8280872: Reorder code cache segments to improve code density [v3]

Evgeny Astigeevich duke at openjdk.java.net
Mon Mar 7 13:22:02 UTC 2022


On Thu, 3 Mar 2022 12:31:39 GMT, Boris Ulasevich <bulasevich at openjdk.org> wrote:

>> Currently the codecache segment order is [non-nmethod, non-profiled, profiled]. With this change we move the non-nmethod segment between two code segments. It changes nothing for any platform besides AARCH.
>> 
>> In AARCH the offset limit for a branch instruction is 128MB. The bigger jumps are encoded with three instructions. Most of far branches are jumps into the non-nmethod blobs. With the non-nmethod segment in between code segments the jump distance from method to the stub becomes shorter. The result is a 4% reduction in generated code size for the CodeCache range from 128MB to 240MB.
>> 
>> As a side effect, the performance of some tests is slightly improved:
>> ``ArraysFill.testCharFill      10  thrpt   15  170235.720 -> 178477.212  ops/ms``
>> 
>> Testing: jdk/hotspot jtreg and microbenchmarks on AMD and AARCH
>
> Boris Ulasevich has updated the pull request incrementally with one additional commit since the last revision:
> 
>   review comments. remove far_call limit. undo trampoline-to-farcall. add trampoline_needs_far_jump func

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

> 437:       nop();
> 438:       nop();
> 439:     }

I suggest to move the logic to `InlineCacheBuffer::assemble_ic_buffer_code` and change `far_jump` to return a number of instructions used for the jump.

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

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


More information about the hotspot-dev mailing list