1. 23 Jun, 2003 1 commit
    • simonpj's avatar
      [project @ 2003-06-23 10:35:15 by simonpj] · d28ba8c8
      simonpj authored
      -------------------
      	Dealing with 'main'
      	-------------------
      
      1.  In GHC 6.0, a module with no "module Main ... where" header
          elicited an error "main is not in scope" if 'main' is not defined.  We
          don't want this behaviour in GHCi.  This happened because the parser
          expanded the (absent) header to "module Main( main ) where", and the
          'main' in the export list isn't.
      
      Solution: elaborate HsModule to record whether the 'module ..." header was
      given explicitly by the user or not.
      
      
      2.  Add a -main-is flag, and document it, so that you can have a 'main' function
      that is not Main.main.  Summary of changes
      
      * The -main-is flag nominates what the main function is to be (see the documentation).
      	No -main-is flag 	says that the main function is Main.main
      	-main-is Foo.baz	says that the main function is Foo.baz
      	-main-is Foo		says that the main function is Foo.main
      	-main-is baz		says that the main function is Main.baz
      
        Let's say  you say -main-is Foo.baz
      
      * TcRnDriver injects the extra definition
      	$Mian.main :: IO t
      	$Main.main = baz
        in the module Foo.   Note the naming, which is a bit different than before;
        previously the extra defn was for Main.$main.  The RTS invokes zdMain_main_closure.
      
      * CodeGen injects an extra initialisation block into module Foo, thus
      	stginit_zdMain {
      		stginit_Foo
      	}
        That ensures that the RTS can initialise stginit_zdMain.
      d28ba8c8
  2. 12 Jun, 2003 1 commit
    • simonpj's avatar
      [project @ 2003-06-12 16:50:19 by simonpj] · 0116f059
      simonpj authored
      ----------------------------------
      	Fix the no-GHC.Err problem in GHCi
      	----------------------------------
      
      Merge this to the stable branch.
      
      Pattern-match failure error-ids are wired-in, which means the
      GHC.Err interface isn't loaded, which in turn confused the linker
      when tried to find what package GHC.Err is from.
      
      Now we exclude wired-in names from the free variables looked at
      by the linker (in Linker.linkExpr), and make sure the base package
      is loaded unconditionally (DriverState.initPackageList).
      0116f059
  3. 04 Feb, 2003 1 commit
    • simonpj's avatar
      [project @ 2003-02-04 15:09:38 by simonpj] · 957bf375
      simonpj authored
      -------------------------------------
      	Remove all vestiges of usage analysis
      	-------------------------------------
      
      This commit removes a large blob of usage-analysis-related code, almost
      all of which was commented out.
      
      Sadly, it doesn't look as if Keith is going to have enough time to polish it
      up, and in any case the actual performance benefits (so far as we can measure
      them) turned out to be pretty modest (a few percent).
      
      So, with regret, I'm chopping it all out.  It's still there in the repository
      if anyone wants go hack on it.  And Tobias Gedell at Chalmers is implementing
      a different analysis, via External Core.
      957bf375
  4. 19 Dec, 2002 1 commit
  5. 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
  6. 17 Dec, 2002 1 commit
  7. 12 Dec, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-12-12 17:36:16 by simonmar] · b3016a12
      simonmar authored
      A modification to the way we build link lines.
      
      Currently the link line is constructed like this, for packages p1, p2 etc.:
      
        libraries p1 ++ extra_libs p1 ++
        libraries p2 ++ extra_libs p2 ++
        ...
        extra_ld_opts p1 ++
        extra_ld_opts p2 ++
        ..
      
      This change makes it follow this pattern:
      
        libraries p1 ++ extra_libs p1 ++ extra_ld_opts p1 ++
        libraries p2 ++ extra_libs p2 ++ extra_ld_opts p2 ++
        ...
      
      which seems more useful: in particular it means that using foo-config
      (eg. gtk-config) to populate extra_ld_opts should now work properly,
      and extra_libs is no longer strictly speaking needed (you can just use
      -l options in extra_ld_opts and get the same effect).
      
      Also:
      
        - There's now no difference between -l<lib> and -optl-l<lib>
        - GHCi grabs libs from extra_ld_opts as well as extra_libs
      b3016a12
  8. 25 Oct, 2002 1 commit
  9. 24 Oct, 2002 1 commit
    • simonpj's avatar
      [project @ 2002-10-24 14:17:46 by simonpj] · e0445ffa
      simonpj authored
      ------------------------------------------
      	1. New try and module and package dependencies
      	2. OrigNameCache always contains final info
      	------------------------------------------
      
      These things nearly complete sorting out the incremental
      linking problem that started us off!
      
      1. This commit separates two kinds of information:
      
        (a) HscTypes.Dependencies:
      	What (i)  home-package modules, and
      	     (ii) other packages
            this module depends on, transitively.
      
            That is, to link the module, it should be enough
            to link the dependent modules and packages (plus
            any C stubs etc).
      
            Along with this info we record whether the dependent module
            is (a) a boot interface or (b) an orphan module.  So in
            fact (i) can contain non-home-package modules, namely the
            orphan ones in other packages (sigh).
      
        (b) HscTypes.Usage:
            What version of imported things were used to
            actually compile the module.  This info is used for
            recompilation control only.
      
      
      
      2. The Finder now returns a correct Module (incl package indicator)
      first time, so we can install the absolutely final Name in the
      OrigNameCache when we first come across an occurrence of that name,
      even if it's only an occurrence in an unfolding in some other interface
      file.  This is much tidier.
      
      As a result Module.lhs is much cleaner
      	No DunnoYet
      	No mkVanillaModule
      ALl very joyful stuff.
      e0445ffa
  10. 17 Oct, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-10-17 14:26:16 by simonmar] · 06575d67
      simonmar authored
      Finder overhaul.
      
      The finder had got pretty complicated; this commit is mainly a
      cleanup, with one new feature:
      
        - the finder has a cache (again).  The cache may be flushed by
          calling flushFinderCache, which actually only flushes home modules
          from the cache, because package modules are assumed not to move.
          This change is apropos of some other changes which will result in
          the finder being called more often, so we think a cache is going
          to be worthwhile.
      
      Also a couple of bugs were fixed:
      
        - the field ml_hi_file in a ModLocation is now *always* the name
          of the .hi file.  If you need a .hi-boot file, you have to make
          it up by changing the suffix of ml_hi_file.  (DriverMkDepend and
          RnHiFiles do this).  This was the cause of a bug, but I can't
          remember the details.
      
        - The -odir flag now works in a more reasonable way: hierarchical
          modules get put in subdirectories of the -odir directory.  eg.
          if your module is A.B.C, and -odir D is specified, then the object
          will be D/A/B/C.o; previously it would have been D/C.o.
      06575d67
  11. 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
  12. 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
  13. 12 Jun, 2002 1 commit
    • wolfgang's avatar
      [project @ 2002-06-12 22:04:25 by wolfgang] · 643a2f70
      wolfgang authored
      Added support for Frameworks on MacOS X.
      *) On MacOS X, two additional command-line options are supported:
      -framework <FRAMEWORK>    link with framework, gets passed on to ld
      -framework-path <PATH>    gets passed on to ld as "-F<PATH>". (-F is already taken for GHC).
      *) Two corresponding additional options for package.conf files:
      framework_dirs
      extra_frameworks
      These options are allowed on any platform. They are ignored everywhere except on MacOS X.
      *) ghc-pkg no longer uses Read. Instead, it uses a Happy parser. ghc/utils/ghc-pkg/ParsePkgConfLite.y is basically a copy of ghc/compiler/main/ParsePkgConf.y. "Light" refers to the fact that it doesn't depend on other GHC modules and has less sophisticated error reporting.
      *) Frameworks will need some additional work for GHCi.
      643a2f70
  14. 04 Jun, 2002 1 commit
    • sof's avatar
      [project @ 2002-06-04 19:17:57 by sof] · c49a75b9
      sof authored
      Three way split of HSbase + adjust pointed fingers in the direction
      of the real culprit here (the GNU linker, not the file format.)
      c49a75b9
  15. 28 May, 2002 1 commit
  16. 22 Apr, 2002 1 commit
    • simonpj's avatar
      [project @ 2002-04-22 16:06:35 by simonpj] · dbfe93e6
      simonpj authored
      CPR control
      
      1.  Remove -fno-cpr, add -fcpr-off which is a simple static flag
          for switching the new CPR analysis off altogether.
          (The "-fno" machinery is rather complicated.)
      
      2.  Rejig SimplCore a little so that the "old strictness analyser"
          runs both the old strictness analyser and the old CPR analyser,
          which makes it more like the new strictness/CPR analyser.
      
          (How much longer we keep the old strictness/CPR analyser in the
          compiler at all I don't know.  It's just for comparision purposes
          when we write the paper.)
      dbfe93e6
  17. 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
  18. 29 Mar, 2002 2 commits
  19. 15 Mar, 2002 1 commit
  20. 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
  21. 16 Feb, 2002 1 commit
    • sof's avatar
      [project @ 2002-02-16 18:15:14 by sof] · 07c1fd55
      sof authored
      getPackageLibraries: replace some rather fragile string prefix matching
      code that broke when "HSstd" got renamed to "HSbase".
      07c1fd55
  22. 13 Feb, 2002 1 commit
  23. 12 Feb, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-02-12 15:17:13 by simonmar] · 2cc5b907
      simonmar authored
      Switch over to the new hierarchical libraries
      ---------------------------------------------
      
      This commit reorganises our libraries to use the new hierarchical
      module namespace extension.
      
      The basic story is this:
      
         - fptools/libraries contains the new hierarchical libraries.
           Everything in here is "clean", i.e. most deprecated stuff has
           been removed.
      
      	- fptools/libraries/base is the new base package
      	  (replacing "std") and contains roughly what was previously
      	  in std, lang, and concurrent, minus deprecated stuff.
      	  Things that are *not allowed* in libraries/base include:
      		Addr, ForeignObj, ByteArray, MutableByteArray,
      		_casm_, _ccall_, ``'', PrimIO
      
      	  For ByteArrays and MutableByteArrays we use UArray and
      	  STUArray/IOUArray respectively now.
      
      	  Modules previously called PrelFoo are now under
      	  fptools/libraries/GHC.  eg. PrelBase is now GHC.Base.
      
      	- fptools/libraries/haskell98 provides the Haskell 98 std.
      	  libraries (Char, IO, Numeric etc.) as a package.  This
      	  package is enabled by default.
      
      	- fptools/libraries/network is a rearranged version of
      	  the existing net package (the old package net is still
      	  available; see below).
      
      	- Other packages will migrate to fptools/libraries in
      	  due course.
      
           NB. you need to checkout fptools/libraries as well as
           fptools/hslibs now.  The nightly build scripts will need to be
           tweaked.
      
         - fptools/hslibs still contains (almost) the same stuff as before.
           Where libraries have moved into the new hierarchy, the hslibs
           version contains a "stub" that just re-exports the new version.
           The idea is that code will gradually migrate from fptools/hslibs
           into fptools/libraries as it gets cleaned up, and in a version or
           two we can remove the old packages altogether.
      
         - I've taken the opportunity to make some changes to the build
           system, ripping out the old hslibs Makefile stuff from
           mk/target.mk; the new package building Makefile code is in
           mk/package.mk (auto-included from mk/target.mk).
      
           The main improvement is that packages now register themselves at
           make boot time using ghc-pkg, and the monolithic package.conf
           in ghc/driver is gone.
      
           I've updated the standard packages but haven't tested win32,
           graphics, xlib, object-io, or OpenGL yet.  The Makefiles in
           these packages may need some further tweaks, and they'll need
           pkg.conf.in files added.
      
         - Unfortunately all this rearrangement meant I had to bump the
           interface-file version and create a bunch of .hi-boot-6 files :-(
      2cc5b907
  24. 11 Feb, 2002 1 commit
    • chak's avatar
      [project @ 2002-02-11 08:20:38 by chak] · 10fcd78c
      chak authored
      *******************************
      		       * Merging from ghc-ndp-branch *
      		       *******************************
      
      This commit merges the current state of the "parallel array extension" and
      includes the following:
      
      * (Almost) completed Milestone 1:
        - The option `-fparr' activates the H98 extension for parallel arrays.
        - These changes have a high likelihood of conflicting (in the CVS sense)
          with other changes to GHC and are the reason for merging now.
        - ToDo: There are still some (less often used) functions not implemented in
      	  `PrelPArr' and a mechanism is needed to automatically import
      	  `PrelPArr' iff `-fparr' is given.  Documentation that should go into
      	  the Commentary is currently in `ghc/compiler/ndpFlatten/TODO'.
      
      * Partial Milestone 2:
        - The option `-fflatten' activates the flattening transformation and `-ndp'
          selects the "ndp" way (where all libraries have to be compiled with
          flattening).  The way option `-ndp' automagically turns on `-fparr' and
          `-fflatten'.
        - Almost all changes are in the new directory `ndpFlatten' and shouldn't
          affect the rest of the compiler.  The only exception are the options and
          the points in `HscMain' where the flattening phase is called when
          `-fflatten' is given.
        - This isn't usable yet, but already implements function lifting,
          vectorisation, and a new analysis that determines which parts of a module
          have to undergo the flattening transformation.  Missing are data structure
          and function specialisation, the unboxed array library (including fusion
          rules), and lots of testing.
      
      I have just run the regression tests on the thing without any problems.  So,
      it seems, as if we haven't broken anything crucial.
      10fcd78c
  25. 04 Jan, 2002 1 commit
  26. 15 Dec, 2001 1 commit
  27. 14 Dec, 2001 1 commit
    • simonpj's avatar
      [project @ 2001-12-14 17:24:03 by simonpj] · 5f087cf4
      simonpj authored
      -------------------------
      	Performance tuning things
      	-------------------------
      
      I did some nofib tests, and fixed a number of performance problems.
      
      1.  Things were getting floated to top level, and that prevented
      some useful fusion happening.
      	y = build g
      	x = foldr k z y
      
      Fixed by arranging that we only get really keen on floating to top
      level in the second run of the let-float-out pass.
      
      
      2.  Some fettling up on the let-floater itself.  It had some parameters
      that weren't even being used!  And it was stupidly floating things out
      of a one-shot lambda, and the float-in pass didn't float them back in.
      I think I fixed both of these problems.
      
      
      3.  The eta-reducer was not eta-reducing (/\a -> g a) to g.  In general
      it has to be a bit careful because "seq" means that (\x -> g x) is
      not in general the same as g ---- but it *is* the same for a type lambda.
      
      This turned out to be important in rule matching, where the foldr/build
      rule was not firing because the LHS of the rule looked like
      	foldr k z (/\ a -> g a) = ...
      which never matched!  Result, no fusion to speak of!
      
      
      4.  The simplifier was a bit too gung ho about inlining used-once
      things bound to constructor args.  The comment is with Simplify.simplNonRecX.
      5f087cf4
  28. 10 Dec, 2001 1 commit
  29. 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
  30. 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
  31. 22 Oct, 2001 1 commit
    • simonmar's avatar
      [project @ 2001-10-22 10:33:50 by simonmar] · d45e90d3
      simonmar authored
      Changes to the finder algorithm: in non-compilation-manager modes
      (eg. ghc -c) we now search for .hi files only, because a source file
      is no good to us.  In compilation manager modes, we now don't search
      for .hi files in the home package at all.
      d45e90d3
  32. 01 Oct, 2001 1 commit
  33. 26 Sep, 2001 1 commit
    • simonpj's avatar
      [project @ 2001-09-26 15:12:33 by simonpj] · e0d750be
      simonpj authored
      ------------------
      		Simon's big commit
      		------------------
      
      This commit, which I don't think I can sensibly do piecemeal, consists
      of the things I've been doing recently, mainly directed at making
      Manuel, George, and Marcin happier with RULES.
      
      
      Reogranise the simplifier
      ~~~~~~~~~~~~~~~~~~~~~~~~~
      1. The simplifier's environment is now an explicit parameter.  This
      makes it a bit easier to figure out where it is going.
      
      2. Constructor arguments can now be arbitrary expressions, except
      when the application is the RHS of a let(rec).  This makes it much
      easier to match rules like
      
      	RULES
      	    "foo"  f (h x, g y) = f' x y
      
      In the simplifier, it's Simplify.mkAtomicArgs that ANF-ises a
      constructor application where necessary.  In the occurrence analyser,
      there's a new piece of context info (OccEncl) to say whether a
      constructor app is in a place where it should be in ANF.  (Unless
      it knows this it'll give occurrence info which will inline the
      argument back into the constructor app.)
      
      3. I'm experimenting with doing the "float-past big lambda" transformation
      in the full laziness pass, rather than mixed in with the simplifier (was
      tryRhsTyLam).
      
      4.  Arrange that
      	case (coerce (S,T) (x,y)) of ...
      will simplify.  Previous it didn't.
      A local change to CoreUtils.exprIsConApp_maybe.
      
      5. Do a better job in CoreUtils.exprEtaExpandArity when there's an
      error function in one branch.
      
      
      Phase numbers, RULES, and INLINE pragmas
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      1.  Phase numbers decrease from N towards zero (instead of increasing).
      This makes it easier to add new earlier phases, which is what users want
      to do.
      
      2.  RULES get their own phase number, N, and are disabled in phases before N.
      
      e.g. 	{-# RULES "foo" [2] forall x y.  f (x,y) = f' x y #-}
      
      Note the [2], which says "only active in phase 2 and later".
      
      3.  INLINE and NOINLINE pragmas have a phase number to.  This is now treated
      in just the same way as the phase number on RULE; that is, the Id is not inlined
      in phases earlier than N.  In phase N and later the Id *may* be inlined, and
      here is where INLINE and NOINLINE differ: INLNE makes the RHS look small, so
      as soon as it *may* be inlined it probably *will* be inlined.
      
      The syntax of the phase number on an INLINE/NOINLINE pragma has changed to be
      like the RULES case (i.e. in square brackets).  This should also make sure
      you examine all such phase numbers; many will need to change now the numbering
      is reversed.
      
      Inlining Ids is no longer affected at all by whether the Id appears on the
      LHS of a rule.  Now it's up to the programmer to put a suitable INLINE/NOINLINE
      pragma to stop it being inlined too early.
      
      
      Implementation notes:
      
      *  A new data type, BasicTypes.Activation says when a rule or inline pragma
      is active.   Functions isAlwaysActive, isNeverActive, isActive, do the
      obvious thing (all in BasicTypes).
      
      * Slight change in the SimplifierSwitch data type, which led to a lot of
      simplifier-specific code moving from CmdLineOpts to SimplMonad; a Good Thing.
      
      * The InlinePragma in the IdInfo of an Id is now simply an Activation saying
      when the Id can be inlined.  (It used to be a rather bizarre pair of a
      Bool and a (Maybe Phase), so this is much much easier to understand.)
      
      * The simplifier has a "mode" environment switch, replacing the old
      black list.  Unfortunately the data type decl has to be in
      CmdLineOpts, because it's an argument to the CoreDoSimplify switch
      
          data SimplifierMode = SimplGently | SimplPhase Int
      
      Here "gently" means "no rules, no inlining".   All the crucial
      inlining decisions are now collected together in SimplMonad
      (preInlineUnconditionally, postInlineUnconditionally, activeInline,
      activeRule).
      
      
      Specialisation
      ~~~~~~~~~~~~~~
      1.  Only dictionary *functions* are made INLINE, not dictionaries that
      have no parameters.  (This inline-dictionary-function thing is Marcin's
      idea and I'm still not sure whether it's a good idea.  But it's definitely
      a Bad Idea when there are no arguments.)
      
      2.  Be prepared to specialise an INLINE function: an easy fix in
      Specialise.lhs
      
      But there is still a problem, which is that the INLINE wins
      at the call site, so we don't use the specialised version anyway.
      I'm still unsure whether it makes sense to SPECIALISE something
      you want to INLINE.
      
      
      
      
      
      Random smaller things
      ~~~~~~~~~~~~~~~~~~~~~~
      
      * builtinRules (there was only one, but may be more) in PrelRules are now
        incorporated.   They were being ignored before...
      
      * OrdList.foldOL -->  OrdList.foldrOL, OrdList.foldlOL
      
      * Some tidying up of the tidyOpenTyVar, tidyTyVar functions.  I've
        forgotten exactly what!
      e0d750be
  34. 14 Sep, 2001 1 commit
    • simonpj's avatar
      [project @ 2001-09-14 15:51:41 by simonpj] · 5ab261bb
      simonpj authored
      --------------------------
      	Add a rule-check pass
      	(special request by Manuel)
      	--------------------------
      
      	DO NOT merge with stable
      
      The flag
      
      	-frule-check foo
      
      will report all sites at which RULES whose name starts with "foo.."
      might apply, but in fact the arguments don't match so the rule
      doesn't apply.
      
      The pass is run right after all the core-to-core passes.  (Next thing
      to do: make the core-to-core script external, so you can fiddle with
      it.  Meanwhile, the core-to-core script is in
      	DriverState.builCoreToDo
      so you can move the CoreDoRuleCheck line around if you want.
      
      The format of the report is experimental: Manuel, feel free to fiddle
      with it.
      
      Most of the code is in specialise/Rules.lhs
      
      
      Incidental changes
      ~~~~~~~~~~~~~~~~~~
      Change BuiltinRule so that the rule name is accessible
      without actually successfully applying the rule.  This
      change affects quite a few files in a trivial way.
      5ab261bb
  35. 04 Sep, 2001 1 commit
  36. 15 Aug, 2001 1 commit
  37. 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
  38. 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