RFR: 8328602: Parallel: Incorrect assertion in fill_dense_prefix_end
Guoxiong Li
gli at openjdk.org
Thu Mar 21 13:26:20 UTC 2024
On Thu, 21 Mar 2024 13:10:30 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
>> src/hotspot/share/gc/parallel/psParallelCompact.cpp line 1280:
>>
>>> 1278: return;
>>> 1279: }
>>> 1280: assert(CollectedHeap::min_fill_size() == 2, "inv");
>>
>> When `ObjectAlignmentInBytes` is 8 or 16 (`MinObjAlignment` is 1 or 2), the `min_fill_size()` returns **2**. When `ObjectAlignmentInBytes` is larger than 16 (`MinObjAlignment` is larger then 2), the `min_fill_size()` returns a value **larger than 2**.
>>
>> According to the first `assert` statement and the `if` statement, we can know that:
>> After the `if` statement, the `MinObjAlignment` must be `1`, so the second `assert` statement must be `true`. Could these two `assert` statement be simplified to one?
>
>> Could these two assert statement be simplified to one?
>
> Could you provide a code snippet of how you see this being structured? It's unclear to me what your suggestion here is.
> When `MinObjAlignment` is 8 or 16 (`MinObjAlignment` is 1 or 2),
Sorry, one typo. The first `MinObjAlignment` should be `ObjectAlignmentInBytes`. I fixed the previous comment.
> Could these two assert statement be simplified to one?
Actually, the second `assert` can be removed because we can deduce it according to the first `assert` and the `if` statement.
I provided such unclear guide just because I think you or others may have a better way to revise the code (instead of simply removing the second one).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18396#discussion_r1533900721
More information about the hotspot-gc-dev
mailing list