RFR: 8328602: Parallel: Incorrect assertion in fill_dense_prefix_end
Guoxiong Li
gli at openjdk.org
Thu Mar 21 13:37:19 UTC 2024
On Thu, 21 Mar 2024 13:23:46 GMT, Guoxiong Li <gli at openjdk.org> wrote:
>>> 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).
Concretely, when the first `assert` statement is `true`, we can know `MinObjAlignment >= 1`. Then the `if` statement excludes the `MinObjAlignment > 1`. So, only when `MinObjAlignment == 1`, the code can run after the `if` statement, then the `min_fill_size()` must be **2**.
assert(CollectedHeap::min_fill_size() >= 2, "inv");
// <-- here, `MinObjAlignment >= 1`
if (MinObjAlignment > 1) { // exclude the `MinObjAlignment > 1`
return;
}
// <-- only one condition: `MinObjAlignment == 1`
assert(CollectedHeap::min_fill_size() == 2, "inv"); // <-- This assert must be true and unnecessary, because `MinObjAlignment == 1`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18396#discussion_r1533919474
More information about the hotspot-gc-dev
mailing list