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

Evgeny Astigeevich duke at openjdk.java.net
Thu Mar 3 15:37:58 UTC 2022


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

>> I understand the changes. My comment is about names. `MacroAssembler` only needs to know if it needs a far jump. Details "why" are not needed here.
>> We ask `MacroAssembler`. `MacroAssembler` gets `CodeCache` configuration info and checks whether a far jump is needed.
>
> Ok. For the sake of formal logic here, let me introduce trampoline_needs_far_jump() function:
> 
>   if (a.trampoline_needs_far_jump() && ..) {
>     stub = a.emit_trampoline_stub(dest);
>   }
>   if (stub == NULL) {
>     // If we generated no stub, patch this call directly to dest.
>     set_destination(dest);

According to the comments of `trampoline_jump`:

// Generate a trampoline for a branch to dest.  If there's no need for a
// trampoline, simply patch the call directly to dest.

`trampoline_jump` is a jump or a far jump via a trampoline. It is not that a trampoline needs either a jump or a far jump.
What about:

if (a.jump_needs_trampoline() && ..) {
    stub = a.emit_trampoline_stub(dest);
}

Another variant:

if (a.is_trampoline_needed() && ..) {
    stub = a.emit_trampoline_stub(dest);
}

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

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


More information about the hotspot-dev mailing list