[commit: ghc] master: Don't use gcptr for interior pointers (a6939ec)

git at git.haskell.org git at git.haskell.org
Thu Mar 20 07:52:20 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/a6939ec29a9238cee38bee20844ae8cdcd4952fd/ghc

>---------------------------------------------------------------

commit a6939ec29a9238cee38bee20844ae8cdcd4952fd
Author: Johan Tibell <johan.tibell at gmail.com>
Date:   Thu Mar 20 07:58:10 2014 +0100

    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.


>---------------------------------------------------------------

a6939ec29a9238cee38bee20844ae8cdcd4952fd
 rts/PrimOps.cmm |   18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index 0e547be..25e6534 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);
 



More information about the ghc-commits mailing list