1. 06 Dec, 2001 6 commits
  2. 05 Dec, 2001 11 commits
    • sof's avatar
      [project @ 2001-12-05 19:24:53 by sof] · a5b2186d
      sof authored
      oops, changes not tested with a stage2 build
      a5b2186d
    • sewardj's avatar
      [project @ 2001-12-05 17:35:12 by sewardj] · d11e681f
      sewardj authored
      --------------------------------------------
              Translate out PrimOps at the AbstractC level
              --------------------------------------------
      
      This is the first in what might be a series of changes intended
      to make GHC less dependent on its C back end.  The main change is
      to translate PrimOps into vanilla abstract C inside the compiler,
      rather than having to duplicate that work in each code generation
      route.  The main changes are:
      
      * A new type, MachOp, in compiler/absCSyn/MachOp.hs.  A MachOp
        is a primitive operation which we can reasonably expect the
        native code generators to implement.  The set is quite small
        and unlikely to change much, if at all.
      
      * Translations from PrimOps to MachOps, at the end of
        absCSyn/AbsCUtils.  This should perhaps be moved to a different
        module, but it is hard to see how to do this without creating
        a circular dep between it and AbsCUtils.
      
      * The x86 insn selector has been updated to track these changes.  The
        sparc insn selector remains to be done.
      
      As a result of this, it is possible to compile much more code via the
      NCG than before.  Almost all the Prelude can be compiled with it.
      Currently it does not know how to do 64-bit code generation.  Once
      this is fixed, the entire Prelude should be compilable that way.
      
      I also took the opportunity to clean up the NCG infrastructure.
      The old Stix data type has been split into StixStmt (statements)
      and StixExpr (now denoting values only).  This removes a class
      of impossible constructions and clarifies the NCG.
      
      Still to do, in no particular order:
      
      * String and literal lifting, currently done in the NCG at the top
        of nativeGen/MachCode, should be done in the AbstractC flattener,
        for the benefit of all targets.
      
      * Further cleaning up of Stix assignments.
      
      * Remove word-size dependency from Abstract C.  (should be easy).
      
      * Translate out MagicIds in the AbsC -> Stix translation, not
        in the Stix constant folder. (!)
      
      Testsuite failures caused by this:
      
      * memo001 - fails (segfaults) for some unknown reason now.
      * arith003 - wrong answer in gcdInt boundary cases.
      * arith011 - wrong answer for shifts >= word size.
      * cg044 - wrong answer for some FP boundary cases.
      
      These should be fixed, but I don't think they are mission-critical for
      anyone.
      d11e681f
    • simonmar's avatar
      [project @ 2001-12-05 17:21:43 by simonmar] · c967a54e
      simonmar authored
      Add -s flag to Happy if we have version 1.12+
      c967a54e
    • sof's avatar
      [project @ 2001-12-05 16:29:54 by sof] · 20baa4d6
      sof authored
      make it compile - i.e., use Subst.simplIdInfo in a manner
      consistent with the repo contents. (wouldn't surprise me
      if there's coreSyn/Subst.lhs change that hasn't been
      committed yet...)
      20baa4d6
    • simonpj's avatar
      [project @ 2001-12-05 15:00:21 by simonpj] · b6fc6104
      simonpj authored
      Preserve IdInfo for strict binders
      b6fc6104
    • simonmar's avatar
      [project @ 2001-12-05 13:52:19 by simonmar] · 966c5772
      simonmar authored
      Make some record selections strict to reduce space leaks.
      966c5772
    • simonmar's avatar
      [project @ 2001-12-05 12:20:39 by simonmar] · 2e1d8119
      simonmar authored
      unbreak inputReady().
      2e1d8119
    • simonmar's avatar
      [project @ 2001-12-05 11:05:21 by simonmar] · 9e94a1af
      simonmar authored
      Add seqDemand, seqDemands, seqDmdType and seqStrictSig.
      9e94a1af
    • simonmar's avatar
      [project @ 2001-12-05 11:00:24 by simonmar] · d0d6d186
      simonmar authored
      - fix a space leak in the cg_env passed back from the code generator
        to CoreTidy that was keeping the result of CoreToStg alive through
        code generation.
      
      - some cost centre changes
      d0d6d186
    • sof's avatar
      [project @ 2001-12-05 00:08:26 by sof] · 099c2716
      sof authored
      - new option, -keep-ilx-file, for stashing away ILX input.
      - restrict ILX-specific code/defs to only be visible iff ILX is #defined.
      099c2716
    • sof's avatar
      [project @ 2001-12-05 00:06:32 by sof] · 6e5735b5
      sof authored
      reuse Panic.showGhcException
      6e5735b5
  3. 04 Dec, 2001 8 commits
  4. 03 Dec, 2001 6 commits
    • sof's avatar
      [project @ 2001-12-03 22:44:48 by sof] · 00f221ce
      sof authored
      Use the message queue friendly MsgWaitForMultipleObjects()
      00f221ce
    • sof's avatar
      [project @ 2001-12-03 20:59:08 by sof] · 1948094b
      sof authored
      Support IO.hWaitForInput on Win32 platforms (on file and socket handles).
      1948094b
    • sebc's avatar
      [project @ 2001-12-03 14:49:24 by sebc] · d765456f
      sebc authored
      On MacOS X, disable Apple's "smart" cpp
      d765456f
    • simonmar's avatar
      [project @ 2001-12-03 14:34:45 by simonmar] · f4306488
      simonmar authored
      Set the default heap profiling interval to something more sensible
      (100ms).
      f4306488
    • simonpj's avatar
      [project @ 2001-12-03 11:45:32 by simonpj] · 3178cb8b
      simonpj authored
      Dont fall over on data T deriving(Show)
      3178cb8b
    • simonpj's avatar
      [project @ 2001-12-03 11:36:26 by simonpj] · 525aeb93
      simonpj authored
      ------------------------------------
      	Fix a tiresome and longstanding bug
      	in typechecking of unlifted bindings
      	------------------------------------
      
      Consider
      
      	data T = MkT Int# Int#
      
      	f :: T -> Int#
      	f t = a +# b
      	    where
      	      MkT a b = if ... then t else t
      
      This should really be OK, but if the "..." includes
      some constraints, the constraint simplifier was trying to
      generate some d1=d2 bindings. This is Bad because the desugarer
      treats unlifted bindings very specially (they are strict).
      
      This commit fixes the problem, by ensuring we never get
      local dictionary binding for an unlifted group.
      
      This fixes the bug which has been making the Alpha port fall
      over with a pattern-match failure in DsExpr.  Nothing to do
      with Alpha; it's just that the word-size change gave rise
      to a little more commoning-up of literals in the type checker
      which in turn made the desugarer it fall over.
      525aeb93
  5. 02 Dec, 2001 1 commit
    • panne's avatar
      [project @ 2001-12-02 15:47:08 by panne] · d1255b8f
      panne authored
      Hmmm, we probably should install HsStd.h, too. PackageSrc.hs mentions
      it, and "make boot" in ghc/utils/hsc2hs fails without it. Perhaps this
      should be fixed differently, but I can't figure out how to do this
      correctly...
      d1255b8f
  6. 30 Nov, 2001 3 commits
  7. 29 Nov, 2001 3 commits
    • simonmar's avatar
      [project @ 2001-11-29 16:38:13 by simonmar] · b560e2a5
      simonmar authored
      Fix for heap profiling when selecting by lag/drag/void/use: I forgot
      to make the final LdvCensusKillAll() call just before outputing the
      census info.
      
      Having tested this stuff on the compiler itself, I now declare it to
      be working (famous last words!).
      b560e2a5
    • simonpj's avatar
      [project @ 2001-11-29 13:47:09 by simonpj] · 32a89583
      simonpj authored
      ------------------------------
      	Add linear implicit parameters
      	------------------------------
      
      Linear implicit parameters are an idea developed by Koen Claessen,
      Mark Shields, and Simon PJ, last week.  They address the long-standing
      problem that monads seem over-kill for certain sorts of problem, notably:
      
      	* distributing a supply of unique names
      	* distributing a suppply of random numbers
      	* distributing an oracle (as in QuickCheck)
      
      
      Linear implicit parameters are just like ordinary implicit parameters,
      except that they are "linear" -- that is, they cannot be copied, and
      must be explicitly "split" instead.  Linear implicit parameters are
      written '%x' instead of '?x'.  (The '/' in the '%' suggests the
      split!)
      
      For example:
      
          data NameSupply = ...
      
          splitNS :: NameSupply -> (NameSupply, NameSupply)
          newName :: NameSupply -> Name
      
          instance PrelSplit.Splittable NameSupply where
      	split = splitNS
      
      
          f :: (%ns :: NameSupply) => Env -> Expr -> Expr
          f env (Lam x e) = Lam x' (f env e)
      		    where
      		      x'   = newName %ns
      		      env' = extend env x x'
          ...more equations for f...
      
      Notice that the implicit parameter %ns is consumed
      	once by the call to newName
      	once by the recursive call to f
      
      So the translation done by the type checker makes
      the parameter explicit:
      
          f :: NameSupply -> Env -> Expr -> Expr
          f ns env (Lam x e) = Lam x' (f ns1 env e)
      		       where
      	 		 (ns1,ns2) = splitNS ns
      			 x' = newName ns2
      			 env = extend env x x'
      
      Notice the call to 'split' introduced by the type checker.
      How did it know to use 'splitNS'?  Because what it really did
      was to introduce a call to the overloaded function 'split',
      ndefined by
      
      	class Splittable a where
      	  split :: a -> (a,a)
      
      The instance for Splittable NameSupply tells GHC how to implement
      split for name supplies.  But we can simply write
      
      	g x = (x, %ns, %ns)
      
      and GHC will infer
      
      	g :: (Splittable a, %ns :: a) => b -> (b,a,a)
      
      The Splittable class is built into GHC.  It's defined in PrelSplit,
      and exported by GlaExts.
      
      Other points:
      
      * '?x' and '%x' are entirely distinct implicit parameters: you
        can use them together and they won't intefere with each other.
      
      * You can bind linear implicit parameters in 'with' clauses.
      
      * You cannot have implicit parameters (whether linear or not)
        in the context of a class or instance declaration.
      
      
      Warnings
      ~~~~~~~~
      The monomorphism restriction is even more important than usual.
      Consider the example above:
      
          f :: (%ns :: NameSupply) => Env -> Expr -> Expr
          f env (Lam x e) = Lam x' (f env e)
      		    where
      		      x'   = newName %ns
      		      env' = extend env x x'
      
      If we replaced the two occurrences of x' by (newName %ns), which is
      usually a harmless thing to do, we get:
      
          f :: (%ns :: NameSupply) => Env -> Expr -> Expr
          f env (Lam x e) = Lam (newName %ns) (f env e)
      		    where
      		      env' = extend env x (newName %ns)
      
      But now the name supply is consumed in *three* places
      (the two calls to newName,and the recursive call to f), so
      the result is utterly different.  Urk!  We don't even have
      the beta rule.
      
      Well, this is an experimental change.  With implicit
      parameters we have already lost beta reduction anyway, and
      (as John Launchbury puts it) we can't sensibly reason about
      Haskell programs without knowing their typing.
      
      Of course, none of this is throughly tested, either.
      32a89583
    • simonpj's avatar
      [project @ 2001-11-29 12:20:08 by simonpj] · 0fe14834
      simonpj authored
      Wibble in TcPat; fixes the stage2 build problem in AsmCodeGen
      0fe14834
  8. 28 Nov, 2001 2 commits