RFR: 8280872: Reorder code cache segments to improve code density [v2]
Boris Ulasevich
bulasevich at openjdk.java.net
Thu Mar 3 12:19:59 UTC 2022
On Wed, 2 Mar 2022 15:28:29 GMT, Evgeny Astigeevich <duke at openjdk.java.net> wrote:
>> With this patch I do not change trampoline calls. I change far_jump and far_call procedures only.
>> Instead of far_branches() function we have two functions:
>> - codecache_branch_needs_far_jump to find if we need a far jump for intra-codecache branches
>> - codestub_branch_needs_far_jump to find if we need a far branch for codecache-to-nonmethodEntrypoint branch
>> So in this place I leave codecache_branch_needs_far_jump as exact equivalent of former far_branches() call.
>
> 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);
>>> max_distance_to_non_nmethod_heap?
>>> As this is public API, it sounds strange without the start point.
>>
>> Start point is any point in the CodeCache. Will the comment below help?
>> // maximum distance from any point in the CodeCache to any entry point in the non_nmethod CodeCache segment
>> This is really too many words for a self-explanatory function name.
>>
>>> If someone changes positions of the heap, would it work as expected?
>>
>> Sure
>
> Can we moved the code to `codestub_branch_needs_far_jump`? It is the only place where the code is used.
> We might need to make either `get_code_heap` public or `MacroAssembler` a friend of `CodeCache`.
Yes, it is the only place. Though I don't do this for encapsulation reasons: I think it's the internal details of the code cache if it is segmented and what the segment boundaries are. Right?
-------------
PR: https://git.openjdk.java.net/jdk/pull/7517
More information about the hotspot-dev
mailing list