From a6939ec29a9238cee38bee20844ae8cdcd4952fd Mon Sep 17 00:00:00 2001 From: Johan Tibell Date: Thu, 20 Mar 2014 07:58:10 +0100 Subject: Don't use gcptr for interior pointers gcptr should only be used for pointers that the GC should follow. While this didn't cause any bugs right now, since these variables aren't live over a GC, it's clearer to use the right type. --- rts/PrimOps.cmm | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'rts/PrimOps.cmm') diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm index 0e547be388..25e6534118 100644 --- a/rts/PrimOps.cmm +++ b/rts/PrimOps.cmm @@ -142,8 +142,7 @@ stg_newAlignedPinnedByteArrayzh ( W_ n, W_ alignment ) stg_casIntArrayzh( gcptr arr, W_ ind, W_ old, W_ new ) /* MutableByteArray# s -> Int# -> Int# -> Int# -> State# s -> (# State# s, Int# #) */ { - gcptr p; - W_ h; + W_ p, h; p = arr + SIZEOF_StgArrWords + WDS(ind); (h) = ccall cas(p, old, new); @@ -155,8 +154,7 @@ stg_casIntArrayzh( gcptr arr, W_ ind, W_ old, W_ new ) stg_fetchAddIntArrayzh( gcptr arr, W_ ind, W_ incr ) /* MutableByteArray# s -> Int# -> Int# -> State# s -> (# State# s, Int# #) */ { - gcptr p; - W_ h; + W_ p, h; p = arr + SIZEOF_StgArrWords + WDS(ind); (h) = ccall atomic_inc(p, incr); @@ -167,8 +165,8 @@ stg_fetchAddIntArrayzh( gcptr arr, W_ ind, W_ incr ) stg_newArrayzh ( W_ n /* words */, gcptr init ) { - W_ words, size; - gcptr p, arr; + W_ words, size, p; + gcptr arr; again: MAYBE_GC(again); @@ -231,8 +229,8 @@ stg_unsafeThawArrayzh ( gcptr arr ) stg_casArrayzh ( gcptr arr, W_ ind, gcptr old, gcptr new ) /* MutableArray# s a -> Int# -> a -> a -> State# s -> (# State# s, Int#, Any a #) */ { - gcptr p, h; - W_ len; + gcptr h; + W_ p, len; p = arr + SIZEOF_StgMutArrPtrs + WDS(ind); (h) = ccall cas(p, old, new); @@ -252,8 +250,8 @@ stg_casArrayzh ( gcptr arr, W_ ind, gcptr old, gcptr new ) stg_newArrayArrayzh ( W_ n /* words */ ) { - W_ words, size; - gcptr p, arr; + W_ words, size, p; + gcptr arr; MAYBE_GC_N(stg_newArrayArrayzh, n); -- cgit v1.2.1