--- a/src/hotspot/share/gc/parallel/mutableSpace.cpp Mon Nov 25 12:32:40 2019 +0100
+++ b/src/hotspot/share/gc/parallel/mutableSpace.cpp Mon Nov 25 12:33:15 2019 +0100
@@ -194,7 +194,7 @@
HeapWord* obj = top();
if (pointer_delta(end(), obj) >= size) {
HeapWord* new_top = obj + size;
- HeapWord* result = Atomic::cmpxchg(new_top, top_addr(), obj);
+ HeapWord* result = Atomic::cmpxchg(top_addr(), obj, new_top);
// result can be one of two:
// the old top value: the exchange succeeded
// otherwise: the new value of the top is returned.
@@ -213,7 +213,7 @@
// Try to deallocate previous allocation. Returns true upon success.
bool MutableSpace::cas_deallocate(HeapWord *obj, size_t size) {
HeapWord* expected_top = obj + size;
- return Atomic::cmpxchg(obj, top_addr(), expected_top) == expected_top;
+ return Atomic::cmpxchg(top_addr(), expected_top, obj) == expected_top;
}
void MutableSpace::oop_iterate(OopIterateClosure* cl) {