RFR: 8365991: AArch64: Ignore BlockZeroingLowLimit when UseBlockZeroing is false [v4]
Patrick Zhang
qpzhang at openjdk.org
Wed Nov 5 03:52:01 UTC 2025
On Tue, 28 Oct 2025 12:08:01 GMT, Andrew Haley <aph at openjdk.org> wrote:
>>> > I would like to reiterate that I have no objection to the functions when the `-XX:+UseBlockZeroing` option is set, everything can keep as is. My point is that `BlockZeroingLowLimit` serves literally/specifically as a switch to control whether DC ZVA instructions are generated for clearing instances under a specified bytes size limitation, rather than for deciding between unrolling and callout. Therefore, it should NOT affect the code-gen results any longer when `-XX:-UseBlockZeroing` is set, should it?
>>>
>>> It does not. When `-XX:-UseBlockZeroing` is set, `BlockZeroingLowLimit` is ignored.
>>
>>
>> zero_words does not check `UseBlockZeroing`, it directly compares `cnt` and `BlockZeroingLowLimit / BytesPerWord`.
>>
>> https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp#L6198C1-L6204C16
>>
>>
>> address MacroAssembler::zero_words(Register base, uint64_t cnt)
>> {
>> assert(wordSize <= BlockZeroingLowLimit,
>> "increase BlockZeroingLowLimit");
>> address result = nullptr;
>> if (cnt <= (uint64_t)BlockZeroingLowLimit / BytesPerWord) {
>> #ifndef PRODUCT
>>
>>
>> In contrast, the inner stub function does so.
>>
>> https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp#L669
>>
>> address generate_zero_blocks() {
>> Label done;
>> Label base_aligned;
>>
>> Register base = r10, cnt = r11;
>>
>> __ align(CodeEntryAlignment);
>> StubId stub_id = StubId::stubgen_zero_blocks_id;
>> StubCodeMark mark(this, stub_id);
>> address start = __ pc();
>>
>> if (UseBlockZeroing) {
>
>> > > I would like to reiterate that I have no objection to the functions when the `-XX:+UseBlockZeroing` option is set, everything can keep as is. My point is that `BlockZeroingLowLimit` serves literally/specifically as a switch to control whether DC ZVA instructions are generated for clearing instances under a specified bytes size limitation, rather than for deciding between unrolling and callout. Therefore, it should NOT affect the code-gen results any longer when `-XX:-UseBlockZeroing` is set, should it?
>> >
>> >
>> > It does not. When `-XX:-UseBlockZeroing` is set, `BlockZeroingLowLimit` is ignored.
>>
>> zero_words does not check `UseBlockZeroing`, it directly compares `cnt` and `BlockZeroingLowLimit / BytesPerWord`.
>
> It doesn't need to because
>
>
> if (!UseBlockZeroing && !FLAG_IS_DEFAULT(BlockZeroingLowLimit)) {
> warning("BlockZeroingLowLimit has been ignored because UseBlockZeroing is disabled");
> FLAG_SET_DEFAULT(BlockZeroingLowLimit, is_zva_enabled() ? (4 * VM_Version::zva_length()) : 256);
> }
>
>
> That is to say, if a user sets `BlockZeroingLowLimit` and `-XX:-UseBlockZeroing`, then the user's `BlockZeroingLowLimit` is, rightly, ignored.
Hi @theRealAph and @adinn, please let me know if you have any additional comments on this PR, or advice to improve it. Thank you.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26917#issuecomment-3489152280
More information about the hotspot-dev
mailing list