Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/1ed0193c707a6694d242848527927f3904d1b79a

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

commit 1ed0193c707a6694d242848527927f3904d1b79a
Author: Simon Marlow <marlo...@gmail.com>
Date:   Fri Apr 27 11:12:38 2012 +0100

    Add a new primop mkWeakNoFinalizer (#5879)

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

 compiler/prelude/primops.txt.pp |    6 ++++++
 includes/stg/MiscClosures.h     |    1 +
 rts/Linker.c                    |    1 +
 rts/PrimOps.cmm                 |   16 +++++++++++-----
 4 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/compiler/prelude/primops.txt.pp b/compiler/prelude/primops.txt.pp
index b1ef1d2..97fc0a5 100644
--- a/compiler/prelude/primops.txt.pp
+++ b/compiler/prelude/primops.txt.pp
@@ -1821,6 +1821,12 @@ primop  MkWeakOp "mkWeak#" GenPrimOp
    has_side_effects = True
    out_of_line      = True
 
+primop  MkWeakNoFinalizerOp "mkWeakNoFinalizer#" GenPrimOp
+   o -> b -> State# RealWorld -> (# State# RealWorld, Weak# b #)
+   with
+   has_side_effects = True
+   out_of_line      = True
+
 primop  MkWeakForeignEnvOp "mkWeakForeignEnv#" GenPrimOp
    o -> b -> Addr# -> Addr# -> Int# -> Addr# -> State# RealWorld -> (# State# 
RealWorld, Weak# b #)
    with
diff --git a/includes/stg/MiscClosures.h b/includes/stg/MiscClosures.h
index 4fed346..c93cc31 100644
--- a/includes/stg/MiscClosures.h
+++ b/includes/stg/MiscClosures.h
@@ -426,6 +426,7 @@ RTS_FUN_DECL(stg_isCurrentThreadBoundzh);
 RTS_FUN_DECL(stg_threadStatuszh);
 
 RTS_FUN_DECL(stg_mkWeakzh);
+RTS_FUN_DECL(stg_mkWeakNoFinalizzerzh);
 RTS_FUN_DECL(stg_mkWeakForeignzh);
 RTS_FUN_DECL(stg_mkWeakForeignEnvzh);
 RTS_FUN_DECL(stg_finalizzeWeakzh);
diff --git a/rts/Linker.c b/rts/Linker.c
index c983403..3b51e69 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -294,6 +294,7 @@ typedef struct _RtsSymbolVal {
 } RtsSymbolVal;
 
 #define Maybe_Stable_Names      SymI_HasProto(stg_mkWeakzh)                    
 \
+                                SymI_HasProto(stg_mkWeakNoFinalizzerzh)        
 \
                                 SymI_HasProto(stg_mkWeakForeignEnvzh)          
 \
                                 SymI_HasProto(stg_makeStableNamezh)            
 \
                                 SymI_HasProto(stg_finalizzeWeakzh)
diff --git a/rts/PrimOps.cmm b/rts/PrimOps.cmm
index aaedabb..93ef23a 100644
--- a/rts/PrimOps.cmm
+++ b/rts/PrimOps.cmm
@@ -384,14 +384,10 @@ stg_mkWeakzh
 {
   /* R1 = key
      R2 = value
-     R3 = finalizer (or NULL)
+     R3 = finalizer (or stg_NO_FINALIZER_closure)
   */
   W_ w;
 
-  if (R3 == NULL) {
-    R3 = stg_NO_FINALIZER_closure;
-  }
-
   ALLOC_PRIM( SIZEOF_StgWeak, R1_PTR & R2_PTR & R3_PTR, stg_mkWeakzh );
 
   w = Hp - SIZEOF_StgWeak + WDS(1);
@@ -416,6 +412,16 @@ stg_mkWeakzh
   RET_P(w);
 }
 
+stg_mkWeakNoFinalizzerzh
+{
+  /* R1 = key
+     R2 = value
+   */
+  R3 = stg_NO_FINALIZER_closure;
+
+  jump stg_mkWeakzh;
+}
+
 stg_mkWeakForeignEnvzh
 {
   /* R1 = key



_______________________________________________
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to