Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8259271: gc/parallel/TestDynShrinkHeap.java still fails "assert(cover…
…ed_region.contains(new_memregion)) failed: new region is not in covered_region"

Use load_acquire to order reads of top and end.

Reviewed-by: tschatzl, iwalulya, eosterlund
  • Loading branch information
Kim Barrett committed Jan 22, 2021
1 parent d90e06a commit 685c03dc4899e4f43e830d516b751969ed20ec21
Showing 1 changed file with 5 additions and 1 deletion.
@@ -194,7 +194,11 @@ HeapWord* MutableSpace::allocate(size_t size) {
// This version is lock-free.
HeapWord* MutableSpace::cas_allocate(size_t size) {
do {
HeapWord* obj = top();
// Read top before end, else the range check may pass when it shouldn't.
// If end is read first, other threads may advance end and top such that
// current top > old end and current top + size > current end. Then
// pointer_delta underflows, allowing installation of top > current end.
HeapWord* obj = Atomic::load_acquire(top_addr());
if (pointer_delta(end(), obj) >= size) {
HeapWord* new_top = obj + size;
HeapWord* result = Atomic::cmpxchg(top_addr(), obj, new_top);

1 comment on commit 685c03d

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 685c03d Jan 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.