1. 10 Oct, 2003 2 commits
  2. 09 Oct, 2003 8 commits
    • stolz's avatar
      [project @ 2003-10-09 16:57:17 by stolz] · bb018f16
      stolz authored
      Hrmbl. []-wibble.
      bb018f16
    • simonpj's avatar
      [project @ 2003-10-09 15:38:22 by simonpj] · 0dfa678a
      simonpj authored
      Wibles
      0dfa678a
    • simonpj's avatar
      [project @ 2003-10-09 14:31:05 by simonpj] · f46d760f
      simonpj authored
      Forgot to remove HsCore (now IfaceSyn)
      f46d760f
    • stolz's avatar
      [project @ 2003-10-09 13:59:33 by stolz] · 6432be68
      stolz authored
      FreeBSD 4.X has an emtpy wctype.h, so test one of the affected
      functions in Unicode.hsc if it's really there.
      6432be68
    • simonpj's avatar
      [project @ 2003-10-09 13:17:09 by simonpj] · 055a40ad
      simonpj authored
      Enable crudePprType without DEBUG
      055a40ad
    • simonpj's avatar
      [project @ 2003-10-09 13:11:30 by simonpj] · 576650d4
      simonpj authored
      Oops; forgot to add this entire directory!
      576650d4
    • simonpj's avatar
      [project @ 2003-10-09 12:00:18 by simonpj] · 34a2e442
      simonpj authored
      Add these two files to the preceding mega-commit
      34a2e442
    • simonpj's avatar
      [project @ 2003-10-09 11:58:39 by simonpj] · 98688c6e
      simonpj authored
      -------------------------
      		GHC heart/lung transplant
      		-------------------------
      
      This major commit changes the way that GHC deals with importing
      types and functions defined in other modules, during renaming and
      typechecking.  On the way I've changed or cleaned up numerous other
      things, including many that I probably fail to mention here.
      
      Major benefit: GHC should suck in many fewer interface files when
      compiling (esp with -O).  (You can see this with -ddump-rn-stats.)
      
      It's also some 1500 lines of code shorter than before.
      
      **	So expect bugs!  I can do a 3-stage bootstrap, and run
      **	the test suite, but you may be doing stuff I havn't tested.
      ** 	Don't update if you are relying on a working HEAD.
      
      
      In particular, (a) External Core and (b) GHCi are very little tested.
      
      	But please, please DO test this version!
      
      
      	------------------------
      		Big things
      	------------------------
      
      Interface files, version control, and importing declarations
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      * There is a totally new data type for stuff that lives in interface files:
      	Original names			IfaceType.IfaceExtName
      	Types				IfaceType.IfaceType
      	Declarations (type,class,id)	IfaceSyn.IfaceDecl
      	Unfoldings			IfaceSyn.IfaceExpr
        (Previously we used HsSyn for type/class decls, and UfExpr for unfoldings.)
        The new data types are in iface/IfaceType and iface/IfaceSyn.  They are
        all instances of Binary, so they can be written into interface files.
        Previous engronkulation concering the binary instance of RdrName has
        gone away -- RdrName is not an instance of Binary any more.  Nor does
        Binary.lhs need to know about the ``current module'' which it used to,
        which made it specialised to GHC.
      
        A good feature of this is that the type checker for source code doesn't
        need to worry about the possibility that we might be typechecking interface
        file stuff.  Nor does it need to do renaming; we can typecheck direct from
        IfaceSyn, saving a whole pass (module TcIface)
      
      * Stuff from interface files is sucked in *lazily*, rather than being eagerly
        sucked in by the renamer. Instead, we use unsafeInterleaveIO to capture
        a thunk for the unfolding of an imported function (say).  If that unfolding
        is every pulled on, TcIface will scramble over the unfolding, which may
        in turn pull in the interface files of things mentioned in the unfolding.
      
        The External Package State is held in a mutable variable so that it
        can be side-effected by this lazy-sucking-in process (which may happen
        way later, e.g. when the simplifier runs).   In effect, the EPS is a kind
        of lazy memo table, filled in as we suck things in.  Or you could think
        of it as a global symbol table, populated on demand.
      
      * This lazy sucking is very cool, but it can lead to truly awful bugs. The
        intent is that updates to the symbol table happen atomically, but very bad
        things happen if you read the variable for the table, and then force a
        thunk which updates the table.  Updates can get lost that way. I regret
        this subtlety.
      
        One example of the way it showed up is that the top level of TidyPgm
        (which updates the global name cache) to be much more disciplined about
        those updates, since TidyPgm may itself force thunks which allocate new
        names.
      
      * Version numbering in interface files has changed completely, fixing
        one major bug with ghc --make.  Previously, the version of A.f changed
        only if A.f's type and unfolding was textually different.  That missed
        changes to things that A.f's unfolding mentions; which was fixed by
        eagerly sucking in all of those things, and listing them in the module's
        usage list.  But that didn't work with --make, because they might have
        been already sucked in.
      
        Now, A.f's version changes if anything reachable from A.f (via interface
        files) changes.  A module with unchanged source code needs recompiling
        only if the versions of any of its free variables changes. [This isn't
        quite right for dictionary functions and rules, which aren't mentioned
        explicitly in the source.  There are extensive comments in module MkIface,
        where all version-handling stuff is done.]
      
      * We don't need equality on HsDecls any more (because they aren't used in
        interface files).  Instead we have a specialised equality for IfaceSyn
        (eqIfDecl etc), which uses IfaceEq instead of Bool as its result type.
        See notes in IfaceSyn.
      
      * The horrid bit of the renamer that tried to predict what instance decls
        would be needed has gone entirely.  Instead, the type checker simply
        sucks in whatever instance decls it needs, when it needs them.  Easy!
      
        Similarly, no need for 'implicitModuleFVs' and 'implicitTemplateHaskellFVs'
        etc.  Hooray!
      
      
      Types and type checking
      ~~~~~~~~~~~~~~~~~~~~~~~
      * Kind-checking of types is far far tidier (new module TcHsTypes replaces
        the badly-named TcMonoType).  Strangely, this was one of my
        original goals, because the kind check for types is the Right Place to
        do type splicing, but it just didn't fit there before.
      
      * There's a new representation for newtypes in TypeRep.lhs.  Previously
        they were represented using "SourceTypes" which was a funny compromise.
        Now they have their own constructor in the Type datatype.  SourceType
        has turned back into PredType, which is what it used to be.
      
      * Instance decl overlap checking done lazily.  Consider
      	instance C Int b
      	instance C a Int
        These were rejected before as overlapping, because when seeking
        (C Int Int) one couldn't tell which to use.  But there's no problem when
        seeking (C Bool Int); it can only be the second.
      
        So instead of checking for overlap when adding a new instance declaration,
        we check for overlap when looking up an Inst.  If we find more than one
        matching instance, we see if any of the candidates dominates the others
        (in the sense of being a substitution instance of all the others);
        and only if not do we report an error.
      
      
      
      	------------------------
      	     Medium things
      	------------------------
      
      * The TcRn monad is generalised a bit further.  It's now based on utils/IOEnv.lhs,
        the IO monad with an environment.  The desugarer uses the monad too,
        so that anything it needs can get faulted in nicely.
      
      * Reduce the number of wired-in things; in particular Word and Integer
        are no longer wired in.  The latter required HsLit.HsInteger to get a
        Type argument.  The 'derivable type classes' data types (:+:, :*: etc)
        are not wired in any more either (see stuff about derivable type classes
        below).
      
      * The PersistentComilerState is now held in a mutable variable
        in the HscEnv.  Previously (a) it was passed to and then returned by
        many top-level functions, which was painful; (b) it was invariably
        accompanied by the HscEnv.  This change tidies up top-level plumbing
        without changing anything important.
      
      * Derivable type classes are treated much more like 'deriving' clauses.
        Previously, the Ids for the to/from functions lived inside the TyCon,
        but now the TyCon simply records their existence (with a simple boolean).
        Anyone who wants to use them must look them up in the environment.
      
        This in turn makes it easy to generate the to/from functions (done
        in types/Generics) using HsSyn (like TcGenDeriv for ordinary derivings)
        instead of CoreSyn, which in turn means that (a) we don't have to figure
        out all the type arguments etc; and (b) it'll be type-checked for us.
        Generally, the task of generating the code has become easier, which is
        good for Manuel, who wants to make it more sophisticated.
      
      * A Name now says what its "parent" is. For example, the parent of a data
        constructor is its type constructor; the parent of a class op is its
        class.  This relationship corresponds exactly to the Avail data type;
        there may be other places we can exploit it.  (I made the change so that
        version comparison in interface files would be a bit easier; but in
        fact it tided up other things here and there (see calls to
        Name.nameParent).  For example, the declaration pool, of declararations
        read from interface files, but not yet used, is now keyed only by the 'main'
        name of the declaration, not the subordinate names.
      
      * New types OccEnv and OccSet, with the usual operations.
        OccNames can be efficiently compared, because they have uniques, thanks
        to the hashing implementation of FastStrings.
      
      * The GlobalRdrEnv is now keyed by OccName rather than RdrName.  Not only
        does this halve the size of the env (because we don't need both qualified
        and unqualified versions in the env), but it's also more efficient because
        we can use a UniqFM instead of a FiniteMap.
      
        Consequential changes to Provenance, which has moved to RdrName.
      
      * External Core remains a bit of a hack, as it was before, done with a mixture
        of HsDecls (so that recursiveness and argument variance is still inferred),
        and IfaceExprs (for value declarations).  It's not thoroughly tested.
      
      
      	------------------------
      	     Minor things
      	------------------------
      
      * DataCon fields dcWorkId, dcWrapId combined into a single field
        dcIds, that is explicit about whether the data con is a newtype or not.
        MkId.mkDataConWorkId and mkDataConWrapId are similarly combined into
        MkId.mkDataConIds
      
      * Choosing the boxing strategy is done for *source* type decls only, and
        hence is now in TcTyDecls, not DataCon.
      
      * WiredIn names are distinguished by their n_sort field, not by their location,
        which was rather strange
      
      * Define Maybes.mapCatMaybes :: (a -> Maybe b) -> [a] -> [b]
        and use it here and there
      
      * Much better pretty-printing of interface files (--show-iface)
      
      Many, many other small things.
      
      
      	------------------------
      	     File changes
      	------------------------
      * New iface/ subdirectory
      * Much of RnEnv has moved to iface/IfaceEnv
      * MkIface and BinIface have moved from main/ to iface/
      * types/Variance has been absorbed into typecheck/TcTyDecls
      * RnHiFiles and RnIfaces have vanished entirely.  Their
        work is done by iface/LoadIface
      * hsSyn/HsCore has gone, replaced by iface/IfaceSyn
      * typecheck/TcIfaceSig has gone, replaced by iface/TcIface
      * typecheck/TcMonoType has been renamed to typecheck/TcHsType
      * basicTypes/Var.hi-boot and basicTypes/Generics.hi-boot have gone altogether
      98688c6e
  3. 08 Oct, 2003 2 commits
    • wolfgang's avatar
      [project @ 2003-10-08 10:37:25 by wolfgang] · 79c93a8a
      wolfgang authored
      Remove apostrophe from #error directive text, as gcc doesn't like that,
      even if the #error is ifdef'd out.
      
      All other C compilers I know claim that this is correct C :-(.
      
      merge to stable
      79c93a8a
    • wolfgang's avatar
      [project @ 2003-10-08 09:42:34 by wolfgang] · 2203c0ce
      wolfgang authored
      Mac OS X/PowerPC:
      Learn to cope with out-of-range relative jumps.
      
      PowerPC relative branch instructions have a 24 bit displacement field.
      As PPC code is always 4-byte-aligned, this yields a +-32MB range.
      If a particular imported symbol is outside this range, we have to redirect
      the jump to a short piece of new code that just loads the 32bit absolute
      address and jumps there.
      2203c0ce
  4. 05 Oct, 2003 2 commits
    • panne's avatar
      [project @ 2003-10-05 20:18:36 by panne] · 45ee5a69
      panne authored
      Unbreak the 2nd stage of non-threaded-RTS builds by #ifdefing out a
      call to wakeBlockedWorkerThread. This should probably fixed more
      cleanly by taking an OO view, i.e. always defining this function, but
      doing nothing in the non-threaded case. The final decision on this
      issue is left to the Masters of the Threads (tm)...
      45ee5a69
    • panne's avatar
      [project @ 2003-10-05 20:14:49 by panne] · 049481ee
      panne authored
      Merged Ross' patch for Hugs:
      
      Tweak to the FPTOOLS_HAVE_OPENGL: when testing for the GLUT lib,
      include the GL/GLU/GLX libs just discovered.  While most platforms
      don't require this, mysteriously some (e.g. OpenBSD) do.
      049481ee
  5. 03 Oct, 2003 1 commit
  6. 02 Oct, 2003 3 commits
  7. 01 Oct, 2003 7 commits
    • wolfgang's avatar
      [project @ 2003-10-01 21:16:12 by wolfgang] · a9190910
      wolfgang authored
      Un-break non-threaded RTS
      (hopefully; I have no time to test it right now)
      a9190910
    • sof's avatar
      [project @ 2003-10-01 17:01:28 by sof] · 61b596d6
      sof authored
      enableTimingStats():
        bring back -Rghc-timing output when compiled with >= 4.11
        (was >= 5.05, which looks unnecessarily restrictive.)
      61b596d6
    • sof's avatar
      [project @ 2003-10-01 16:45:10 by sof] · ca9945d0
      sof authored
      outCLine: Use "#line n <filename>", not "# n <filename>". The latter
                isn't ISO (and causes breakage when compiling output with
      	  MSVC.)
      ca9945d0
    • wolfgang's avatar
      [project @ 2003-10-01 10:57:39 by wolfgang] · d3581a6a
      wolfgang authored
      New implementation & changed type signature of forkProcess
      
      forkProcess now has the following type:
      forkProcess :: IO () -> IO ProcessID
      
      forkProcessAll has been removed as it is unimplementable in the threaded RTS.
      
      forkProcess using the old type (IO (Maybe ProcessID)) was impossible to
      implement correctly in the non-threaded RTS and very hard to implement
      in the threaded RTS.
      The new type signature allows a clean and simple implementation.
      d3581a6a
    • wolfgang's avatar
      [project @ 2003-10-01 10:49:07 by wolfgang] · 324e96d2
      wolfgang authored
      Threaded RTS:
      Don't start new worker threads earlier than necessary.
      After this commit, a Haskell program that uses neither forkOS nor forkIO is
      really single-threaded (rather than using two OS threads internally).
      
      Some details:
      Worker threads are now only created when a capability is released, and
      only when
      (there are no worker threads)
      	&& (there are runnable Haskell threads ||
      	    there are Haskell threads blocked on IO or threadDelay)
      awaitEvent can now be called from bound thread scheduling loops
      (so that we don't have to create a worker thread just to run awaitEvent)
      324e96d2
    • wolfgang's avatar
      [project @ 2003-10-01 10:36:49 by wolfgang] · aefc6956
      wolfgang authored
      Make sure that the sequence
      rts_lock();
      rts_unlock(); /* (with nothing in between) */
      doesn't crash the threaded RTS.
      aefc6956
    • simonmar's avatar
      [project @ 2003-10-01 09:08:10 by simonmar] · 75a2ab87
      simonmar authored
      rts_getBool: we should check the constructor tag instead of comparing
      directly against False_closure and True_closure, since we might be
      using the dynamically-linked versions of these.
      
      This may or may not be the cause of bug [ 792761 ] rts_getBool: not a
      Bool.
      75a2ab87
  8. 29 Sep, 2003 2 commits
  9. 28 Sep, 2003 1 commit
  10. 26 Sep, 2003 6 commits
  11. 25 Sep, 2003 2 commits
  12. 24 Sep, 2003 4 commits
    • simonmar's avatar
      [project @ 2003-09-24 13:20:03 by simonmar] · f0631554
      simonmar authored
      remove docs for -fwith option
      f0631554
    • simonmar's avatar
      [project @ 2003-09-24 13:04:45 by simonmar] · 38ef36af
      simonmar authored
      The concensus seems to be that 'with' should go away now, after its
      customary period of deprecation.  Hugs has already removed it, so
      we're following suit.
      38ef36af
    • simonmar's avatar
      [project @ 2003-09-24 11:06:51 by simonmar] · 8f57c3c1
      simonmar authored
      Move forkOS_createThread into the RTS so its implementation can be
      dependent on RTS_SUPPORTS_THREADS, which means we can provide a stub
      implementation in the !RTS_SUPPORTS_THREADS case, and hence not depend
      on pthread_create, which requires -lpthread.  The upshot is that GHCi
      now works again when !RTS_SUPPORTS_THREADS.
      8f57c3c1
    • simonmar's avatar
      [project @ 2003-09-24 10:32:11 by simonmar] · 8fb92f95
      simonmar authored
      If we change the terminal settings as a result of hSetBuffering or
      hSetEcho, then restore them again in hs_exit().  This is just good
      citizenship on Unixy platforms.
      
      We *don't* just automatically save the terminal settings and restore
      them at the end, because that would prevent implementing stty-like
      programs in Haskell.  This scheme is a compromise that hopefully DTRT
      in most cases.
      8fb92f95