[aarch64-port-dev ] RFR(S): 8248851: CMS: Missing memory fences between free chunk check and klass read

Kim Barrett kim.barrett at oracle.com
Wed Jul 8 08:41:03 UTC 2020

> On Jul 7, 2020, at 10:49 PM, Yangfei (Felix) <felix.yang at huawei.com> wrote:
>> This change seems needed, but is it sufficient? Seems like there should be a
>> corresponding release/storestore/something for the correspnding writes; is
>> it there? (I haven't looked at CMS for quite a while, so no longer sure where
>> to look.)
> Yes, I think it's there.  As mention in my first mail, the logic in markNotFree:
> void markNotFree() {
>     // Set _prev (klass) to null before (if) clearing the mark word below
>     _prev = NULL;                                                        <========== Write klass (= NULL)
> #ifdef _LP64
>     if (UseCompressedOops) {
>       OrderAccess::storestore();                             <========== StoreStore barrier
>       set_mark(markOopDesc::prototype());    <========== Write marking not free
>     }
> #endif
>     assert(!is_free(), "Error");
> }

OK, I think I see what’s going on here.

Change looks good.

>> This issue seems to persist all the way until CMS removal in JDK 14.
> Since CMS is deprecated from JDK9, I am not sure if it's appropriate to fix this issue for those JDK9+ versions.

Deprecated != unsupported.

More information about the hotspot-gc-dev mailing list