RFR: 8348855: G1: Implement G1BarrierSetC2::estimate_stub_size
Andrew Dinn
adinn at openjdk.org
Wed Jan 29 11:57:47 UTC 2025
On Wed, 29 Jan 2025 10:08:06 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp line 550:
>>
>>> 548:
>>> 549: // Add slop to avoid expansion during emit_stubs.
>>> 550: return size + PhaseOutput::MAX_inst_size;
>>
>> Is this needed? `init_buffer` already bumps `code_req` up by `MAX_inst_size` immediately after calling `bs->estimate_stub_size()` and that headroom is maintained at each instruction emit.
>
> Yes, I think so. Leyden experiments show this is needed. AFAICS, the `MAX_inst_size` added in `init_buffer` is going to be taken by normal code itself, so then when we'll go to final stub emit with `G1BarrierSetC2::emit_stubs`, we will encounter `maybe_expand_to_ensure_remaining(MAX_inst_size)`, but the part of `MAX_inst_size` would already be eaten, and this will force expansion.
>
> In other words, if we maintain `MAX_inst_size` window when emitting stubs in `G1BarrierSetC2::emit_stubs`, we need to include that in estimate.
Ok, good to go then.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23333#discussion_r1933749743
More information about the hotspot-dev
mailing list