1. 13 Mar, 2001 4 commits
    • simonpj's avatar
      [project @ 2001-03-13 14:58:25 by simonpj] · 788faebb
      simonpj authored
      	Nuke ClassContext
      This commit tidies up a long-standing inconsistency in GHC.
      The context of a class or instance decl used to be restricted
      to predicates of the form
      	C t1 .. tn
      	type ClassContext = [(Class,[Type])]
      but everywhere else in the compiler we used
      	type ThetaType = [PredType]
      where PredType can be any sort of constraint (= predicate).
      The inconsistency actually led to a crash, when compiling
      	class (?x::Int) => C a where {}
      I've tidied all this up by nuking ClassContext altogether, and using
      PredType throughout.  Lots of modified files, but all in
      more-or-less trivial ways.
      I've also added a check that the context of a class or instance
      decl doesn't include a non-inheritable predicate like (?x::Int).
      Other things
       * rename constructor 'Class' from type TypeRep.Pred to 'ClassP'
         (makes it easier to grep for)
       * rename constructor HsPClass  => HsClassP
      		      HsPIParam => HsIParam
    • simonmar's avatar
      [project @ 2001-03-13 14:18:47 by simonmar] · 6a44ce76
      simonmar authored
      re-instate an ASSERT that was temporarily commented out.
    • simonmar's avatar
      [project @ 2001-03-13 14:17:16 by simonmar] · 17e8f5c2
      simonmar authored
      Fix let-no-escapes again.
    • simonmar's avatar
      [project @ 2001-03-13 12:50:29 by simonmar] · 10cbc75d
      simonmar authored
      Some rearrangements that Simon & I have been working on recently:
          - CoreSat is now CorePrep, and is a general "prepare-for-code-
            generation" pass.  It does cloning, saturation of constructors &
            primops, A-normal form, and a couple of other minor fiddlings.
          - CoreTidy no longer does cloning, and minor fiddlings.  It doesn't
            need the unique supply any more, so that's removed.
          - CoreToStg now collects CafInfo and the list of CafRefs for each
            binding.  The SRT pass is much simpler now.
          - IdInfo now has a CgInfo field for "code generator info".  It currently
            contains arity (the actual code gen arity which affects the calling
            convention as opposed to the ArityInfo which is a measure of how
            many arguments the Id can be applied to before it does any work), and
            Previously we overloaded the ArityInfo field to contain both
            codegen arity and simplifier arity.  Things are cleaner now.
          - CgInfo is collected by CoreToStg, and passed back into CoreTidy in
            a loop.  The compiler will complain rather than going into a black
            hole if the CgInfo is pulled on too early.
          - Worker info in an interface file now comes with arity info attached.
            Previously the main arity info was overloaded for this purpose, but
            it lead to a few hacks in the compiler, this tidies things up somewhat.
      Bottom line: we removed several fragilities, and tidied up a number of
      things.  Code size should be smaller, but we'll see...
  2. 12 Mar, 2001 4 commits
  3. 09 Mar, 2001 1 commit
  4. 08 Mar, 2001 9 commits
    • qrczak's avatar
      [project @ 2001-03-08 18:05:31 by qrczak] · 0171137c
      qrczak authored
      s/setIdGlobalDetails/sedGlobalIdDetails/, and import it.
    • qrczak's avatar
      [project @ 2001-03-08 18:03:34 by qrczak] · 69eaf10e
      qrczak authored
      Fix names imported from Id.
    • simonmar's avatar
      [project @ 2001-03-08 13:42:17 by simonmar] · fb82a168
      simonmar authored
      add expected output
    • simonmar's avatar
      [project @ 2001-03-08 13:41:31 by simonmar] · 57f63882
      simonmar authored
      update for blocking putMVar
    • simonpj's avatar
      [project @ 2001-03-08 13:33:23 by simonpj] · f0b635a2
      simonpj authored
      Add NameEnv!
    • simonpj's avatar
      [project @ 2001-03-08 12:07:38 by simonpj] · 51a571c0
      simonpj authored
      	A major hygiene pass
      1. The main change here is to
      	Move what was the "IdFlavour" out of IdInfo,
      	and into the varDetails field of a Var
         It was a mess before, because the flavour was a permanent attribute
         of an Id, whereas the rest of the IdInfo was ephemeral.  It's
         all much tidier now.
         Main places to look:
      	   Var.lhs	Defn of VarDetails
      	   IdInfo.lhs	Defn of GlobalIdDetails
         The main remaining infelicity is that SpecPragmaIds are right down
         in Var.lhs, which seems unduly built-in for such an ephemeral thing.
         But that is no worse than before.
      2. Tidy up the HscMain story a little.  Move mkModDetails from MkIface
         into CoreTidy (where it belongs more nicely)
         This was partly forced by (1) above, because I didn't want to make
         DictFun Ids into a separate kind of Id (which is how it was before).
         Not having them separate means we have to keep a list of them right
         through, rather than pull them out of the bindings at the end.
      3. Add NameEnv as a separate module (to join NameSet).
      4. Remove unnecessary {-# SOURCE #-} imports from FieldLabel.
    • simonpj's avatar
      [project @ 2001-03-08 11:59:02 by simonpj] · d78151f6
      simonpj authored
      	Remove function coercions
          (coerce (T1->T2) (S1->S2) F) E
          coerce T2 S2 (F (coerce S1 T1 E))
      This is a generally good transformation, but it
      still doesn't solve the problem I was after.  Consider
        newtype T = MkT (Int -> Int)
        p :: T->T;   p = ...
        q :: T;      q = ...
        foo :: T
        {-# INLINE foo #-}
        foo = p $ q
        f = \y -> ...((coerce (Int->Int) foo) 3)...
      Trouble is, foo doesn't see the argument because of the coerce, so it
      thinks it's a lone variable and doesn't inline.
      Another problem is that since $ ins't inlined into foo's RHS, foo
      looks like a redex, which we are reluctant to inline inside a lambda,
      even with an INLINE pragma.  Maybe we should be bolder?
      Anyway, this commit is an improvement to Simplify, but the story is not
    • simonmar's avatar
      [project @ 2001-03-08 11:44:16 by simonmar] · 41d0a61d
      simonmar authored
      remove cyclic dependency
    • simonmar's avatar
      [project @ 2001-03-08 09:50:18 by simonmar] · 68de0081
      simonmar authored
      rearrange slightly to make this compile again.
  5. 07 Mar, 2001 5 commits
  6. 06 Mar, 2001 6 commits
  7. 05 Mar, 2001 11 commits
    • simonpj's avatar
      [project @ 2001-03-05 15:37:25 by simonpj] · c8276ef7
      simonpj authored
      Exploit the 1-shot lambda HACK in etaExpandArity
      We often find code like
      	f :: Int -> IO ()
      	f = \ x -> case ... of
      			p1 -> \s -> ...rhs1...
      			p2 -> \s -> ...rhs2...
      where the \s is a state transformer lambda.  Almost invariably
      these \s things are one-shot; that is, we virtually never say
      	   h = f 3
      	h >> h >> h
      In this case we'd be much better off eta-expanding f, to
      	f :: Int -> IO ()
      	f = \ x \ s -> case ... of
      			   p1 -> ...rhs1...
      			   p2 -> ...rhs2...
      GHC already has a MAJOR HACK in
      which declares that any \s::State# T is a one-shot lambda.  It's
      almost always true, and it makes a big difference.
      This commit simply makes use of isOneShotLambda to improve the
      results of CoreUtils.etaExpandArity.  Which has the desired effect.
      There isn't a flag to control the MAJOR HACK yet.  Maybe there should be.
      Anyway, some of Manuel's array code should improve a lot.
    • simonpj's avatar
      [project @ 2001-03-05 12:46:16 by simonpj] · 757f1ebd
      simonpj authored
      Print debug uniques consistently in base64
    • simonpj's avatar
      [project @ 2001-03-05 12:45:45 by simonpj] · e6dff21d
      simonpj authored
      Improve SpecConstr
      This commit fixes SpecConstr so that it can see the effect of
      enclosing case expressions properly.  That's what the "cons" field
      in ScEnv is for.
      As a result, consider this function:
        data AccessPath = Cont  AccessPath
      		  | Value Int
        demandAll n ap@(Cont (Value (I# i1)))
          = case n of
      	0     -> i1
      	other -> i1 +# demandAll (n-1) ap
      SpecConstr now successfully compiles it to this:
          = \ i1 :: PrelGHC.Int# sc :: PrelGHC.Int# ->
            case sc of ds {
      	0 -> i1;
      	__DEFAULT -> PrelGHC.+# i1 (Foo.$s$wdemandAll i1 (PrelGHC.-# ds 1))
      with the rule
       "SC:$wdemandAll1" __forall i1 :: PrelGHC.Int# ,
      			    sc :: PrelGHC.Int# .
      	Foo.$wdemandAll sc (Foo.$wCont (Foo.$wValue (PrelBase.$wI# i1)))
      	= Foo.$s$wdemandAll i1 sc ;
    • simonpj's avatar
      [project @ 2001-03-05 12:19:37 by simonpj] · b5cad075
      simonpj authored
      Better dump of transformation rules
    • simonpj's avatar
      [project @ 2001-03-05 12:18:43 by simonpj] · ee7e91f5
      simonpj authored
      Remove debug trace
    • simonpj's avatar
      [project @ 2001-03-05 12:18:21 by simonpj] · d14c46d3
      simonpj authored
      Make error message more helpful
    • simonpj's avatar
      [project @ 2001-03-05 12:18:05 by simonpj] · e71eb9f0
      simonpj authored
      Remove dead isSysOcc
    • simonpj's avatar
      [project @ 2001-03-05 10:34:44 by simonpj] · baf7143a
      simonpj authored
      Add a test that Hugs-Feb-2001 fails
    • simonmar's avatar
      [project @ 2001-03-05 10:29:00 by simonmar] · 66331490
      simonmar authored
      remove cruft
    • simonmar's avatar
      [project @ 2001-03-05 10:06:27 by simonmar] · 9c59d745
      simonmar authored
      small rearrangement
    • simonmar's avatar
      [project @ 2001-03-05 10:05:58 by simonmar] · b671b141
      simonmar authored
      fix -fgenerics