1. 17 Feb, 2003 1 commit
  2. 09 Jan, 2003 1 commit
    • simonmar's avatar
      [project @ 2003-01-09 10:49:21 by simonmar] · 78dddbd2
      simonmar authored
      Further refine the criteria for deciding whether command line
      arguments should be passed to the compilation manager or the linker.
      See comments in the file.
      
      MERGE TO STABLE
      78dddbd2
  3. 19 Dec, 2002 1 commit
  4. 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
  5. 17 Dec, 2002 1 commit
  6. 25 Oct, 2002 1 commit
  7. 24 Oct, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-10-24 13:08:35 by simonmar] · 04a63774
      simonmar authored
      In --make mode, consider everything that doesn't contain a '.' to be a
      compilation manager input.  This fixes cases like
      
        ghc --make test37
      
      where test37.hs exists.  I broke this in the previous commit, causing
      a number of tests to break.
      04a63774
  8. 15 Oct, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-10-15 13:20:18 by simonmar] · 7370adc0
      simonmar authored
      beginMake: separate out compilation-manager inputs from linkable
      objects in a way that is more consistent with the one-shot compilation
      mode.  Specifically, we now pass anything that looks like a module
      name or a Haskell source filename to the compilation manager, and
      everything else to the linker.
      
      MERGE TO STABLE
      7370adc0
  9. 13 Sep, 2002 1 commit
    • simonpj's avatar
      [project @ 2002-09-13 15:02:25 by simonpj] · 9af77fa4
      simonpj authored
      --------------------------------------
      	Make Template Haskell into the HEAD
      	--------------------------------------
      
      This massive commit transfers to the HEAD all the stuff that
      Simon and Tim have been doing on Template Haskell.  The
      meta-haskell-branch is no more!
      
      WARNING: make sure that you
      
        * Update your links if you are using link trees.
          Some modules have been added, some have gone away.
      
        * Do 'make clean' in all library trees.
          The interface file format has changed, and you can
          get strange panics (sadly) if GHC tries to read old interface files:
          e.g.  ghc-5.05: panic! (the `impossible' happened, GHC version 5.05):
      	  Binary.get(TyClDecl): ForeignType
      
        * You need to recompile the rts too; Linker.c has changed
      
      
      However the libraries are almost unaltered; just a tiny change in
      Base, and to the exports in Prelude.
      
      
      NOTE: so far as TH itself is concerned, expression splices work
      fine, but declaration splices are not complete.
      
      
      		---------------
      		The main change
      		---------------
      
      The main structural change: renaming and typechecking have to be
      interleaved, because we can't rename stuff after a declaration splice
      until after we've typechecked the stuff before (and the splice
      itself).
      
      * Combine the renamer and typecheker monads into one
      	(TcRnMonad, TcRnTypes)
        These two replace TcMonad and RnMonad
      
      * Give them a single 'driver' (TcRnDriver).  This driver
        replaces TcModule.lhs and Rename.lhs
      
      * The haskell-src library package has a module
      	Language/Haskell/THSyntax
        which defines the Haskell data type seen by the TH programmer.
      
      * New modules:
      	hsSyn/Convert.hs 	converts THSyntax -> HsSyn
      	deSugar/DsMeta.hs 	converts HsSyn -> THSyntax
      
      * New module typecheck/TcSplice type-checks Template Haskell splices.
      
      		-------------
      		Linking stuff
      		-------------
      
      * ByteCodeLink has been split into
      	ByteCodeLink	(which links)
      	ByteCodeAsm	(which assembles)
      
      * New module ghci/ObjLink is the object-code linker.
      
      * compMan/CmLink is removed entirely (was out of place)
        Ditto CmTypes (which was tiny)
      
      * Linker.c initialises the linker when it is first used (no need to call
        initLinker any more).  Template Haskell makes it harder to know when
        and whether to initialise the linker.
      
      
      	-------------------------------------
      	Gathering the LIE in the type checker
      	-------------------------------------
      
      * Instead of explicitly gathering constraints in the LIE
      	tcExpr :: RenamedExpr -> TcM (TypecheckedExpr, LIE)
        we now dump the constraints into a mutable varabiable carried
        by the monad, so we get
      	tcExpr :: RenamedExpr -> TcM TypecheckedExpr
      
        Much less clutter in the code, and more efficient too.
        (Originally suggested by Mark Shields.)
      
      
      		-----------------
      		Remove "SysNames"
      		-----------------
      
      Because the renamer and the type checker were entirely separate,
      we had to carry some rather tiresome implicit binders (or "SysNames")
      along inside some of the HsDecl data structures.  They were both
      tiresome and fragile.
      
      Now that the typechecker and renamer are more intimately coupled,
      we can eliminate SysNames (well, mostly... default methods still
      carry something similar).
      
      		-------------
      		Clean up HsPat
      		-------------
      
      One big clean up is this: instead of having two HsPat types (InPat and
      OutPat), they are now combined into one.  This is more consistent with
      the way that HsExpr etc is handled; there are some 'Out' constructors
      for the type checker output.
      
      So:
      	HsPat.InPat	--> HsPat.Pat
      	HsPat.OutPat	--> HsPat.Pat
      	No 'pat' type parameter in HsExpr, HsBinds, etc
      
      	Constructor patterns are nicer now: they use
      		HsPat.HsConDetails
      	for the three cases of constructor patterns:
      		prefix, infix, and record-bindings
      
      	The *same* data type HsConDetails is used in the type
      	declaration of the data type (HsDecls.TyData)
      
      Lots of associated clean-up operations here and there.  Less code.
      Everything is wonderful.
      9af77fa4
  10. 06 Sep, 2002 1 commit
  11. 29 Aug, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-08-29 15:44:11 by simonmar] · ce9687a5
      simonmar authored
      Housekeeping:
      
        - The main goal is to remove dependencies on hslibs for a
          bootstrapped compiler, leaving only a requirement that the
          packages base, haskell98 and readline are built in stage 1 in
          order to bootstrap.  We're almost there: Posix is still required
          for signal handling, but all other dependencies on hslibs are now
          gone.
      
          Uses of Addr and ByteArray/MutableByteArray array are all gone
          from the compiler.  PrimPacked defines the Ptr type for GHC 4.08
          (which didn't have it), and it defines simple BA and MBA types to
          replace uses of ByteArray and MutableByteArray respectively.
      
        - Clean up import lists.  HsVersions.h now defines macros for some
          modules which have moved between GHC versions.  eg. one now
          imports 'GLAEXTS' to get at unboxed types and primops in the
          compiler.
      
          Many import lists have been sorted as per the recommendations in
          the new style guidelines in the commentary.
      
      I've built the compiler with GHC 4.08.2, 5.00.2, 5.02.3, 5.04 and
      itself, and everything still works here.  Doubtless I've got something
      wrong, though.
      ce9687a5
  12. 06 Jul, 2002 1 commit
    • chak's avatar
      [project @ 2002-07-06 10:14:31 by chak] · 9b6803a6
      chak authored
      Reverted to check for `null srcs' (instead of `null real_srcs') to determine
      whether to throw "no input files".  Otherwise, something like
      
        ghc -o foo ObjectGeneratedByGHC.o
      
      doesn't work anymore.
      9b6803a6
  13. 05 Jul, 2002 1 commit
    • sof's avatar
      [project @ 2002-07-05 16:15:14 by sof] · 3421ad30
      sof authored
      When validating the number of source files on the command-line wrt other
      options, only consider source files. i.e., don't consider .a's and .o's
      that inadvertently, and idempotently, might be present.
      3421ad30
  14. 01 May, 2002 2 commits
    • sof's avatar
      [project @ 2002-05-01 17:56:52 by sof] · 2ac92d88
      sof authored
      mapM ~> mapM_
      2ac92d88
    • simonmar's avatar
      [project @ 2002-05-01 09:30:04 by simonmar] · dd9e1672
      simonmar authored
      - When converting ModuleNames to Modules for use in the the module
        initialisation code, look them up in the IfaceTable(s) instead of
        calling findModule again.  They are guaranteed to be in either
        the HomeIfaceTable or the PackageIfaceTable after the renamer,
        so this saves some trips to the filesystem.  Also, move this
        code earlier in the compilation cycle to avoid holding on to the
        renamed syntax for too long (not sure if this makes a difference or
        not, but it definitely looked space-leakish before).
      
      - remove Util.unJust, it is a duplicate of Maybes.expectJust
      dd9e1672
  15. 05 Apr, 2002 2 commits
    • sof's avatar
      [project @ 2002-04-05 23:24:25 by sof] · d254a44b
      sof authored
      Friday afternoon pet peeve removal: define (Util.notNull :: [a] -> Bool) and use it
      d254a44b
    • sof's avatar
      [project @ 2002-04-05 16:43:56 by sof] · ef3da13b
      sof authored
      Catch the use of non-existent output directories &
      report this back to the user. By not doing this, we relied
      on external tools (such as the linker or assembler) to give
      good feedback about this error condition -- this wasn't
      the case (cf. GAS on mingw/cygwin.)
      
      To insert more sanity checks of the effective options
      (to the batch compiler), use Main.checkOptions
      ef3da13b
  16. 29 Mar, 2002 1 commit
    • sof's avatar
      [project @ 2002-03-29 21:39:36 by sof] · 76293b14
      sof authored
      Front end for External Core.
      
      Initial go at implementing a Core front end
      (enabled via -fcore); work in progress (renamer
      is currently not willing to slurp in & resolve
      imports.)
      76293b14
  17. 26 Mar, 2002 1 commit
  18. 13 Mar, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-03-13 13:51:34 by simonmar] · 950c1eca
      simonmar authored
      Fix the -fasm/-fvia-C auto-selection again: now we're back to the
      proper behaviour, namely -fasm is the default unless you specify -O or
      -fvia-C, but only on arch's that support it.
      
      I screwed it up in the previous commit, but it exposed a bug in the
      NCG so it wasn't all bad :)
      950c1eca
  19. 12 Mar, 2002 2 commits
  20. 05 Mar, 2002 1 commit
  21. 04 Mar, 2002 2 commits
    • simonmar's avatar
      [project @ 2002-03-04 17:01:26 by simonmar] · 0171936c
      simonmar authored
      Binary Interface Files - stage 1
      --------------------------------
      
      This commit changes the default interface file format from text to
      binary, in order to improve compilation performace.
      
      To view an interface file, use 'ghc --show-iface Foo.hi'.
      
      utils/Binary.hs is the basic Binary I/O library, based on the nhc98
      binary I/O library but much stripped-down and working in terms of
      bytes rather than bits, and with some special features for GHC: it
      remembers which Module is being emitted to avoid dumping too many
      qualified names, and it keeps track of a "dictionary" of FastStrings
      so that we don't dump the same FastString more than once into the
      binary file.  I'll make a generic version of this for the libraries at
      some point.
      
      main/BinIface.hs contains most of the Binary instances.  Some
      instances are in the same module as the data type (RdrName, Name,
      OccName in particular).  Most instances were generated using a
      modified version of DrIFT, which I'll commit later.  However, editing
      them by hand isn't hard (certainly easier than modifying
      ParseIface.y).
      
      The first thing in a binary interface is the interface version, so
      nice error messages will be generated if the binary format changes and
      you still have old interfaces lying around.  The version also now
      includes the "way" as an extra sanity check.
      
      Other changes
      -------------
      
      I don't like the way FastStrings contain both hashed strings (with
      O(1) comparison) and literal C strings (with O(n) comparison).  So as
      a first step to separating these I made serveral "literal" type
      strings into hashed strings.  SLIT() still generates a literal, and
      now FSLIT() generates a hashed string.  With DEBUG on, you'll get a
      warning if you try to compare any SLIT()s with anything, and the
      compiler will fall over if you try to dump any literal C strings into
      an interface file (usually indicating a use of SLIT() which should be
      FSLIT()).
      
      mkSysLocal no longer re-encodes its FastString argument each time it
      is called.
      
      I also fixed the -pgm options so that the argument can now optionally
      be separted from the option.
      
      Bugfix: PrelNames declared Names for several comparison primops, eg.
      eqCharName, eqIntName etc. but these had different uniques from the
      real primop names.  I've moved these to PrimOps and defined them using
      mkPrimOpIdName instead, and deleted some for which we don't have real
      primops (Manuel: please check that things still work for you after
      this change).
      0171936c
    • simonmar's avatar
      [project @ 2002-03-04 14:40:54 by simonmar] · 6561aa4e
      simonmar authored
      import wibbles
      6561aa4e
  22. 04 Jan, 2002 2 commits
    • simonmar's avatar
      [project @ 2002-01-04 16:02:03 by simonmar] · 6f57245b
      simonmar authored
      Some driver cleanups; in particular -fno-code should work in a more
      reasonable way (it is now a "mode flag" like -C, -c, --make etc.).
      6f57245b
    • simonmar's avatar
      [project @ 2002-01-04 11:35:13 by simonmar] · 4d2d47a5
      simonmar authored
      - rename CompManager.cmLoadModule to cmLoadModules and make it take
        a DynFlags argument to be consistent with the rest of the
        CompManager interface.
      
      - split cmLoadModule into two parts: cmDepAnal which takes a list of
        filenames and returns a ModuleGraph, and cmLoadModules which takes
        the ModuleGraph and does the rest.  This lets the consumer know
        whether the dependency analysis step fails before unloading any
        existing modules - i.e. if you :reload and a module is missing, you
        don't lose the modules that are already loaded (bug reported by
        MIchael Weber some time ago).
      4d2d47a5
  23. 05 Dec, 2001 1 commit
    • 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
  24. 03 Nov, 2001 1 commit
    • sof's avatar
      [project @ 2001-11-03 01:30:42 by sof] · d6afbe3e
      sof authored
      main: in both exception handlers, explicitly flush stdout before
            emitting bytes onto stderr, since the two aren't connected
            any longer.
      d6afbe3e
  25. 26 Oct, 2001 1 commit
    • sof's avatar
      [project @ 2001-10-26 00:53:27 by sof] · 11447047
      sof authored
      Added support for a custom pre-processor pass:
      
        ghc -F -pgmF/path/to/a/pre/processor ...
      
      will now run /path/to/a/pre/processor over Haskell
      input sources. It is positioned in the compilation
      pipeline just before the compiler proper, but after
      unlit'ing and CPP'ing. The pre-processor is passed
      the following command-line when invoked:
      
         /path/to/a/pre/processor orig_input_source_file_path
         			    input_source_file
      			    output_source_file
      			    <other options>
      
      Additionally options can be fed directly to the
      pre-processor via -optF<option> options.
      
      The -F option causes the pre-processor to run _iff_ one
      has been specified via -pgmF (there's some redundancy
      here, but I went for this cmd-line interface as it's
      consistent with the general -pgm<Foo> story).
      
      Motivation:
      
       * hooking in a pre-processor is occasionally useful;
         e.g., cheap&cheerful way to integrate language
         extensions with GHC, compile-time syntax/style
         checking etc.
      
       * Artfully re-using the CPP phase (by specifying your
         own via -pgmP) doesn't really work as the driver
         really assumes that GNU cpp is what's being invoked
         (and path mangling is also performed on Win32 platforms).
      
         Additionally, there are cases when you want to be
         able to run CPP _and_ a pre-processor.
      
       * The alternative of running the pre-processor as a
         separate program in a Makefile (say) doesn't work
         in interpreted mode, and this approach also forces
         you to give up on recompilation checking when in
         batch mode.
      11447047
  26. 25 Oct, 2001 1 commit
    • sof's avatar
      [project @ 2001-10-25 02:13:10 by sof] · 9e933350
      sof authored
      - Pet peeve removal / code tidyup, replaced various sub-optimal
        uses of 'length' with something a bit better, i.e., replaced
        the following patterns
      
         *  length as `cmpOp` length bs
         *  length as `cmpOp` val   -- incl. uses where val == 1 and val == 0
         *  {take,drop,splitAt} (length as) bs
         *  length [ () | pat <- as ]
      
        with uses of misc Util functions.
      
        I'd be surprised if there's a noticeable reduction in running
        times as a result of these changes, but every little bit helps.
      
        [ The changes have been tested wrt testsuite/ - I'm seeing a couple
          of unexpected breakages coming from CorePrep, but I'm currently
          assuming that these are due to other recent changes. ]
      
      - compMan/CompManager.lhs: restored 4.08 compilability + some code
        cleanup.
      
      None of these changes are HEADworthy.
      9e933350
  27. 22 Oct, 2001 1 commit
    • simonmar's avatar
      [project @ 2001-10-22 13:45:15 by simonmar] · 2ca8eeed
      simonmar authored
      Default verbosity mode is always 1, and we don't print the
      "Compiling ( foo.hs, foo.o )" message if we're in OneShot mode.
      
      Fixes recently introduced problem where the "compilation IS NOT
      required" message isn't printed at all in OneShot mode.
      2ca8eeed
  28. 14 Aug, 2001 1 commit
    • sewardj's avatar
      [project @ 2001-08-14 13:40:07 by sewardj] · bc5c8021
      sewardj authored
      Change the story about POSIX headers in C compilation.
      
      Until now, all C code in the RTS and library cbits has by default been
      compiled with settings for POSIXness enabled, that is:
         #define _POSIX_SOURCE   1
         #define _POSIX_C_SOURCE 199309L
         #define _ISOC9X_SOURCE
      If you wanted to negate this, you'd have to define NON_POSIX_SOURCE
      before including headers.
      
      This scheme has some bad effects:
      
      * It means that ccall-unfoldings exported via interfaces from a
        module compiled with -DNON_POSIX_SOURCE may not compile when
        imported into a module which does not -DNON_POSIX_SOURCE.
      
      * It overlaps with the feature tests we do with autoconf.
      
      * It seems to have caused borkage in the Solaris builds for some
        considerable period of time.
      
      The New Way is:
      
      * The default changes to not-being-in-Posix mode.
      
      * If you want to force a C file into Posix mode, #include as
        the **first** include the new file ghc/includes/PosixSource.h.
        Most of the RTS C sources have this include now.
      
      * NON_POSIX_SOURCE is almost totally expunged.  Unfortunately
        we have to retain some vestiges of it in ghc/compiler so that
        modules compiled via C on Solaris using older compilers don't
        break.
      bc5c8021
  29. 13 Aug, 2001 1 commit
    • simonmar's avatar
      [project @ 2001-08-13 15:49:37 by simonmar] · 9a3a6d71
      simonmar authored
      A bunch of changes (been waiting for the link to cvs.haskell.org to
      come back):
      
      - Two new flags -ignore-dot-ghci and -read-dot-ghci control the
        reading (or not) of ./.ghci and $HOME/.ghci.  This will be useful
        for automatic testing of GHCi.
      
      - A new option -package-conf <file> allows reading an additional
        package.conf file, which can be used to keep a per-user set of
        packages.
      
      - GHCi now fails gracefully on startup if linking the libraries
        specified on the command-line fails.
      9a3a6d71
  30. 08 Aug, 2001 1 commit
  31. 07 Aug, 2001 1 commit
    • simonmar's avatar
      [project @ 2001-08-07 10:54:01 by simonmar] · 4a950d42
      simonmar authored
      Back out the ExitException change; it's already taken into account by
      DriverUtil.handle.
      
      Sigbjorn: I'm not sure what was going on with your Win32 build, but it
      looks like it was a bug somewhere else.
      4a950d42
  32. 03 Aug, 2001 2 commits
    • ken's avatar
      [project @ 2001-08-03 23:38:50 by ken] · b17957ce
      ken authored
      Fixed: ExitException doesn't exist in __GLASGOW_HASKELL__ < 501,
      so references to ExitException should be preprocessed out.
      b17957ce
    • sof's avatar
      [project @ 2001-08-03 20:40:43 by sof] · e8964a48
      sof authored
      - have the toplevel exception handler propagate ExitExceptions, don't flag
        them as panics. i.e., when the dynamic exception handler catches a
        PhaseFailed{}, it throws an ExitException. The outer/topmost handler
        catches this (on a Win32 box, but not my other (Linux) box for some
        reason...), and maps it to a panic, which is not what you want.
      - introduced the old 'Compilation had errors' message in case of a
        PhaseFailed{}; feel free to nuke that one (again).
      e8964a48
  33. 11 Jul, 2001 1 commit
    • sof's avatar
      [project @ 2001-07-11 19:48:07 by sof] · 17629712
      sof authored
      Prev commit which tried to get rid of the 'ineffective CPP'
      stage broke an invariant/assumption made by DriverPipeline.genPipeline,
      I'm afraid.
      
      The invariant being that from the input filename to a compilation
      pipeline, the start stage/phase can be uniquely determined
      (via DriverPhases.startPhase). run_phase no longer guarantees
      this, its result filename may now be equal to the input filename.
      [This resulted in -M not working properly when -cpp wasn't also used].
      
      Patch this up by having the input filename to a compilation pipeline
      stage be tagged with the assumed suffix of the output. This is
      really just papering over the cracks, the proper way to tidy this
      up is to avoid having to do the two-stage compilation pipeline in
      Main.main.compileFile, i.e., reconsider how OPTIONS pragmas are
      handled. I decided not to try to do this now for fear of destabilising
      HEAD even further.
      17629712
  34. 04 Jul, 2001 1 commit
    • simonmar's avatar
      [project @ 2001-07-04 15:43:38 by simonmar] · 1d75d4c4
      simonmar authored
      Only print out the GHCi banner when verbosity >= 1, so you can omit
      the banner with -v0 (useful for tests where you don't want the GHC
      version number appearing in the output).
      1d75d4c4