From: simonmar Date: Tue, 7 Nov 2000 13:30:41 +0000 (+0000) Subject: [project @ 2000-11-07 13:30:40 by simonmar] X-Git-Tag: Approximately_9120_patches~3413 X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=330ff38d1257d80fb5f4a5aff0db6360f34eb948 [project @ 2000-11-07 13:30:40 by simonmar] Wave goodbye to FLOATS_AS_DOUBLES, it was a somewhat misconceived idea which will cause trouble with the FFI on 64-bit machines. --- diff --git a/ghc/includes/HsFFI.h b/ghc/includes/HsFFI.h index 9a349b7..ca186a2 100644 --- a/ghc/includes/HsFFI.h +++ b/ghc/includes/HsFFI.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $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 * @@ -104,22 +104,6 @@ typedef void* HsStablePtr; #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 @@ -132,8 +116,6 @@ typedef void* HsStablePtr; #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 diff --git a/ghc/includes/PrimOps.h b/ghc/includes/PrimOps.h index 8c2b03e..a43b185 100644 --- a/ghc/includes/PrimOps.h +++ b/ghc/includes/PrimOps.h @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------------- - * $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. * @@ -651,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); diff --git a/ghc/includes/StgTypes.h b/ghc/includes/StgTypes.h index d0a8104..6e5f47d 100644 --- a/ghc/includes/StgTypes.h +++ b/ghc/includes/StgTypes.h @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------------- - * $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. @@ -91,18 +91,9 @@ typedef void* StgAddr; 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; diff --git a/ghc/rts/Evaluator.c b/ghc/rts/Evaluator.c index 4ee9b0d..03a1548 100644 --- a/ghc/rts/Evaluator.c +++ b/ghc/rts/Evaluator.c @@ -2,11 +2,11 @@ /* ----------------------------------------------------------------------------- * 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" @@ -151,13 +151,11 @@ static int enterCountI = 0; 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 @@ -3983,7 +3981,6 @@ StgDouble B__encodeDouble (B* s, I_ e) /* result = s * 2^e */ -#if ! FLOATS_AS_DOUBLES StgFloat B__encodeFloat (B* s, I_ e) /* result = s * 2^e */ { StgFloat r; @@ -4002,7 +3999,6 @@ StgFloat B__encodeFloat (B* s, I_ e) /* result = s * 2^e */ return r; } -#endif /* FLOATS_AS_DOUBLES */ @@ -4064,7 +4060,6 @@ void B__decodeDouble (B* man, I_* exp, StgDouble dbl) } -#if ! FLOATS_AS_DOUBLES void B__decodeFloat (B* man, I_* exp, StgFloat flt) { /* Do some bit fiddling on IEEE */ @@ -4109,5 +4104,4 @@ void B__decodeFloat (B* man, I_* exp, StgFloat flt) do_renormalise(man); } -#endif /* FLOATS_AS_DOUBLES */ #endif /* INTERPRETER */ diff --git a/ghc/rts/PrimOps.hc b/ghc/rts/PrimOps.hc index b571db3..137807a 100644 --- a/ghc/rts/PrimOps.hc +++ b/ghc/rts/PrimOps.hc @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $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 * @@ -731,7 +731,6 @@ GMP_TAKE1_RET1(complementIntegerzh_fast, mpz_com); 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; @@ -761,7 +760,6 @@ FN_(decodeFloatzh_fast) 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) @@ -983,12 +981,17 @@ FN_(putMVarzh_fast) 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_ } diff --git a/ghc/rts/StgPrimFloat.c b/ghc/rts/StgPrimFloat.c index dad2350..960d5f8 100644 --- a/ghc/rts/StgPrimFloat.c +++ b/ghc/rts/StgPrimFloat.c @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------------- - * $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 * @@ -15,11 +15,7 @@ */ #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 @@ -84,7 +80,6 @@ __int_encodeDouble (I_ j, I_ e) return r; } -#if ! FLOATS_AS_DOUBLES StgFloat __encodeFloat (I_ size, StgByteArray ba, I_ e) /* result = s * 2^e */ { @@ -126,8 +121,6 @@ __int_encodeFloat (I_ j, I_ e) return r; } -#endif /* FLOATS_AS_DOUBLES */ - /* This only supports IEEE floating point */ void @@ -185,7 +178,6 @@ __decodeDouble (MP_INT *man, I_ *exp, StgDouble dbl) } } -#if ! FLOATS_AS_DOUBLES void __decodeFloat (MP_INT *man, I_ *exp, StgFloat flt) { @@ -229,7 +221,6 @@ __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 @@ -322,8 +313,7 @@ union stg_ieee754_dbl #ifdef IEEE_FLOATING_POINT StgInt -isDoubleNaN(d) -StgDouble d; +isDoubleNaN(StgDouble d) { union stg_ieee754_dbl u; @@ -337,8 +327,7 @@ StgDouble d; } StgInt -isDoubleInfinite(d) -StgDouble d; +isDoubleInfinite(StgDouble d) { union stg_ieee754_dbl u; @@ -353,8 +342,7 @@ StgDouble d; } StgInt -isDoubleDenormalized(d) -StgDouble d; +isDoubleDenormalized(StgDouble d) { union stg_ieee754_dbl u; @@ -376,8 +364,7 @@ StgDouble d; } StgInt -isDoubleNegativeZero(d) -StgDouble d; +isDoubleNegativeZero(StgDouble d) { union stg_ieee754_dbl u; @@ -404,12 +391,8 @@ StgDouble d; StgInt -isFloatNaN(f) -StgFloat f; +isFloatNaN(StgFloat f) { -# ifdef FLOATS_AS_DOUBLES - return (isDoubleNaN(f)); -# else union stg_ieee754_flt u; u.f = f; @@ -418,17 +401,11 @@ StgFloat 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; @@ -437,16 +414,11 @@ StgFloat 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; @@ -460,16 +432,11 @@ StgFloat 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; @@ -478,7 +445,6 @@ StgFloat f; u.ieee.negative && u.ieee.exponent == 0 && u.ieee.mantissa == 0); -# endif /* !FLOATS_AS_DOUBLES */ } #else /* ! IEEE_FLOATING_POINT */