[project @ 2000-11-21 09:57:02 by sewardj]
[ghc-hetmet.git] / ghc / includes / PrimOps.h
index 71bc8af..cf467a4 100644 (file)
@@ -1,7 +1,7 @@
 /* -----------------------------------------------------------------------------
- * $Id: PrimOps.h,v 1.63 2000/09/26 16:45:34 simonpj Exp $
+ * $Id: PrimOps.h,v 1.67 2000/11/13 14:40:36 simonmar Exp $
  *
- * (c) The GHC Team, 1998-1999
+ * (c) The GHC Team, 1998-2000
  *
  * Macros for primitive operations in STG-ish C code.
  *
         r = ((P_ *)tmp)[i];                                             \
    } while (0)
 
-
-#else
-
-/* These are the original definitions.  They don't chase indirections. */
-#define indexWordOffClosurezh(r,a,i)           r= ((W_ *)(a))[i]
-#define indexPtrOffClosurezh(r,a,i)    r= ((P_ *)(a))[i]
-
 #endif
 
-
 /* -----------------------------------------------------------------------------
    Comparison PrimOps.
    -------------------------------------------------------------------------- */
@@ -444,6 +436,12 @@ EXTFUN_RTS(word2Integerzh_fast);
 EXTFUN_RTS(decodeFloatzh_fast);
 EXTFUN_RTS(decodeDoublezh_fast);
 
+/* Bit operations */
+EXTFUN_RTS(andIntegerzh_fast);
+EXTFUN_RTS(orIntegerzh_fast);
+EXTFUN_RTS(xorIntegerzh_fast);
+EXTFUN_RTS(complementIntegerzh_fast);
+
 /* -----------------------------------------------------------------------------
    Word64 PrimOps.
    -------------------------------------------------------------------------- */
@@ -549,11 +547,11 @@ LI_ stg_word64ToInt64 (StgWord64);
 
 #ifdef DEBUG
 #define BYTE_ARR_CTS(a)                                  \
- ({ ASSERT(GET_INFO((StgArrWords *)(a)) == &ARR_WORDS_info);     \
+ ({ ASSERT(GET_INFO((StgArrWords *)(a)) == &stg_ARR_WORDS_info);         \
     REAL_BYTE_ARR_CTS(a); })
 #define PTRS_ARR_CTS(a)                                  \
- ({ ASSERT((GET_INFO((StgMutArrPtrs  *)(a)) == &MUT_ARR_PTRS_FROZEN_info)        \
-       || (GET_INFO((StgMutArrPtrs  *)(a)) == &MUT_ARR_PTRS_info));  \
+ ({ ASSERT((GET_INFO((StgMutArrPtrs  *)(a)) == &stg_MUT_ARR_PTRS_FROZEN_info)    \
+       || (GET_INFO((StgMutArrPtrs  *)(a)) == &stg_MUT_ARR_PTRS_info));  \
     REAL_PTRS_ARR_CTS(a); })
 #else
 #define BYTE_ARR_CTS(a)                REAL_BYTE_ARR_CTS(a)
@@ -621,7 +619,7 @@ extern I_ resetGenSymZh(void);
 
 #define unsafeFreezzeArrayzh(r,a)                                      \
        {                                                               \
-        SET_INFO((StgClosure *)a,&MUT_ARR_PTRS_FROZEN_info);            \
+        SET_INFO((StgClosure *)a,&stg_MUT_ARR_PTRS_FROZEN_info);        \
        r = a;                                                          \
        }
 
@@ -653,22 +651,15 @@ EXTFUN_RTS(newArrayzh_fast);
 /* The decode operations are out-of-line because they need to allocate
  * a byte array.
  */
-#ifdef FLOATS_AS_DOUBLES
-#define decodeFloatzh_fast decodeDoublezh_fast
-#else
 EXTFUN_RTS(decodeFloatzh_fast);
-#endif
-
 EXTFUN_RTS(decodeDoublezh_fast);
 
 /* grimy low-level support functions defined in StgPrimFloat.c */
 
 extern StgDouble __encodeDouble (I_ size, StgByteArray arr, I_ e);
 extern StgDouble __int_encodeDouble (I_ j, I_ e);
-#ifndef FLOATS_AS_DOUBLES
 extern StgFloat  __encodeFloat (I_ size, StgByteArray arr, I_ e);
 extern StgFloat  __int_encodeFloat (I_ j, I_ e);
-#endif
 extern void      __decodeDouble (MP_INT *man, I_ *_exp, StgDouble dbl);
 extern void      __decodeFloat  (MP_INT *man, I_ *_exp, StgFloat flt);
 extern StgInt    isDoubleNaN(StgDouble d);
@@ -700,7 +691,7 @@ EXTFUN_RTS(newMutVarzh_fast);
 #define sameMVarzh(r,a,b)        r=(I_)((a)==(b))
 
 /* Assume external decl of EMPTY_MVAR_info is in scope by now */
-#define isEmptyMVarzh(r,a)       r=(I_)((GET_INFO((StgMVar*)(a))) == &EMPTY_MVAR_info )
+#define isEmptyMVarzh(r,a)       r=(I_)((GET_INFO((StgMVar*)(a))) == &stg_EMPTY_MVAR_info )
 EXTFUN_RTS(newMVarzh_fast);
 EXTFUN_RTS(takeMVarzh_fast);
 EXTFUN_RTS(tryTakeMVarzh_fast);
@@ -879,7 +870,7 @@ EXTFUN_RTS(mkWeakzh_fast);
 EXTFUN_RTS(finalizzeWeakzh_fast);
 
 #define deRefWeakzh(code,val,w)                                \
-  if (((StgWeak *)w)->header.info == &WEAK_info) {     \
+  if (((StgWeak *)w)->header.info == &stg_WEAK_info) { \
        code = 1;                                       \
        val = (P_)((StgWeak *)w)->value;                \
   } else {                                             \