< prev index next >

src/hotspot/share/gc/z/zMarkStackAllocator.cpp

Print this page

        

@@ -68,11 +68,11 @@
     if (new_top > end) {
       // Not enough space left
       return 0;
     }
 
-    const uintptr_t prev_top = Atomic::cmpxchg(new_top, &_top, top);
+    const uintptr_t prev_top = Atomic::cmpxchg(&_top, top, new_top);
     if (prev_top == top) {
       // Success
       return top;
     }
 

@@ -108,12 +108,12 @@
   // Expand
   os::commit_memory_or_exit((char*)_end, expand_size, false /* executable */, "Mark stack space");
 
   // Increment top before end to make sure another
   // thread can't steal out newly expanded space.
-  addr = Atomic::add(size, &_top) - size;
-  Atomic::add(expand_size, &_end);
+  addr = Atomic::add(&_top, size) - size;
+  Atomic::add(&_end, expand_size);
 
   return addr;
 }
 
 uintptr_t ZMarkStackSpace::alloc(size_t size) {
< prev index next >