/* -----------------------------------------------------------------------------
- * $Id: HsFFI.h,v 1.6 2000/08/29 13:34:21 qrczak Exp $
+ * $Id: HsFFI.h,v 1.7 2000/11/07 13:30:40 simonmar Exp $
*
* (c) The GHC Team, 2000
*
#define HS_WORD32_MAX UINT32_MAX
#define HS_WORD64_MAX UINT64_MAX
-#ifdef FLOATS_AS_DOUBLES
-
-#define HS_FLOAT_RADIX DBL_RADIX
-#define HS_FLOAT_ROUNDS DBL_ROUNDS
-#define HS_FLOAT_EPSILON DBL_EPSILON
-#define HS_FLOAT_DIG DBL_DIG
-#define HS_FLOAT_MANT_DIG DBL_MANT_DIG
-#define HS_FLOAT_MIN DBL_MIN
-#define HS_FLOAT_MIN_EXP DBL_MIN_EXP
-#define HS_FLOAT_MIN_10_EXP DBL_MIN_10_EXP
-#define HS_FLOAT_MAX DBL_MAX
-#define HS_FLOAT_MAX_EXP DBL_MAX_EXP
-#define HS_FLOAT_MAX_10_EXP DBL_MAX_10_EXP
-
-#else
-
#define HS_FLOAT_RADIX FLT_RADIX
#define HS_FLOAT_ROUNDS FLT_ROUNDS
#define HS_FLOAT_EPSILON FLT_EPSILON
#define HS_FLOAT_MAX_EXP FLT_MAX_EXP
#define HS_FLOAT_MAX_10_EXP FLT_MAX_10_EXP
-#endif /* FLOATS_AS_DOUBLES */
-
#define HS_DOUBLE_RADIX DBL_RADIX
#define HS_DOUBLE_ROUNDS DBL_ROUNDS
#define HS_DOUBLE_EPSILON DBL_EPSILON
/* -----------------------------------------------------------------------------
- * $Id: PrimOps.h,v 1.65 2000/11/07 10:42:56 simonmar Exp $
+ * $Id: PrimOps.h,v 1.66 2000/11/07 13:30:40 simonmar Exp $
*
- * (c) The GHC Team, 1998-1999
+ * (c) The GHC Team, 1998-2000
*
* Macros for primitive operations in STG-ish C code.
*
/* 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);
/* -----------------------------------------------------------------------------
- * $Id: StgTypes.h,v 1.13 2000/08/07 23:37:23 qrczak Exp $
+ * $Id: StgTypes.h,v 1.14 2000/11/07 13:30:40 simonmar Exp $
*
- * (c) The GHC Team, 1998-1999
+ * (c) The GHC Team, 1998-2000
*
* Various C datatypes used in the run-time system.
typedef StgWord32 StgChar;
typedef int StgBool;
-/*
- * If a double fits in an StgWord, don't bother using floats.
- */
-#if SIZEOF_DOUBLE == SIZEOF_VOID_P
-typedef double StgFloat;
-typedef double StgDouble;
-#define FLOATS_AS_DOUBLES 1
-#else
typedef float StgFloat;
typedef double StgDouble;
-#endif
typedef void StgVoid;
/* -----------------------------------------------------------------------------
* Bytecode evaluator
*
- * Copyright (c) 1994-1998.
+ * Copyright (c) 1994-2000.
*
* $RCSfile: Evaluator.c,v $
- * $Revision: 1.58 $
- * $Date: 2000/10/09 11:20:16 $
+ * $Revision: 1.59 $
+ * $Date: 2000/11/07 13:30:41 $
* ---------------------------------------------------------------------------*/
#include "Rts.h"
StgDouble B__encodeDouble (B* s, I_ e);
void B__decodeDouble (B* man, I_* exp, StgDouble dbl);
-#if ! FLOATS_AS_DOUBLES
StgFloat B__encodeFloat (B* s, I_ e);
void B__decodeFloat (B* man, I_* exp, StgFloat flt);
StgPtr CreateByteArrayToHoldInteger ( int );
B* IntegerInsideByteArray ( StgPtr );
void SloppifyIntegerEnd ( StgPtr );
-#endif
-#if ! FLOATS_AS_DOUBLES
StgFloat B__encodeFloat (B* s, I_ e) /* result = s * 2^e */
{
StgFloat r;
return r;
}
-#endif /* FLOATS_AS_DOUBLES */
}
-#if ! FLOATS_AS_DOUBLES
void B__decodeFloat (B* man, I_* exp, StgFloat flt)
{
/* Do some bit fiddling on IEEE */
do_renormalise(man);
}
-#endif /* FLOATS_AS_DOUBLES */
#endif /* INTERPRETER */
/* -----------------------------------------------------------------------------
- * $Id: PrimOps.hc,v 1.56 2000/11/07 10:42:57 simonmar Exp $
+ * $Id: PrimOps.hc,v 1.57 2000/11/07 13:30:41 simonmar Exp $
*
* (c) The GHC Team, 1998-2000
*
GMP_TAKE2_RET2(quotRemIntegerzh_fast, mpz_tdiv_qr);
GMP_TAKE2_RET2(divModIntegerzh_fast, mpz_fdiv_qr);
-#ifndef FLOATS_AS_DOUBLES
FN_(decodeFloatzh_fast)
{
MP_INT mantissa;
RET_NNP(exponent,mantissa._mp_size,p);
FE_
}
-#endif /* !FLOATS_AS_DOUBLES */
#define DOUBLE_MANTISSA_SIZE (sizeofW(StgDouble))
#define ARR_SIZE (sizeofW(StgArrWords) + DOUBLE_MANTISSA_SIZE)
if (mvar->head == (StgTSO *)&END_TSO_QUEUE_closure) {
mvar->tail = (StgTSO *)&END_TSO_QUEUE_closure;
}
+
+ /* unlocks the MVar in the SMP case */
+ SET_INFO(mvar,&FULL_MVAR_info);
+
+ /* yield, to give the newly woken thread a chance to take the MVar */
+ JMP_(stg_yield_noregs);
}
/* unlocks the MVar in the SMP case */
SET_INFO(mvar,&FULL_MVAR_info);
- /* ToDo: yield here for better communication performance? */
JMP_(ENTRY_CODE(Sp[0]));
FE_
}
/* -----------------------------------------------------------------------------
- * $Id: StgPrimFloat.c,v 1.5 1999/02/22 10:51:18 simonm Exp $
+ * $Id: StgPrimFloat.c,v 1.6 2000/11/07 13:30:41 simonmar Exp $
*
- * (c) The GHC Team, 1998-1999
+ * (c) The GHC Team, 1998-2000
*
* Miscellaneous support for floating-point primitives
*
*/
#define GMP_BASE 4294967296.0
-#if FLOATS_AS_DOUBLES /* defined in StgTypes.h */
-#define DNBIGIT 1 /* mantissa of a double will fit in one long */
-#else
#define DNBIGIT 2 /* mantissa of a double will fit in two longs */
-#endif
#define FNBIGIT 1 /* for float, one long */
#if IEEE_FLOATING_POINT
return r;
}
-#if ! FLOATS_AS_DOUBLES
StgFloat
__encodeFloat (I_ size, StgByteArray ba, I_ e) /* result = s * 2^e */
{
return r;
}
-#endif /* FLOATS_AS_DOUBLES */
-
/* This only supports IEEE floating point */
void
}
}
-#if ! FLOATS_AS_DOUBLES
void
__decodeFloat (MP_INT *man, I_ *exp, StgFloat flt)
{
man->_mp_size = -man->_mp_size;
}
}
-#endif /* FLOATS_AS_DOUBLES */
/* Convenient union types for checking the layout of IEEE 754 types -
based on defs in GNU libc <ieee754.h>
#ifdef IEEE_FLOATING_POINT
StgInt
-isDoubleNaN(d)
-StgDouble d;
+isDoubleNaN(StgDouble d)
{
union stg_ieee754_dbl u;
}
StgInt
-isDoubleInfinite(d)
-StgDouble d;
+isDoubleInfinite(StgDouble d)
{
union stg_ieee754_dbl u;
}
StgInt
-isDoubleDenormalized(d)
-StgDouble d;
+isDoubleDenormalized(StgDouble d)
{
union stg_ieee754_dbl u;
}
StgInt
-isDoubleNegativeZero(d)
-StgDouble d;
+isDoubleNegativeZero(StgDouble d)
{
union stg_ieee754_dbl u;
StgInt
-isFloatNaN(f)
-StgFloat f;
+isFloatNaN(StgFloat f)
{
-# ifdef FLOATS_AS_DOUBLES
- return (isDoubleNaN(f));
-# else
union stg_ieee754_flt u;
u.f = f;
return (
u.ieee.exponent == 255 /* 2^8 - 1 */ &&
u.ieee.mantissa != 0);
-
-# endif /* !FLOATS_AS_DOUBLES */
}
StgInt
-isFloatInfinite(f)
-StgFloat f;
+isFloatInfinite(StgFloat f)
{
-# ifdef FLOATS_AS_DOUBLES
- return (isDoubleInfinite(f));
-# else
union stg_ieee754_flt u;
u.f = f;
return (
u.ieee.exponent == 255 /* 2^8 - 1 */ &&
u.ieee.mantissa == 0);
-# endif /* !FLOATS_AS_DOUBLES */
}
StgInt
-isFloatDenormalized(f)
-StgFloat f;
+isFloatDenormalized(StgFloat f)
{
-# ifdef FLOATS_AS_DOUBLES
- return (isDoubleDenormalized(f));
-# else
union stg_ieee754_flt u;
u.f = f;
return (
u.ieee.exponent == 0 &&
u.ieee.mantissa != 0);
-#endif /* !FLOATS_AS_DOUBLES */
}
StgInt
-isFloatNegativeZero(f)
-StgFloat f;
+isFloatNegativeZero(StgFloat f)
{
-#ifdef FLOATS_AS_DOUBLES
- return (isDoubleNegativeZero(f));
-# else
union stg_ieee754_flt u;
u.f = f;
u.ieee.negative &&
u.ieee.exponent == 0 &&
u.ieee.mantissa == 0);
-# endif /* !FLOATS_AS_DOUBLES */
}
#else /* ! IEEE_FLOATING_POINT */