Semantics of CollectedHeap::requires_barriers()

Roman Kennke rkennke at redhat.com
Fri Feb 5 19:17:54 UTC 2021


Hello Loom devs,

I am currently trying to befriend Loom and Shenandoah GC. It's falling 
over this assert here:

https://github.com/openjdk/loom/blob/e8aeb3d34d9dee2f1f5c1ddc71a41adc991b5808/src/hotspot/share/runtime/continuation.cpp#L2650

And thus I'm trying to figure out what requires_barriers() means in this 
context, what is the expected semantics of it.

In other GCs it seems to return false when the object is in a heap 
region that is not used for allocations:

E.g.:
https://github.com/openjdk/loom/blob/e8aeb3d34d9dee2f1f5c1ddc71a41adc991b5808/src/hotspot/share/gc/g1/g1CollectedHeap.cpp#L2222

or:

https://github.com/openjdk/loom/blob/e8aeb3d34d9dee2f1f5c1ddc71a41adc991b5808/src/hotspot/share/gc/z/zCollectedHeap.cpp#L124

However, the declaration here says something different, that it should 
return false when HeapAccess are equivalent to RawAccess:

https://github.com/openjdk/loom/blob/e8aeb3d34d9dee2f1f5c1ddc71a41adc991b5808/src/hotspot/share/gc/shared/collectedHeap.hpp#L360

In most GCs this would be the case when GC is not active. But that is 
not how it's implemented in other GCs.

Can you please shed some light what is the intention behind 
requires_barriers() and how it is used?

Thanks a lot!
Roman



More information about the loom-dev mailing list