1. 31 Jan, 2005 2 commits
    • simonpj's avatar
      [project @ 2005-01-31 16:59:37 by simonpj] · b2446845
      simonpj authored
      Tidy up stop-phase passing; fix bug in -o handling for ghc -E X.hs -o X.pp
      b2446845
    • wolfgang's avatar
      [project @ 2005-01-31 05:27:14 by wolfgang] · c560ae86
      wolfgang authored
      Reorganise handling of -fPIC flags passed to C compiler.
      The flags expected by gcc differ only slightly per platform
      (basically depending whether you are on a Mac or not), we don't need
      separate cases for every processor.
      
      TODO: Display an error message for platforms where -fPIC -fvia-C is not
            supported.
      c560ae86
  2. 28 Jan, 2005 2 commits
    • ross's avatar
      [project @ 2005-01-28 18:50:25 by ross] · 5500fa8f
      ross authored
      add missing underscores
      5500fa8f
    • simonmar's avatar
      [project @ 2005-01-28 12:55:17 by simonmar] · 153b9cb9
      simonmar authored
      Rationalise the BUILD,HOST,TARGET defines.
      
      Recall that:
      
        - build is the platform we're building on
        - host is the platform we're running on
        - target is the platform we're generating code for
      
      The change is that now we take these definitions as applying from the
      point of view of the particular source code being built, rather than
      the point of view of the whole build tree.
      
      For example, in RTS and library code, we were previously testing the
      TARGET platform.  But under the new rule, the platform on which this
      code is going to run is the HOST platform.  TARGET only makes sense in
      the compiler sources.
      
      In practical terms, this means that the values of BUILD, HOST & TARGET
      may vary depending on which part of the build tree we are in.
      
      Actual changes:
      
       - new file: includes/ghcplatform.h contains platform defines for
         the RTS and library code.
      
       - new file: includes/ghcautoconf.h contains the autoconf settings
         only (HAVE_BLAH).  This is so that we can get hold of these
         settings independently of the platform defines when necessary
         (eg. in GHC).
      
       - ghcconfig.h now #includes both ghcplatform.h and ghcautoconf.h.
      
       - MachRegs.h, which is included into both the compiler and the RTS,
         now has to cope with the fact that it might need to test either
         _TARGET_ or _HOST_ depending on the context.
      
       - the compiler's Makefile now generates
           stage{1,2,3}/ghc_boot_platform.h
         which contains platform defines for the compiler.  These differ
         depending on the stage, of course: in stage2, the HOST is the
         TARGET of stage1.  This was wrong before.
      
       - The compiler doesn't get platform info from Config.hs any more.
         Previously it did (sometimes), but unless we want to generate
         a new Config.hs for each stage we can't do this.
      
       - GHC now helpfully defines *_{BUILD,HOST}_{OS,ARCH} automatically
         in CPP'd Haskell source.
      
       - ghcplatform.h defines *_TARGET_* for backwards compatibility
         (ghcplatform.h is included by ghcconfig.h, which is included by
         config.h, so code which still #includes config.h will get the TARGET
         settings as before).
      
       - The Users's Guide is updated to mention *_HOST_* rather than
         *_TARGET_*.
      
       - coding-style.html in the commentary now contains a section on
         platform defines.  There are further doc updates to come.
      
      Thanks to Wolfgang Thaller for pointing me in the right direction.
      153b9cb9
  3. 27 Jan, 2005 2 commits
    • simonpj's avatar
      [project @ 2005-01-27 15:55:38 by simonpj] · b5dbb387
      simonpj authored
      Make -no-recomp a dynamic flag
      b5dbb387
    • simonpj's avatar
      [project @ 2005-01-27 10:44:00 by simonpj] · 508a505e
      simonpj authored
      --------------------------------------------
                Replace hi-boot files with hs-boot files
        	--------------------------------------------
      
      This major commit completely re-organises the way that recursive modules
      are dealt with.
      
        * It should have NO EFFECT if you do not use recursive modules
      
        * It is a BREAKING CHANGE if you do
      
      ====== Warning: .hi-file format has changed, so if you are
      ======		updating into an existing HEAD build, you'll
      ======		need to make clean and re-make
      
      
      The details:  [documentation still to be done]
      
      * Recursive loops are now broken with Foo.hs-boot (or Foo.lhs-boot),
        not Foo.hi-boot
      
      * An hs-boot files is a proper source file.  It is compiled just like
        a regular Haskell source file:
      	ghc Foo.hs		generates Foo.hi, Foo.o
      	ghc Foo.hs-boot		generates Foo.hi-boot, Foo.o-boot
      
      * hs-boot files are precisely a subset of Haskell. In particular:
      	- they have the same import, export, and scoping rules
      	- errors (such as kind errors) in hs-boot files are checked
        You do *not* need to mention the "original" name of something in
        an hs-boot file, any more than you do in any other Haskell module.
      
      * The Foo.hi-boot file generated by compiling Foo.hs-boot is a machine-
        generated interface file, in precisely the same format as Foo.hi
      
      * When compiling Foo.hs, its exports are checked for compatibility with
        Foo.hi-boot (previously generated by compiling Foo.hs-boot)
      
      * The dependency analyser (ghc -M) knows about Foo.hs-boot files, and
        generates appropriate dependencies.  For regular source files it
        generates
      	Foo.o : Foo.hs
      	Foo.o : Baz.hi		-- Foo.hs imports Baz
      	Foo.o : Bog.hi-boot	-- Foo.hs source-imports Bog
      
        For a hs-boot file it generates similar dependencies
      	Bog.o-boot : Bog.hs-boot
      	Bog.o-boot : Nib.hi	-- Bog.hs-boto imports Nib
      
      * ghc -M is also enhanced to use the compilation manager dependency
        chasing, so that
      	ghc -M Main
        will usually do the job.  No need to enumerate all the source files.
      
      * The -c flag is no longer a "compiler mode". It simply means "omit the
        link step", and synonymous with -no-link.
      508a505e
  4. 18 Jan, 2005 1 commit
    • simonpj's avatar
      [project @ 2005-01-18 12:18:11 by simonpj] · ac80e0de
      simonpj authored
      ------------------------
          Reorganisation of hi-boot files
        	------------------------
      
      The main point of this commit is to arrange that in the Compilation
      Manager's dependendency graph, hi-boot files are proper nodes. This
      is important to make sure that we compile everything in the right
      order.  It's a step towards hs-boot files.
      
      * The fundamental change is that CompManager.ModSummary has a new
        field, ms_boot :: IsBootInterface
      
        I also tided up CompManager a bit.  No change to the Basic Plan.
      
        ModSummary is now exported abstractly from CompManager (was concrete)
      
      * Hi-boot files now have import declarations.  The idea is they are
        compulsory, so that the dependency analyser can find them
      
      * I changed an invariant: the Compilation Manager used to ensure that
        hscMain was given a HomePackageTable only for the modules 'below' the
        one being compiled.  This was really only important for instances and
        rules, and it was a bit inconvenient.  So I moved the filter to the
        compiler itself: see HscTypes.hptInstances and hptRules.
      
      * Module Packages.hs now defines
          data PackageIdH
          = HomePackage 		-- The "home" package is the package
       				-- curently being compiled
          | ExtPackage PackageId	-- An "external" package is any other package
      
         It was just a Maybe type before, so this makes it a bit clearer.
      
      * I tried to add a bit better location info to the IfM monad, so that
        errors in interfaces come with a slightly more helpful error message.
        See the if_loc field in TcRnTypes --- and follow-on consequences
      
      * Changed Either to Maybes.MaybeErr in a couple of places (more perspicuous)
      ac80e0de
  5. 14 Jan, 2005 2 commits
    • simonmar's avatar
      [project @ 2005-01-14 17:57:41 by simonmar] · c464eda3
      simonmar authored
      HEADS UP!  You now need to use an up to date Happy from CVS to build
      GHC.  Happy version 1.15 will be released shortly.
      
      Replace the slow hacked up String-based GetImports with one based on
      the real Haskell parser.  This requires a new addition to Happy to
      support parsing partial files.  We now avoid reading each source file
      off the disk twice: once to get its module name and imports, and again
      to parse it.  Instead we just slurp it once, and cache the StringBuffer.
      
      This should result in improved startup times for ghc --make,
      especially when there are lots of source files.
      c464eda3
    • wolfgang's avatar
      [project @ 2005-01-14 08:01:26 by wolfgang] · 4f457f34
      wolfgang authored
      Dynamic Linking, Part 2:
      
      Hack the Makefiles to build dynamic libraries.
      This allows you to actually use dynamic libraries to greatly reduce binary
      sizes on Darwin/PowerPC and on powerpc64-linux (for now).
      
      To use this, add the following to your build.mk
      
      SplitObjs=NO
      GhcBuildDylibs=YES
      GhcStage2HcOpts=-dynamic
      GhcLibHcOpts+=-fPIC -dynamic
      GhcRtsHcOpts+=-fPIC -dynamic
      GHC_CC_OPTS+=-fPIC
      
      (You can leave out the last three lines on powerpc64-linux).
      
      Then, to compile a program using dynamic libraries, pass the -dynamic option to GHC.
      To make GHCi use the dynamic libraries instead of .o files, just delete the HS*.o files.
      
      The dynamic library files are named libHSfoo_dyn.dylib or libHSfoo_dyn.so.
      
      Note that the dynamic and static libraries are build from the same .o files,
      but we really want to build the static libraries with SplitObjs and without
      -fPIC -dynamic to achieve better code size and performance.
      
      ghc/compiler/ghci/Linker.lhs:
          When looking for a library, look for HSfoo.o first (as before),
          then look for libHSfoo_dyn.[so/dylib] before looking for
          libHSfoo.[so/dylib].
      
      ghc/compiler/main/DriverPipeline.hs:
          Main.dll_o and PrelMain.dll_o are dead, at least for now.
      
      ghc/compiler/main/Packages.lhs:
          When -dynamic is specified, add "_dyn" to all libraries specified in
          hs-libraries (not to the extra-libs).
      
      ghc/lib/compat/Makefile:
          Never build libghccompat as a dynamic lib.
      
      mk/package.mk:
          if GhcBuildDylibs is set to YES, build dynamic libraries.
      
      mk/target.mk:
          When installing .dylibs (Darwin only), update the install_name to point
          to the final location.
          (Somebody please read Apple's documentation on what install_names are,
          and then comment on whether this is a useful feature or whether it should
          be done the "normal" unix way).
      4f457f34
  6. 26 Nov, 2004 1 commit
    • simonmar's avatar
      [project @ 2004-11-26 16:19:45 by simonmar] · ef5b4b14
      simonmar authored
      Further integration with the new package story.  GHC now supports
      pretty much everything in the package proposal.
      
        - GHC now works in terms of PackageIds (<pkg>-<version>) rather than
          just package names.  You can still specify package names without
          versions on the command line, as long as the name is unambiguous.
      
        - GHC understands hidden/exposed modules in a package, and will refuse
          to import a hidden module.  Also, the hidden/eposed status of packages
          is taken into account.
      
        - I had to remove the old package syntax from ghc-pkg, backwards
          compatibility isn't really practical.
      
        - All the package.conf.in files have been rewritten in the new syntax,
          and contain a complete list of modules in the package.  I've set all
          the versions to 1.0 for now - please check your package(s) and fix the
          version number & other info appropriately.
      
        - New options:
      
      	-hide-package P    sets the expose flag on package P to False
      	-ignore-package P  unregisters P for this compilation
      
      	For comparison, -package P sets the expose flag on package P
              to True, and also causes P to be linked in eagerly.
      
              -package-name is no longer officially supported.  Unofficially, it's
      	a synonym for -ignore-package, which has more or less the same effect
      	as -package-name used to.
      
      	Note that a package may be hidden and yet still be linked into
      	the program, by virtue of being a dependency of some other package.
      	To completely remove a package from the compiler's internal database,
              use -ignore-package.
      
      	The compiler will complain if any two packages in the
              transitive closure of exposed packages contain the same
              module.
      
      	You *must* use -ignore-package P when compiling modules for
              package P, if package P (or an older version of P) is already
              registered.  The compiler will helpfully complain if you don't.
      	The fptools build system does this.
      
         - Note: the Cabal library won't work yet.  It still thinks GHC uses
           the old package config syntax.
      
      Internal changes/cleanups:
      
         - The ModuleName type has gone away.  Modules are now just (a
           newtype of) FastStrings, and don't contain any package information.
           All the package-related knowledge is in DynFlags, which is passed
           down to where it is needed.
      
         - DynFlags manipulation has been cleaned up somewhat: there are no
           global variables holding DynFlags any more, instead the DynFlags
           are passed around properly.
      
         - There are a few less global variables in GHC.  Lots more are
           scheduled for removal.
      
         - -i is now a dynamic flag, as are all the package-related flags (but
           using them in {-# OPTIONS #-} is Officially Not Recommended).
      
         - make -j now appears to work under fptools/libraries/.  Probably
           wouldn't take much to get it working for a whole build.
      ef5b4b14
  7. 11 Nov, 2004 1 commit
  8. 20 Oct, 2004 1 commit
    • simonmar's avatar
      [project @ 2004-10-20 14:25:34 by simonmar] · 57c61612
      simonmar authored
      compile: temporarily add the directory containing the .hs file to the
      include path.  This matches what compiling in one-shot mode does, and
      fixes a bug whereby the _stub.h file couldn't be found when compiling
      with --make.
      57c61612
  9. 03 Oct, 2004 1 commit
    • panne's avatar
      [project @ 2004-10-03 16:28:02 by panne] · b89ad0e9
      panne authored
      Improved #include path handling:
      
      * Don't use '-I-', it breaks a lot of system headers, e.g.
      
           #include <GL/glut.h>
      
        fails (when using freeglut), because /usr/include/GL/glut.h contains
      
           #include "freeglut_std.h"
      
        but /usr/include/GL/freeglut_std.h will not be found. It is a bit
        debatable if the header is broken and should use
      
           #include "GL/freeglut_std.h"
      
        instead. Anyway, a grep through the SuSE 9.1 system headers shows that
        there seems to be no real common practice, so let's play safe and don't
        use '-I-'.
      
      * Don't use '-I .', #include stub headers "locally" instead, e.g. use
      
           #include "Concurrent_stub.h"
      
        instead of
      
           #include "Control/Concurrent_stub.h"
      
        Note that "Control" is still in the #include path, because the *.hc file
        is normally in /tmp and the stub header is in the directory where *.hs
        is. We could remove this path element, too, if the stub header would be
        copied to the directory of the *.hc file during compilation. SimonM?
      b89ad0e9
  10. 30 Sep, 2004 1 commit
    • simonmar's avatar
      [project @ 2004-09-30 10:31:58 by simonmar] · 9b6858cb
      simonmar authored
      Add -I- after the include paths when running gcc.  This prevents
      accidental shadowing of system includes by putting a file called
      eg. stdint.h in the current directory.
      9b6858cb
  11. 16 Sep, 2004 1 commit
  12. 16 Aug, 2004 1 commit
    • simonmar's avatar
      [project @ 2004-08-16 11:19:24 by simonmar] · e3d95da8
      simonmar authored
      Define <arch>_TARGET_ARCH and <os>_TARGET_OS by default when CPP'ing.
      This avoids the main reason for needing to #include config.h into
      Haskell source, so most files that previously just #include "config.h" can now
      
        #if __GLASGOW_HASKELL__ < 603
        #include "config.h"
        #endif
      e3d95da8
  13. 13 Aug, 2004 1 commit
  14. 12 Aug, 2004 1 commit
    • simonmar's avatar
      [project @ 2004-08-12 11:19:39 by simonmar] · 6c06a48b
      simonmar authored
      Take the timestamp of an interpreted linkable from the timestamp of
      the source file.  This works better when the local clock is out of
      sync with the filesystem, and it's just as accurate.
      6c06a48b
  15. 24 Feb, 2004 1 commit
    • simonmar's avatar
      [project @ 2004-02-24 17:33:32 by simonmar] · cd20fd58
      simonmar authored
      Experimental support for RTS-only "ways"
      
      HEADS UP!  This changes the way that the threaded RTS is used, and
      also the use of debugging RTSs:
      
        - We always build threaded and debugging variants of the RTS now.
          The --enable-threaded-rts configure option is ignored (and will
          be removed at some point).
      
        - New option:  -debug     enables the debugging RTS
      
        - New option:  -threaded  enables the threaded RTS.  When the threaded
          RTS is stable enough, we might make it the default.
      
      The new options just cause a different variant of the RTS to be linked
      in, and they cause one or two extra options to be enabled too.  The
      implementation is via the usual ways machinery in the compiler, except
      that these ways are labelled as RTS-only, and so don't require
      rebuilding all the libraries too.
      
      All of this means we can ship threaded and debugging RTSs with GHC, so
      that users don't need to fetch and build a GHC source tree to use
      them.
      
      I'd like to get this functionality into 6.2.1 if possible, so please
      test (I'm willing to stretch the definition of "interface change" to
      accomodate this, since having a threaded RTS available without having
      to build GHC will be a big win for the Visual Studio project).
      cd20fd58
  16. 23 Jan, 2004 1 commit
    • simonmar's avatar
      [project @ 2004-01-23 13:55:28 by simonmar] · 29da2cf3
      simonmar authored
      Some small steps in the direction of making GHC useable as a library:
      
        - The ErrMsg type is now richer: we keep the location info and the
          PrintUnqualified separate until the message is printed out, and
          messages have a short summary and "extra info", where the extra
          info is used for things like the context info in the typechecker
          (stuff that you don't normally want to see in a more visual setting,
          where the context is obvious because you're looking at the code).
      
        - hscMain now takes an extra argument of type (Messages -> IO ()),
          which says what to do with the error messages.  In normal usage,
          we just pass ErrUtils.printErrorsAndWarnings, but eg. a development
          environment will want to do something different.  The direction we
          need to head in is for hscMain to *never* do any output to
          stdout/stderr except via abstractions like this.
      29da2cf3
  17. 05 Jan, 2004 1 commit
    • simonmar's avatar
      [project @ 2004-01-05 14:54:06 by simonmar] · 2ae018a0
      simonmar authored
      Fix bug in genOutputFilenameFunc: the -keep-blah-files options weren't
      being considered for the final phase.  Upshot: -keep-hc-files wasn't
      working in --make mode (see driver060 & driver061 tests).
      
      MERGE TO STABLE
      2ae018a0
  18. 22 Oct, 2003 1 commit
    • simonmar's avatar
      [project @ 2003-10-22 14:31:09 by simonmar] · 948e7f38
      simonmar authored
      - In GHCi & Template Haskell, give a warning for things mentioned
        on the command line that we don't recognise, and then ignore them.
        In batch mode, these are still passed to the linker as before.
      
      - Clean up & rename the filename-suffix recognising functions in
        DriverPhases. There's probably a better place for these, but I've left
        them where they are for now.
      948e7f38
  19. 09 Oct, 2003 1 commit
    • 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
  20. 23 Sep, 2003 1 commit
    • simonmar's avatar
      [project @ 2003-09-23 14:32:57 by simonmar] · abbc5a0b
      simonmar authored
      - Convert many of the optimisation options into dynamic options (that is,
        they can be mentioned in {-# OPTIONS #-} pragmas).
      
      - Add a new way to specify constructor-field unboxing on a selective
        basis.  To tell the compiler to unbox a constructor field, do this:
      
            data T = T !!Int
      
        and GHC will store that field unboxed if possible.  If it isn't possible
        (say, because the field has a sum type) then the annotation is ignored.
      
        The -funbox-strict-fields flag is now a dynamic flag, and has the same
        effect as replacing all the '!' annotations with '!!'.
      abbc5a0b
  21. 23 Jul, 2003 2 commits
  22. 18 Jul, 2003 1 commit
    • simonmar's avatar
      [project @ 2003-07-18 13:18:06 by simonmar] · 2d532e45
      simonmar authored
      Revision to the filename policy changes of yesterday.  This fixes the
      broken stage2 and library builds.
      
      The new story is this:
      
        A Haskell source filename should take the form
      
      	<path>/<basename>.<extension>
      
        where
      
      	<path>      is any directory
      	<basename>  is the name of the module, with dots replaced by slashes.
      	<extension> is ".hs" or ".lhs".
      
        given a source filename in this form, GHC will produce object and
        interface files named respectively:
      
              <hidir>/<basename>.<hisuf>
      	<odir>/<basename>.<osuf>
      
        where
      
      	<hidir>   is the value of the -hidir flag, if one was given, or
      		  the value of <path> from the source file otherwise.
      
      	<odir>    the same, for the -odir flag.
      
              <osuf>	  the object suffix (settable with the -osuf flag)
      	<hisuf>   the hi suffix (settable with the -hisuf flag)
      
      For example, if I have a module A.B.C, in source file foo/A/B/C.hs,
      then GHC will create foo/A/B/C.hi and foo/A/B/C.o.
      
      If GHC is given a source filename which is *not* of the form
      <path>/<basename>.<extension>, then it uses a different strategy.
      This happens if the filename does not follow the module name.  In this
      case, GHC will set <path> to be the directory in which the source file
      resides, and <basename> to the module name with dots replaced by
      slashes, and then use the rules above.
      
      For example, if we put module A.B.C in foo/bar/baz.hs, then GHC will
      produce foo/bar/A/B/C.o and foo/bar/A/B/C.hi.
      2d532e45
  23. 17 Jul, 2003 1 commit
    • simonmar's avatar
      [project @ 2003-07-17 12:04:50 by simonmar] · 6677029a
      simonmar authored
      Filename-related cleanup & fixes
      --------------------------------
      
      This commit rationalises some of our filename policies.  The new story
      is this:
      
        When compiling a Haskell module A.B.C:
      
          The object file is placed in <obj-path>/A/B/C.o
          The interface file is placed in <hi-path>/A/B/C.hi
      
          Where <objpath> is
      	- the argument of the -odir flag, if one was given
      	- the element of the search path in which the source file was found,
      	  when in --make mode.
      	- "." otherwise.
      
          Where <hipath> is
      	- the argument of the -hidir flag, if one was given
      	- the element of the search path in which the source file was found,
      	  when in --make mode.
      	- "." otherwise.
      
      NOTE, in particular, that the name of the source file has no bearing
      on the name of the object or interface file any more.  This is a
      nchange from the previous semantics, where the name of the object file
      would, under certain circumstances, follow the name of the source file.
      
      eg. before, if you said
      
      	ghc -c dir/foo.hs
      
      you would get dir/foo.o.  Now, you get something like Main.o,
      depending on what module is in foo.hs.  This means that the driver
      pipeline machinery now needs to pass around a Maybe ModLocation, which
      is filled in by the Hsc phase and used later on to figure out the name
      of the object file (this was fairly painful, but seems to be the only
      way to get the right behaviour).
      6677029a
  24. 16 Jul, 2003 1 commit
  25. 27 Jun, 2003 1 commit
    • sof's avatar
      [project @ 2003-06-27 18:28:31 by sof] · 9e6162f9
      sof authored
      Do as for one-shot linking and implicitly supply packages 'base' and
      'haskell98' when piecing together a DLL.
      
      Merge to STABLE.
      9e6162f9
  26. 13 Jun, 2003 1 commit
  27. 06 Jun, 2003 1 commit
  28. 05 Jun, 2003 1 commit
    • simonmar's avatar
      [project @ 2003-06-05 10:11:22 by simonmar] · 2ce1b8d7
      simonmar authored
      - Fix a couple of bugs in yesterday's pipeline cleanup.
      
      - Do some more tidying: share the code for filename generation between
        the two entry points to HscMain, and also share some of the other
        machinery in the Hsc phase.  This fixes some wibbles (things that
        were done in --make mode but not in one-shot, and vice-versa).
      
        One thing that works now is that if you say 'ghc -keep-hc-files Foo.hs',
        then it automatically switches to -fvia-C mode to generate the .hc file.
      2ce1b8d7
  29. 04 Jun, 2003 1 commit
    • simonmar's avatar
      [project @ 2003-06-04 15:47:58 by simonmar] · 70b6c54b
      simonmar authored
      Grrr, started off making a small bugfix and ended up doing a major
      cleanup operartion.
      
      Anyway, the problem was that -odir wasn't putting the object files in
      the right place when the module in question has a hierarchical name.
      This was due to the object filename being generated in two different
      places: once by the compilation pipeline machinery, and again in the
      Finder.  It now works properly when --make is used; I haven't managed
      to fix it for one-shot compilations though (some replumbing is
      needed).
      
      While I was here, I cleaned up the compilation pipeline machinery
      somewhat.  The previous scheme of generating a data structure
      representing the phases that need to be executed before actually
      executing them was wrong because the structure of the pipeline can
      change while it is being executed (eg. if we see {-# OPTIONS -fasm #-}
      during the CPP phase).  There were various hacks to deal with this,
      but it turned out to be quite messy.
      
      So the new story is that each compilation phase returns the name of
      the next phase to execute, and also figures out which file to put its
      output in.  This unfortunately means that the knowledge about what
      phases are done in what order is now spread throughout the module, but
      there are fewer hacks at the higher levels, and overall it seems to be
      an improvement.
      70b6c54b
  30. 03 Jun, 2003 1 commit
  31. 30 May, 2003 1 commit
    • wolfgang's avatar
      [project @ 2003-05-30 22:29:41 by wolfgang] · 44ff8384
      wolfgang authored
      MacOS X:
      pass the -framework option and its parameter as two separate arguments,
      i.e. ["-framework", "Foo"] instead of ["-framework Foo"].
      This is necessary because all options passed to gcc are now quoted
      (since rev. 1.88 of SysTools.lhs), and "-framework Foo" is not a valid
      option (while "-framework" "Foo" is).
      
      MERGE TO STABLE
      44ff8384
  32. 03 Mar, 2003 1 commit
  33. 06 Jan, 2003 1 commit
    • simonpj's avatar
      [project @ 2003-01-06 15:16:33 by simonpj] · 392095c9
      simonpj authored
      --------------------------------
      	Make ModLocation have a FilePath
      	instead of (Maybe FilePath) for
      	the object-file location
      	--------------------------------
      
      This generally tides things up, and makes ml_obj_file more like
      ml_hi_file.
      
      Furthermore the ml_obj_file field gets filled in even when we
      initially expect just an .hi file.  This is important for Template
      Haskell.
      392095c9
  34. 18 Dec, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-12-18 16:29:25 by simonmar] · 854ab9a4
      simonmar authored
      "Auto" packages.
      
      The big change here is that it is no longer necessary to explicitly
      say '-package X' on the command line if X is a package containing
      hierarchical Haskell modules.  All packages marked "auto" contribute
      to the import path, so their modules are always available.  At link
      time, the compiler knows which packages are actually used by the
      program, and it links in only those libraries needed.
      
      There's one exception: one-shot linking.  If you link a program using
      
          ghc -o prog A.o B.o ...
      
      then you need to explicitly add -package flags for each package
      required (except base & haskell98) because the compiler has no
      information about the package dependencies in this case.
      
      Package configs have a new field: auto, which is either True or False.
      Non-auto packages must be mentioned on the command-line as usual.
      Non-auto packages are still required for:
      
        - non-hierarchical libraries (to avoid polluting the module namespace)
      
        - packages with no Haskell content
      
        - if you want more than one version of a package, or packages
          providing overlapping functionality where the user must decide
          which one to use.
      
      Doc changes to follow...
      854ab9a4
  35. 17 Dec, 2002 1 commit