[commit: ghc] master: Start moving other constants from (Haskell)Constants to platformConstants (9b0c4ed)
Simon Marlow
marlowsd at gmail.com
Tue Sep 18 15:58:54 CEST 2012
On 14/09/2012 17:25, Ian Lynagh wrote:
> Repository : ssh://darcs.haskell.org//srv/darcs/ghc
>
> On branch : master
>
> http://hackage.haskell.org/trac/ghc/changeset/9b0c4ed70cb4394bb293e4e6f863f877debcd655
>
>> ---------------------------------------------------------------
>
> commit 9b0c4ed70cb4394bb293e4e6f863f877debcd655
> Author: Ian Lynagh <ian at well-typed.com>
> Date: Fri Sep 14 12:48:53 2012 +0100
>
> Start moving other constants from (Haskell)Constants to platformConstants
>
>> ---------------------------------------------------------------
>
> compiler/codeGen/CgExpr.lhs | 5 ++---
> compiler/codeGen/StgCmmBind.hs | 4 ++--
> includes/HaskellConstants.hs | 7 -------
> includes/mkDerivedConstants.c | 24 ++++++++++++++++++++++++
> 4 files changed, 28 insertions(+), 12 deletions(-)
>
> diff --git a/compiler/codeGen/CgExpr.lhs b/compiler/codeGen/CgExpr.lhs
> index d57dec1..1519476 100644
> --- a/compiler/codeGen/CgExpr.lhs
> +++ b/compiler/codeGen/CgExpr.lhs
> @@ -15,7 +15,6 @@ module CgExpr ( cgExpr ) where
>
> #include "HsVersions.h"
>
> -import Constants
> import StgSyn
> import CgMonad
>
> @@ -352,7 +351,7 @@ mkRhsClosure dflags bndr cc bi
> (StgApp selectee [{-no args-}]))])
> | the_fv == scrutinee -- Scrutinee is the only free variable
> && maybeToBool maybe_offset -- Selectee is a component of the tuple
> - && offset_into_int <= mAX_SPEC_SELECTEE_SIZE -- Offset is small enough
> + && offset_into_int <= mAX_SPEC_SELECTEE_SIZE dflags -- Offset is small enough
I don't think we'll ever want to modify mAX_SPEC_SELECTEE_SIZE or
mAX_SPEC_AP_SIZE on a per-platform basis, because it is tied to the code
in the RTS - to change it, you would have to modify rts/StgStdThunks.cmm
too. It's a function of the RTS, not the platform. So I think this
could safely stay in Constants.hs.
Cheers,
Simon
> = -- NOT TRUE: ASSERT(is_single_constructor)
> -- The simplifier may have statically determined that the single alternative
> -- is the only possible case and eliminated the others, even if there are
> @@ -396,7 +395,7 @@ mkRhsClosure dflags bndr cc bi
> | args `lengthIs` (arity-1)
> && all isFollowableArg (map idCgRep fvs)
> && isUpdatable upd_flag
> - && arity <= mAX_SPEC_AP_SIZE
> + && arity <= mAX_SPEC_AP_SIZE dflags
> && not (dopt Opt_SccProfilingOn dflags)
> -- not when profiling: we don't want to
> -- lose information about this particular
> diff --git a/compiler/codeGen/StgCmmBind.hs b/compiler/codeGen/StgCmmBind.hs
> index 105aa0f..aac1abf 100644
> --- a/compiler/codeGen/StgCmmBind.hs
> +++ b/compiler/codeGen/StgCmmBind.hs
> @@ -243,7 +243,7 @@ mkRhsClosure dflags bndr _cc _bi
> (StgApp selectee [{-no args-}]))])
> | the_fv == scrutinee -- Scrutinee is the only free variable
> && maybeToBool maybe_offset -- Selectee is a component of the tuple
> - && offset_into_int <= mAX_SPEC_SELECTEE_SIZE -- Offset is small enough
> + && offset_into_int <= mAX_SPEC_SELECTEE_SIZE dflags -- Offset is small enough
> = -- NOT TRUE: ASSERT(is_single_constructor)
> -- The simplifier may have statically determined that the single alternative
> -- is the only possible case and eliminated the others, even if there are
> @@ -272,7 +272,7 @@ mkRhsClosure dflags bndr _cc _bi
> | args `lengthIs` (arity-1)
> && all (isGcPtrRep . idPrimRep . stripNV) fvs
> && isUpdatable upd_flag
> - && arity <= mAX_SPEC_AP_SIZE
> + && arity <= mAX_SPEC_AP_SIZE dflags
> && not (dopt Opt_SccProfilingOn dflags)
> -- not when profiling: we don't want to
> -- lose information about this particular
> diff --git a/includes/HaskellConstants.hs b/includes/HaskellConstants.hs
> index 9abe717..f2a5b22 100644
> --- a/includes/HaskellConstants.hs
> +++ b/includes/HaskellConstants.hs
> @@ -34,13 +34,6 @@ mAX_CONTEXT_REDUCTION_DEPTH :: Int
> mAX_CONTEXT_REDUCTION_DEPTH = 200
> -- Increase to 200; see Trac #5395
>
> --- pre-compiled thunk types
> -mAX_SPEC_SELECTEE_SIZE :: Int
> -mAX_SPEC_SELECTEE_SIZE = MAX_SPEC_SELECTEE_SIZE
> -
> -mAX_SPEC_AP_SIZE :: Int
> -mAX_SPEC_AP_SIZE = MAX_SPEC_AP_SIZE
> -
> -- closure sizes: these do NOT include the header (see below for header sizes)
> mIN_PAYLOAD_SIZE ::Int
> mIN_PAYLOAD_SIZE = MIN_PAYLOAD_SIZE
> diff --git a/includes/mkDerivedConstants.c b/includes/mkDerivedConstants.c
> index 69c87f0..92024d3 100644
> --- a/includes/mkDerivedConstants.c
> +++ b/includes/mkDerivedConstants.c
> @@ -293,6 +293,26 @@ enum Mode { Gen_Haskell_Type, Gen_Haskell_Value, Gen_Haskell_Wrappers, Gen_Haske
>
> #define FUN_OFFSET(sym) (OFFSET(Capability,f.sym) - OFFSET(Capability,r))
>
> +void constantInt(char *name, intptr_t val) {
> + switch (mode) {
> + case Gen_Haskell_Type:
> + printf(" , pc_%s :: Int\n", name);
> + break;
> + case Gen_Haskell_Value:
> + printf(" , pc_%s = %" PRIdPTR "\n", name, val);
> + break;
> + case Gen_Haskell_Wrappers:
> + printf("%s :: DynFlags -> Int\n", name);
> + printf("%s dflags = pc_%s (sPlatformConstants (settings dflags))\n",
> + name, name);
> + break;
> + case Gen_Haskell_Exports:
> + printf(" %s,\n", name);
> + break;
> + case Gen_Header:
> + break;
> + }
> +}
>
> int
> main(int argc, char *argv[])
> @@ -602,6 +622,10 @@ main(int argc, char *argv[])
> }
> #endif
>
> + // pre-compiled thunk types
> + constantInt("mAX_SPEC_SELECTEE_SIZE", MAX_SPEC_SELECTEE_SIZE);
> + constantInt("mAX_SPEC_AP_SIZE", MAX_SPEC_AP_SIZE);
> +
> switch (mode) {
> case Gen_Haskell_Type:
> printf(" } deriving (Read, Show)\n");
>
>
>
> _______________________________________________
> Cvs-ghc mailing list
> Cvs-ghc at haskell.org
> http://www.haskell.org/mailman/listinfo/cvs-ghc
>
More information about the Cvs-ghc
mailing list