Skip to content

Commit

Permalink
zos: implement cmpxchgi() using assembly (libuv#3543)
Browse files Browse the repository at this point in the history
Use hand-rolled assembly to resolve a runtime bug related to the codegen
from builtin __plo_CSST.

Co-authored-by: ccw <ccw.280231@ca.ibm.com>
  • Loading branch information
zsw007 and ccw-1 authored Mar 13, 2022
1 parent bc9cd56 commit 442e471
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/unix/atomic-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,11 @@ UV_UNUSED(static int cmpxchgi(int* ptr, int oldval, int newval)) {
: "memory");
return out;
#elif defined(__MVS__)
unsigned int op4;
if (__plo_CSST(ptr, (unsigned int*) &oldval, newval,
(unsigned int*) ptr, *ptr, &op4))
return oldval;
else
return op4;
/* Use hand-rolled assembly because codegen from builtin __plo_CSST results in
* a runtime bug.
*/
__asm(" cs %0,%2,%1 \n " : "+r"(oldval), "+m"(*ptr) : "r"(newval) :);
return oldval;
#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
return atomic_cas_uint((uint_t *)ptr, (uint_t)oldval, (uint_t)newval);
#else
Expand Down

0 comments on commit 442e471

Please sign in to comment.