[project @ 1999-07-14 13:39:46 by simonmar]
[ghc-hetmet.git] / ghc / rts / PrimOps.hc
index 4ec104e..84ecf27 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: PrimOps.hc,v 1.24 1999/03/22 09:24:45 simonm Exp $
+ * $Id: PrimOps.hc,v 1.28 1999/07/14 13:42:28 simonmar Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -168,7 +168,7 @@ W_ GHC_ZCCReturnable_static_info[0];
 # define RET_NP(a,b)   PUSH_N(3,a); PUSH_P(1,b); PUSHED(3)
 
 # define RET_PPP(a,b,c) PUSH_P(3,a); PUSH_P(2,b); PUSH_P(1,c); PUSHED(3)
-# define RET_NNP(a,b,c) PUSH_N(6,a); PUSH_N(4,b); PUSH_N(2,c); PUSHED(6)
+# define RET_NNP(a,b,c) PUSH_N(5,a); PUSH_N(3,b); PUSH_P(1,c); PUSHED(5)
 
 # define RET_NNNP(a,b,c,d) PUSH_N(7,a); PUSH_N(5,b); PUSH_N(3,c); PUSH_P(1,d); PUSHED(7)       
 # define RET_NPNP(a,b,c,d) PUSH_N(6,a); PUSH_P(4,b); PUSH_N(3,c); PUSH_P(1,d); PUSHED(6)       
@@ -682,7 +682,7 @@ FN_(decodeFloatzh_fast)
   /* arguments: F1 = Float# */
   arg = F1;
 
-  HP_CHK_GEN(sizeof(StgArrWords)+1, NO_PTRS, decodeFloatzh_fast,);
+  HP_CHK_GEN(sizeofW(StgArrWords)+1, NO_PTRS, decodeFloatzh_fast,);
   TICK_ALLOC_PRIM(sizeofW(StgArrWords),1,0);
   CCS_ALLOC(CCCS,sizeofW(StgArrWords)+1); /* ccs prof */
 
@@ -702,8 +702,8 @@ FN_(decodeFloatzh_fast)
 }
 #endif /* !FLOATS_AS_DOUBLES */
 
-#define DOUBLE_MANTISSA_SIZE (sizeof(StgDouble)/sizeof(W_))
-#define ARR_SIZE (sizeof(StgArrWords) + DOUBLE_MANTISSA_SIZE)
+#define DOUBLE_MANTISSA_SIZE (sizeofW(StgDouble))
+#define ARR_SIZE (sizeofW(StgArrWords) + DOUBLE_MANTISSA_SIZE)
 
 FN_(decodeDoublezh_fast)
 { MP_INT mantissa;
@@ -716,7 +716,7 @@ FN_(decodeDoublezh_fast)
   arg = D1;
 
   HP_CHK_GEN(ARR_SIZE, NO_PTRS, decodeDoublezh_fast,);
-  TICK_ALLOC_PRIM(sizeof(StgArrWords),DOUBLE_MANTISSA_SIZE,0);
+  TICK_ALLOC_PRIM(sizeofW(StgArrWords),DOUBLE_MANTISSA_SIZE,0);
   CCS_ALLOC(CCCS,ARR_SIZE); /* ccs prof */
 
   /* Be prepared to tell Lennart-coded __decodeDouble  */
@@ -743,17 +743,14 @@ FN_(forkzh_fast)
   FB_
   /* args: R1 = closure to spark */
   
-  if (closure_SHOULD_SPARK(R1.cl)) {
+  MAYBE_GC(R1_PTR, forkzh_fast);
 
-    MAYBE_GC(R1_PTR, forkzh_fast);
-
-    /* create it right now, return ThreadID in R1 */
-    R1.t = RET_STGCALL2(StgTSO *, createIOThread, 
-                       RtsFlags.GcFlags.initialStkSize, R1.cl);
+  /* create it right now, return ThreadID in R1 */
+  R1.t = RET_STGCALL2(StgTSO *, createIOThread, 
+                     RtsFlags.GcFlags.initialStkSize, R1.cl);
       
-    /* switch at the earliest opportunity */ 
-    context_switch = 1;
-  }
+  /* switch at the earliest opportunity */ 
+  context_switch = 1;
   
   JMP_(ENTRY_CODE(Sp[0]));
   FE_
@@ -870,7 +867,6 @@ FN_(putMVarzh_fast)
 
   mvar = (StgMVar *)R1.p;
   if (GET_INFO(mvar) == &FULL_MVAR_info) {
-    fflush(stdout);
     fprintf(stderr, "putMVar#: MVar already full.\n");
     stg_exit(EXIT_FAILURE);
   }