diff options
Diffstat (limited to 'rts')
-rw-r--r-- | rts/PrimOps.cmm | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm index b13e05ce87..710330714e 100644 --- a/rts/PrimOps.cmm +++ b/rts/PrimOps.cmm @@ -206,28 +206,25 @@ stg_unsafeThawArrayzh ( gcptr arr ) } } -stg_casArrayzh +stg_casArrayzh ( gcptr arr, W_ ind, gcptr old, gcptr new ) /* MutableArray# s a -> Int# -> a -> a -> State# s -> (# State# s, Int#, a #) */ { - W_ arr, p, ind, old, new, h, len; - arr = R1; // anything else? - ind = R2; - old = R3; - new = R4; + gcptr p, h; + W_ len; p = arr + SIZEOF_StgMutArrPtrs + WDS(ind); - (h) = foreign "C" cas(p, old, new) []; + (h) = ccall cas(p, old, new); if (h != old) { // Failure, return what was there instead of 'old': - RET_NP(1,h); + return (1,h); } else { // Compare and Swap Succeeded: SET_HDR(arr, stg_MUT_ARR_PTRS_DIRTY_info, CCCS); len = StgMutArrPtrs_ptrs(arr); // The write barrier. We must write a byte into the mark table: I8[arr + SIZEOF_StgMutArrPtrs + WDS(len) + (ind >> MUT_ARR_PTRS_CARD_BITS )] = 1; - RET_NP(0,h); + return (0,h); } } |