8158854: Ensure release_store is paired with load_acquire in lock-free code

Reviewed-by: shade, dcubed, zgu
This commit is contained in:
David Holmes 2016-08-29 20:13:45 -04:00
parent 56ff858c45
commit 6db26ca5bf
10 changed files with 87 additions and 23 deletions

View file

@ -50,12 +50,14 @@ class ClassFileStream;
class ClassPathEntry : public CHeapObj<mtClass> {
private:
ClassPathEntry* _next;
ClassPathEntry* volatile _next;
public:
// Next entry in class path
ClassPathEntry* next() const { return _next; }
ClassPathEntry* next() const {
return (ClassPathEntry*) OrderAccess::load_ptr_acquire(&_next);
}
void set_next(ClassPathEntry* next) {
// may have unlocked readers, so write atomically.
// may have unlocked readers, so ensure visibility.
OrderAccess::release_store_ptr(&_next, next);
}
virtual bool is_jrt() = 0;