On Tue, 18 Aug 2026 23:22:29 GMT, Ioi Lam <[email protected]> wrote:
>> Boris Ulasevich has updated the pull request incrementally with one
>> additional commit since the last revision:
>>
>> Use CHECK_AVAILABLE to explain why cds-archive-preview is unavailable
>
> src/hotspot/share/cds/archiveUtils.cpp line 396:
>
>> 394: size_t gap_bytes = _gap_tree.add_gap(gap_bottom, gap_top);
>> 395: allocate(gap_bytes);
>> 396: }
>
> The purpose of the `allocate(gap_bytes)` call is to move the allocation top
> upwards to satisfy the `precond` at line 405
>
>
> precond(is_aligned(top(), alignment));
>
>
> If we skip the `allocate` call, won't the `precond` fail?
Thanks for catching this. You are right - only add_gap() belongs under the if;
allocate() has to stay unconditional.
Update:
size_t gap_bytes = pointer_delta(gap_top, gap_bottom, 1);
+ // A gap smaller than an allocation unit can never be reused
+ if (gap_bytes >= SharedSpaceObjectAlignment) {
_gap_tree.add_gap(gap_bottom, gap_top);
+ }
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/32402#discussion_r3817252433