Use canned heap checks to save a few bytes of code
authorSimon Marlow <marlowsd@gmail.com>
Tue, 23 Oct 2012 08:45:05 +0000 (09:45 +0100)
committerSimon Marlow <marlowsd@gmail.com>
Tue, 23 Oct 2012 10:13:30 +0000 (11:13 +0100)
includes/Cmm.h
rts/PrimOps.cmm

index 9cb2dbc..2b5d93b 100644 (file)
     TICK_ALLOC_PRIM(SIZEOF_StgHeader,bytes-SIZEOF_StgHeader,0); \
     CCCS_ALLOC(bytes);
 
+#define ALLOC_PRIM_(bytes,fun)                                  \
+    ALLOC_PRIM_WITH_CUSTOM_FAILURE(bytes,GC_PRIM(fun));
+
 #define ALLOC_PRIM_P(bytes,fun,arg)                             \
     ALLOC_PRIM_WITH_CUSTOM_FAILURE(bytes,GC_PRIM_P(fun,arg));
 
index 6cba3f5..993088a 100644 (file)
@@ -252,7 +252,7 @@ stg_newMutVarzh ( gcptr init )
 {
     W_ mv;
 
-    ALLOC_PRIM (SIZEOF_StgMutVar);
+    ALLOC_PRIM_P (SIZEOF_StgMutVar, stg_newMutVarzh, init);
 
     mv = Hp - SIZEOF_StgMutVar + WDS(1);
     SET_HDR(mv,stg_MUT_VAR_DIRTY_info,CCCS);
@@ -1154,7 +1154,7 @@ stg_newMVarzh ()
 {
     W_ mvar;
 
-    ALLOC_PRIM (SIZEOF_StgMVar);
+    ALLOC_PRIM_ (SIZEOF_StgMVar, stg_newMVarzh);
   
     mvar = Hp - SIZEOF_StgMVar + WDS(1);
     SET_HDR(mvar,stg_MVAR_DIRTY_info,CCCS);