On Tue, 8 Oct 2024 07:40:24 GMT, Albert Mingkun Yang <ay...@openjdk.org> wrote:
>> After re-reading this again I agree with what you're writing. If you make >> the change to use: >> >> if (MinObjAlignment >= CollectedHeap::min_fill_size()) { >> return; >> } >> >> >> do you even have to check for UCOH in this function? >> >> I also wonder if you could tweak the comment now that this is not true when >> UCOH is on: >> >> // The size of the filler (min-obj-size) is 2 heap words with the default >> // MinObjAlignment, since both markword and klass take 1 heap word. > > I took UCOH into account when this code was written -- the current version of > PR would fail the following assert. > > > // Note: If min-fill-size decreases to 1, this whole method becomes > redundant. > assert(CollectedHeap::min_fill_size() >= 2, "inv"); > > > The least intrusive way, IMO, is to put `if (UCOH) { return; }` right before > `// Note: ...`, kind of like what Roman originally put it. I believe the > advantage of this style is that when UCOH before always-true, it's obvious > this whole method essentially becomes `return`and can be removed right away. I was thinking that we should remove the entire: // Note: If min-fill-size decreases to 1, this whole method becomes redundant. assert(CollectedHeap::min_fill_size() >= 2, "inv"); block, since it is now incorrect, guarded by the proper check, and the comment is misleading since we now can have a min-fill-size that is 1. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/20677#discussion_r1791409345