1. 17 Jan, 2008 1 commit
    • twanvl's avatar
      Monadify profiling/SCCfinal · 44a19648
      twanvl authored
        - change monad type synonym into a newtype
        - use do, return and standard monad functions
      44a19648
  2. 03 Oct, 2007 1 commit
  3. 04 Sep, 2007 1 commit
  4. 03 Sep, 2007 1 commit
  5. 01 Sep, 2007 1 commit
  6. 07 Jul, 2007 1 commit
  7. 10 May, 2007 1 commit
  8. 28 Feb, 2007 1 commit
    • Simon Marlow's avatar
      Fix #249 (-caf-all bugs) · e07e2550
      Simon Marlow authored
      There were two bugs:
       * we were generating the symbol name for the CAF
         cost centre from the OccName, which isn't unique enough
         in the case of system-generated non-external names
       * :Main.main caused problems, because we were assuming that
         every top-level CAF was from the current module.
      e07e2550
  9. 24 Oct, 2006 1 commit
    • andy@galois.com's avatar
      Haskell Program Coverage · d5934bbb
      andy@galois.com authored
      This large checkin is the new ghc version of Haskell
      Program Coverage, an expression-level coverage tool for Haskell.
      
      Parts:
      
       - Hpc.[ch] - small runtime support for Hpc; reading/writing *.tix files.
       - Coverage.lhs - Annotates the HsSyn with coverage tickboxes.
        - New Note's in Core,
            - TickBox      -- ticked on entry to sub-expression
            - BinaryTickBox  -- ticked on exit to sub-expression, depending
      	       	     -- on the boolean result.
      
        - New Stg level TickBox (no BinaryTickBoxes, though) 
      
      You can run the coverage tool with -fhpc at compile time. 
      Main must be compiled with -fhpc. 
      				      
      d5934bbb
  10. 25 Jul, 2006 1 commit
    • Simon Marlow's avatar
      Generalise Package Support · 61d2625a
      Simon Marlow authored
      This patch pushes through one fundamental change: a module is now
      identified by the pair of its package and module name, whereas
      previously it was identified by its module name alone.  This means
      that now a program can contain multiple modules with the same name, as
      long as they belong to different packages.
      
      This is a language change - the Haskell report says nothing about
      packages, but it is now necessary to understand packages in order to
      understand GHC's module system.  For example, a type T from module M
      in package P is different from a type T from module M in package Q.
      Previously this wasn't an issue because there could only be a single
      module M in the program.
      
      The "module restriction" on combining packages has therefore been
      lifted, and a program can contain multiple versions of the same
      package.
      
      Note that none of the proposed syntax changes have yet been
      implemented, but the architecture is geared towards supporting import
      declarations qualified by package name, and that is probably the next
      step.
      
      It is now necessary to specify the package name when compiling a
      package, using the -package-name flag (which has been un-deprecated).
      Fortunately Cabal still uses -package-name.
      
      Certain packages are "wired in".  Currently the wired-in packages are:
      base, haskell98, template-haskell and rts, and are always referred to
      by these versionless names.  Other packages are referred to with full
      package IDs (eg. "network-1.0").  This is because the compiler needs
      to refer to entities in the wired-in packages, and we didn't want to
      bake the version of these packages into the comiler.  It's conceivable
      that someone might want to upgrade the base package independently of
      GHC.
      
      Internal changes:
      
        - There are two module-related types:
      
              ModuleName      just a FastString, the name of a module
              Module          a pair of a PackageId and ModuleName
      
          A mapping from ModuleName can be a UniqFM, but a mapping from Module
          must be a FiniteMap (we provide it as ModuleEnv).
      
        - The "HomeModules" type that was passed around the compiler is now
          gone, replaced in most cases by the current package name which is
          contained in DynFlags.  We can tell whether a Module comes from the
          current package by comparing its package name against the current
          package.
      
        - While I was here, I changed PrintUnqual to be a little more useful:
          it now returns the ModuleName that the identifier should be qualified
          with according to the current scope, rather than its original
          module.  Also, PrintUnqual tells whether to qualify module names with
          package names (currently unused).
      
      Docs to follow.
      61d2625a
  11. 07 Apr, 2006 1 commit
    • Simon Marlow's avatar
      Reorganisation of the source tree · 0065d5ab
      Simon Marlow authored
      Most of the other users of the fptools build system have migrated to
      Cabal, and with the move to darcs we can now flatten the source tree
      without losing history, so here goes.
      
      The main change is that the ghc/ subdir is gone, and most of what it
      contained is now at the top level.  The build system now makes no
      pretense at being multi-project, it is just the GHC build system.
      
      No doubt this will break many things, and there will be a period of
      instability while we fix the dependencies.  A straightforward build
      should work, but I haven't yet fixed binary/source distributions.
      Changes to the Building Guide will follow, too.
      0065d5ab
  12. 11 Aug, 2005 1 commit
  13. 21 Jun, 2005 1 commit
    • simonmar's avatar
      [project @ 2005-06-21 10:44:37 by simonmar] · 0c53bd0e
      simonmar authored
      Relax the restrictions on conflicting packages.  This should address
      many of the traps that people have been falling into with the current
      package story.
      
      Now, a local module can shadow a module in an exposed package, as long
      as the package is not otherwise required by the program.  GHC checks
      for conflicts when it knows the dependencies of the module being
      compiled.
      
      Also, we now check for module conflicts in exposed packages only when
      importing a module: if an import can be satisfied from multiple
      packages, that's an error.  It's not possible to prevent GHC from
      starting by installing packages now (unless you install another base
      package).
      
      It seems to be possible to confuse GHCi by having a local module
      shadowing a package module that goes away and comes back again.  I
      think it's nearly right, but strange happenings have been observed.
      
      I'll try to merge this into the STABLE branch.
      0c53bd0e
  14. 18 Mar, 2005 1 commit
    • simonmar's avatar
      [project @ 2005-03-18 13:37:27 by simonmar] · d1c1b7d0
      simonmar authored
      Flags cleanup.
      
      Basically the purpose of this commit is to move more of the compiler's
      global state into DynFlags, which is moving in the direction we need
      to go for the GHC API which can have multiple active sessions
      supported by a single GHC instance.
      
      Before:
      
      $ grep 'global_var' */*hs | wc -l
           78
      
      After:
      
      $ grep 'global_var' */*hs | wc -l
           27
      
      Well, it's an improvement.  Most of what's left won't really affect
      our ability to host multiple sessions.
      
      Lots of static flags have become dynamic flags (yay!).  Notably lots
      of flags that we used to think of as "driver" flags, like -I and -L,
      are now dynamic.  The most notable static flags left behind are the
      "way" flags, eg. -prof.  It would be nice to fix this, but it isn't
      urgent.
      
      On the way, lots of cleanup has happened.  Everything related to
      static and dynamic flags lives in StaticFlags and DynFlags
      respectively, and they share a common command-line parser library in
      CmdLineParser.  The flags related to modes (--makde, --interactive
      etc.) are now private to the front end: in fact private to Main
      itself, for now.
      d1c1b7d0
  15. 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
  16. 02 Jul, 2003 1 commit
    • simonpj's avatar
      [project @ 2003-07-02 13:12:33 by simonpj] · 3f5e4368
      simonpj authored
      ------------------------
             Tidy up the code generator
      	------------------------
      
      The code generation for 'case' expressions had grown
      huge and gnarly.  This commit removes about 120 lines of
      code, and makes it a lot easier to read too. I think the code
      generated is identical.
      
      Part of this was to simplify the StgCase data type, so
      that it is more like the Core case: there is a simple list
      of alternatives, and the DEFAULT (if present) must be the
      first.  This tidies and simplifies other Stg passes.
      3f5e4368
  17. 14 May, 2003 1 commit
  18. 08 Mar, 2002 1 commit
    • simonpj's avatar
      [project @ 2002-03-08 15:47:18 by simonpj] · 4593b105
      simonpj authored
      ------------------------
      	Kill Type.splitRepFunTys
      	------------------------
      
      splitRepFunTys was a Bad Function that split up a function type
      looking through even recursive newtypes.  Alas, it diverged if
      when we had a recursive newtype with a function whose result was
      the newtype itself.
      
      I've replaced it with ordinary splitFunTys, plus a new function
      Type.dropForAlls, which does what you would expect.
      4593b105
  19. 04 Mar, 2002 1 commit
    • 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
  20. 04 Dec, 2001 1 commit
    • sof's avatar
      [project @ 2001-12-04 09:45:49 by sof] · 3de583c7
      sof authored
      minor tidyup - move CollectedCCs tysyn to CostCentre (from SCCFinal), and
      make use of it where that cost-centre info triple is being passed&returned.
      3de583c7
  21. 27 Nov, 2001 1 commit
  22. 23 Nov, 2001 1 commit
    • simonmar's avatar
      [project @ 2001-11-23 11:59:21 by simonmar] · 3642d212
      simonmar authored
      Collect up _scc_ expressions on the right hand side of a closure
      definition and attach them directly to the closure using PushCC-type
      cost centres, so that the allocation of the closure gets attributed to
      the right place.
      3642d212
  23. 25 Jun, 2001 1 commit
    • simonpj's avatar
      [project @ 2001-06-25 08:09:57 by simonpj] · d069cec2
      simonpj authored
      ----------------
      	Squash newtypes
      	----------------
      
      This commit squashes newtypes and their coerces, from the typechecker
      onwards.  The original idea was that the coerces would not get in the
      way of optimising transformations, but despite much effort they continue
      to do so.   There's no very good reason to retain newtype information
      beyond the typechecker, so now we don't.
      
      Main points:
      
      * The post-typechecker suite of Type-manipulating functions is in
      types/Type.lhs, as before.   But now there's a new suite in types/TcType.lhs.
      The difference is that in the former, newtype are transparent, while in
      the latter they are opaque.  The typechecker should only import TcType,
      not Type.
      
      * The operations in TcType are all non-monadic, and most of them start with
      "tc" (e.g. tcSplitTyConApp).  All the monadic operations (used exclusively
      by the typechecker) are in a new module, typecheck/TcMType.lhs
      
      * I've grouped newtypes with predicate types, thus:
      	data Type = TyVarTy Tyvar | ....
      		  | SourceTy SourceType
      
      	data SourceType = NType TyCon [Type]
      			| ClassP Class [Type]
      			| IParam Type
      
      [SourceType was called PredType.]  This is a little wierd in some ways,
      because NTypes can't occur in qualified types.   However, the idea is that
      a SourceType is a type that is opaque to the type checker, but transparent
      to the rest of the compiler, and newtypes fit that as do implicit parameters
      and dictionaries.
      
      * Recursive newtypes still retain their coreces, exactly as before. If
      they were transparent we'd get a recursive type, and that would make
      various bits of the compiler diverge (e.g. things which do type comparison).
      
      * I've removed types/Unify.lhs (non-monadic type unifier and matcher),
      merging it into TcType.
      
      Ditto typecheck/TcUnify.lhs (monadic unifier), merging it into TcMType.
      d069cec2
  24. 22 May, 2001 1 commit
    • simonpj's avatar
      [project @ 2001-05-22 13:43:14 by simonpj] · f16228e4
      simonpj authored
      -------------------------------------------
      	Towards generalising 'foreign' declarations
      	-------------------------------------------
      
      This is a first step towards generalising 'foreign' declarations to
      handle langauges other than C.  Quite a lot of files are touched,
      but nothing has really changed.  Everything should work exactly as
      before.
      
      	But please be on your guard for ccall-related bugs.
      
      Main things
      
      Basic data types: ForeignCall.lhs
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      * Remove absCSyn/CallConv.lhs
      
      * Add prelude/ForeignCall.lhs.  This defines the ForeignCall
        type and its variants
      
      * Define ForeignCall.Safety to say whether a call is unsafe
        or not (was just a boolean).  Lots of consequential chuffing.
      
      * Remove all CCall stuff from PrimOp, and put it in ForeignCall
      
      
      Take CCallOp out of the PrimOp type (where it was always a glitch)
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      * Add IdInfo.FCallId variant to the type IdInfo.GlobalIdDetails,
      	along with predicates Id.isFCallId, Id.isFCallId_maybe
      
      * Add StgSyn.StgOp, to sum PrimOp with FCallOp, because it
        *is* useful to sum them together in Stg and AbsC land.  If
        nothing else, it minimises changes.
      
      
      Also generally rename "CCall" stuff to "FCall" where it's generic
      to all foreign calls.
      f16228e4
  25. 13 Mar, 2001 1 commit
    • simonmar's avatar
      [project @ 2001-03-13 12:50:29 by simonmar] · 10cbc75d
      simonmar authored
      Some rearrangements that Simon & I have been working on recently:
      
          - CoreSat is now CorePrep, and is a general "prepare-for-code-
            generation" pass.  It does cloning, saturation of constructors &
            primops, A-normal form, and a couple of other minor fiddlings.
      
          - CoreTidy no longer does cloning, and minor fiddlings.  It doesn't
            need the unique supply any more, so that's removed.
      
          - CoreToStg now collects CafInfo and the list of CafRefs for each
            binding.  The SRT pass is much simpler now.
      
          - IdInfo now has a CgInfo field for "code generator info".  It currently
            contains arity (the actual code gen arity which affects the calling
            convention as opposed to the ArityInfo which is a measure of how
            many arguments the Id can be applied to before it does any work), and
            CafInfo.
      
            Previously we overloaded the ArityInfo field to contain both
            codegen arity and simplifier arity.  Things are cleaner now.
      
          - CgInfo is collected by CoreToStg, and passed back into CoreTidy in
            a loop.  The compiler will complain rather than going into a black
            hole if the CgInfo is pulled on too early.
      
          - Worker info in an interface file now comes with arity info attached.
            Previously the main arity info was overloaded for this purpose, but
            it lead to a few hacks in the compiler, this tidies things up somewhat.
      
      Bottom line: we removed several fragilities, and tidied up a number of
      things.  Code size should be smaller, but we'll see...
      10cbc75d
  26. 15 Nov, 2000 1 commit
    • simonpj's avatar
      [project @ 2000-11-15 14:37:08 by simonpj] · 8b653a82
      simonpj authored
      The main thing in this commit is to change StgAlts so that
      it carries a TyCon, and not a Type.  Furthermore, the TyCon
      is derived from the alternatives, so it should have its
      constructors etc, even if there's a module loop involved, so that
      some versions of the TyCon don't have the constructors visible.
      
      There's a comment in StgSyn.lhs, with the type decl for StgAlts
      
      
      Also: a start on hscExpr in HscMain.
      8b653a82
  27. 14 Nov, 2000 1 commit
    • simonpj's avatar
      [project @ 2000-11-14 08:07:11 by simonpj] · db95d6e8
      simonpj authored
      Changing the way we know whether
      something is exported.
      
      THIS COMMIT WON'T EVEN COMPILE
      (I'm doing it to transfer from my laptop.)
      Wait till later today before updating.
      db95d6e8
  28. 03 Oct, 2000 1 commit
    • simonpj's avatar
      [project @ 2000-10-03 08:43:00 by simonpj] · 710e2074
      simonpj authored
      --------------------------------------
      	Adding generics		SLPJ Oct 2000
      	--------------------------------------
      
      This big commit adds Hinze/PJ-style generic class definitions, based
      on work by Andrei Serjantov.  For example:
      
        class Bin a where
          toBin   :: a -> [Int]
          fromBin :: [Int] -> (a, [Int])
      
          toBin {| Unit |}    Unit	  = []
          toBin {| a :+: b |} (Inl x)   = 0 : toBin x
          toBin {| a :+: b |} (Inr y)   = 1 : toBin y
          toBin {| a :*: b |} (x :*: y) = toBin x ++ toBin y
      
      
          fromBin {| Unit |}    bs      = (Unit, bs)
          fromBin {| a :+: b |} (0:bs)  = (Inl x, bs')    where (x,bs') = fromBin bs
          fromBin {| a :+: b |} (1:bs)  = (Inr y, bs')    where (y,bs') = fromBin bs
          fromBin {| a :*: b |} bs  	  = (x :*: y, bs'') where (x,bs' ) = fromBin bs
      							  (y,bs'') = fromBin bs'
      
      Now we can say simply
      
        instance Bin a => Bin [a]
      
      and the compiler will derive the appropriate code automatically.
      
      		(About 9k lines of diffs.  Ha!)
      
      
      Generic related things
      ~~~~~~~~~~~~~~~~~~~~~~
      
      * basicTypes/BasicTypes: The EP type (embedding-projection pairs)
      
      * types/TyCon:
      	An extra field in an algebraic tycon (genInfo)
      
      * types/Class, and hsSyn/HsBinds:
      	Each class op (or ClassOpSig) carries information about whether
      	it  	a) has no default method
      		b) has a polymorphic default method
      		c) has a generic default method
      	There's a new data type for this: Class.DefMeth
      
      * types/Generics:
      	A new module containing good chunk of the generic-related code
      	It has a .hi-boot file (alas).
      
      * typecheck/TcInstDcls, typecheck/TcClassDcl:
      	Most of the rest of the generics-related code
      
      * hsSyn/HsTypes:
      	New infix type form to allow types of the form
      		data a :+: b = Inl a | Inr b
      
      * parser/Parser.y, Lex.lhs, rename/ParseIface.y:
      	Deal with the new syntax
      
      * prelude/TysPrim, TysWiredIn:
      	Need to generate generic stuff for the wired-in TyCons
      
      * rename/RnSource RnBinds:
      	A rather gruesome hack to deal with scoping of type variables
      	from a generic patterns.  Details commented in the ClassDecl
      	case of RnSource.rnDecl.
      
      	Of course, there are many minor renamer consequences of the
      	other changes above.
      
      * lib/std/PrelBase.lhs
      	Data type declarations for Unit, :+:, :*:
      
      
      Slightly unrelated housekeeping
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      * hsSyn/HsDecls:
      	ClassDecls now carry the Names for their implied declarations
      	(superclass selectors, tycon, etc) in a list, rather than
      	laid out one by one.  This simplifies code between the parser
      	and the type checker.
      
      * prelude/PrelNames, TysWiredIn:
      	All the RdrNames are now together in PrelNames.
      
      * utils/ListSetOps:
      	Add finite mappings based on equality and association lists (Assoc a b)
      	Move stuff from List.lhs that is related
      710e2074
  29. 11 Jul, 2000 1 commit
  30. 17 Apr, 2000 1 commit
  31. 23 Mar, 2000 1 commit
    • simonpj's avatar
      [project @ 2000-03-23 17:45:17 by simonpj] · 111cee3f
      simonpj authored
      This utterly gigantic commit is what I've been up to in background
      mode in the last couple of months.  Originally the main goal
      was to get rid of Con (staturated constant applications)
      in the CoreExpr type, but one thing led to another, and I kept
      postponing actually committing.   Sorry.
      
      	Simon, 23 March 2000
      
      
      I've tested it pretty thoroughly, but doubtless things will break.
      
      Here are the highlights
      
      * Con is gone; the CoreExpr type is simpler
      * NoRepLits have gone
      * Better usage info in interface files => less recompilation
      * Result type signatures work
      * CCall primop is tidied up
      * Constant folding now done by Rules
      * Lots of hackery in the simplifier
      * Improvements in CPR and strictness analysis
      
      Many bug fixes including
      
      * Sergey's DoCon compiles OK; no loop in the strictness analyser
      * Volker Wysk's programs don't crash the CPR analyser
      
      I have not done much on measuring compilation times and binary sizes;
      they could have got worse.  I think performance has got significantly
      better, though, in most cases.
      
      
      Removing the Con form of Core expressions
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      The big thing is that
      
        For every constructor C there are now *two* Ids:
      
      	C is the constructor's *wrapper*. It evaluates and unboxes arguments
      	before calling $wC.  It has a perfectly ordinary top-level defn
      	in the module defining the data type.
      
      	$wC is the constructor's *worker*.  It is like a primop that simply
      	allocates and builds the constructor value.  Its arguments are the
      	actual representation arguments of the constructor.
      	Its type may be different to C, because:
      		- useless dict args are dropped
      		- strict args may be flattened
      
        For every primop P there is *one* Id, its (curried) Id
      
        Neither contructor worker Id nor the primop Id have a defminition anywhere.
        Instead they are saturated during the core-to-STG pass, and the code generator
        generates code for them directly. The STG language still has saturated
        primops and constructor applications.
      
      * The Const type disappears, along with Const.lhs.  The literal part
        of Const.lhs reappears as Literal.lhs.  Much tidying up in here,
        to bring all the range checking into this one module.
      
      * I got rid of NoRep literals entirely.  They just seem to be too much trouble.
      
      * Because Con's don't exist any more, the funny C { args } syntax
        disappears from inteface files.
      
      
      Parsing
      ~~~~~~~
      * Result type signatures now work
      	f :: Int -> Int = \x -> x
      	-- The Int->Int is the type of f
      
      	g x y :: Int = x+y
      	-- The Int is the type of the result of (g x y)
      
      
      Recompilation checking and make
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      * The .hi file for a modules is not touched if it doesn't change.  (It used to
        be touched regardless, forcing a chain of recompilations.)  The penalty for this
        is that we record exported things just as if they were mentioned in the body of
        the module.  And the penalty for that is that we may recompile a module when
        the only things that have changed are the things it is passing on without using.
        But it seems like a good trade.
      
      * -recomp is on by default
      
      Foreign declarations
      ~~~~~~~~~~~~~~~~~~~~
      * If you say
      	foreign export zoo :: Int -> IO Int
        then you get a C produre called 'zoo', not 'zzoo' as before.
        I've also added a check that complains if you export (or import) a C
        procedure whose name isn't legal C.
      
      
      Code generation and labels
      ~~~~~~~~~~~~~~~~~~~~~~~~~~
      * Now that constructor workers and wrappers have distinct names, there's
        no need to have a Foo_static_closure and a Foo_closure for constructor Foo.
        I nuked the entire StaticClosure story.  This has effects in some of
        the RTS headers (i.e. s/static_closure/closure/g)
      
      
      Rules, constant folding
      ~~~~~~~~~~~~~~~~~~~~~~~
      * Constant folding becomes just another rewrite rule, attached to the Id for the
        PrimOp.   To achieve this, there's a new form of Rule, a BuiltinRule (see CoreSyn.lhs).
        The prelude rules are in prelude/PrelRules.lhs, while simplCore/ConFold.lhs has gone.
      
      * Appending of constant strings now works, using fold/build fusion, plus
        the rewrite rule
      	unpack "foo" c (unpack "baz" c n)  =  unpack "foobaz" c n
        Implemented in PrelRules.lhs
      
      * The CCall primop is tidied up quite a bit.  There is now a data type CCall,
        defined in PrimOp, that packages up the info needed for a particular CCall.
        There is a new Id for each new ccall, with an big "occurrence name"
      	{__ccall "foo" gc Int# -> Int#}
        In interface files, this is parsed as a single Id, which is what it is, really.
      
      Miscellaneous
      ~~~~~~~~~~~~~
      * There were numerous places where the host compiler's
        minInt/maxInt was being used as the target machine's minInt/maxInt.
        I nuked all of these; everything is localised to inIntRange and inWordRange,
        in Literal.lhs
      
      * Desugaring record updates was broken: it didn't generate correct matches when
        used withe records with fancy unboxing etc.  It now uses matchWrapper.
      
      * Significant tidying up in codeGen/SMRep.lhs
      
      * Add __word, __word64, __int64 terminals to signal the obvious types
        in interface files.  Add the ability to print word values in hex into
        C code.
      
      * PrimOp.lhs is no longer part of a loop.  Remove PrimOp.hi-boot*
      
      
      Types
      ~~~~~
      * isProductTyCon no longer returns False for recursive products, nor
        for unboxed products; you have to test for these separately.
        There's no reason not to do CPR for recursive product types, for example.
        Ditto splitProductType_maybe.
      
      Simplification
      ~~~~~~~~~~~~~~~
      * New -fno-case-of-case flag for the simplifier.  We use this in the first run
        of the simplifier, where it helps to stop messing up expressions that
        the (subsequent) full laziness pass would otherwise find float out.
        It's much more effective than previous half-baked hacks in inlining.
      
        Actually, it turned out that there were three places in Simplify.lhs that
        needed to know use this flag.
      
      * Make the float-in pass push duplicatable bindings into the branches of
        a case expression, in the hope that we never have to allocate them.
        (see FloatIn.sepBindsByDropPoint)
      
      * Arrange that top-level bottoming Ids get a NOINLINE pragma
        This reduced gratuitous inlining of error messages.
        But arrange that such things still get w/w'd.
      
      * Arrange that a strict argument position is regarded as an 'interesting'
        context, so that if we see
      	foldr k z (g x)
        then we'll be inclined to inline g; this can expose a build.
      
      * There was a missing case in CoreUtils.exprEtaExpandArity that meant
        we were missing some obvious cases for eta expansion
        Also improve the code when handling applications.
      
      * Make record selectors (identifiable by their IdFlavour) into "cheap" operations.
      	  [The change is a 2-liner in CoreUtils.exprIsCheap]
        This means that record selection may be inlined into function bodies, which
        greatly improves the arities of overloaded functions.
      
      * Make a cleaner job of inlining "lone variables".  There was some distributed
        cunning, but I've centralised it all now in SimplUtils.analyseCont, which
        analyses the context of a call to decide whether it is "interesting".
      
      * Don't specialise very small functions in Specialise.specDefn
        It's better to inline it.  Rather like the worker/wrapper case.
      
      * Be just a little more aggressive when floating out of let rhss.
        See comments with Simplify.wantToExpose
        A small change with an occasional big effect.
      
      * Make the inline-size computation think that
      	case x of I# x -> ...
        is *free*.
      
      
      CPR analysis
      ~~~~~~~~~~~~
      * Fix what was essentially a bug in CPR analysis.  Consider
      
      	letrec f x = let g y = let ... in f e1
      		     in
      		     if ... then (a,b) else g x
      
        g has the CPR property if f does; so when generating the final annotated
        RHS for f, we must use an envt in which f is bound to its final abstract
        value.  This wasn't happening.  Instead, f was given the CPR tag but g
        wasn't; but of course the w/w pass gives rotten results in that case!!
        (Because f's CPR-ness relied on g's.)
      
        On they way I tidied up the code in CprAnalyse.  It's quite a bit shorter.
      
        The fact that some data constructors return a constructed product shows
        up in their CPR info (MkId.mkDataConId) not in CprAnalyse.lhs
      
      
      
      Strictness analysis and worker/wrapper
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      * BIG THING: pass in the demand to StrictAnal.saExpr.  This affects situations
        like
      	f (let x = e1 in (x,x))
        where f turns out to have strictness u(SS), say.  In this case we can
        mark x as demanded, and use a case expression for it.
      
        The situation before is that we didn't "know" that there is the u(SS)
        demand on the argument, so we simply computed that the body of the let
        expression is lazy in x, and marked x as lazily-demanded.  Then even after
        f was w/w'd we got
      
      	let x = e1 in case (x,x) of (a,b) -> $wf a b
      
        and hence
      
      	let x = e1 in $wf a b
      
        I found a much more complicated situation in spectral/sphere/Main.shade,
        which improved quite a bit with this change.
      
      * Moved the StrictnessInfo type from IdInfo to Demand.  It's the logical
        place for it, and helps avoid module loops
      
      * Do worker/wrapper for coerces even if the arity is zero.  Thus:
      	stdout = coerce Handle (..blurg..)
        ==>
      	wibble = (...blurg...)
      	stdout = coerce Handle wibble
        This is good because I found places where we were saying
      	case coerce t stdout of { MVar a ->
      	...
      	case coerce t stdout of { MVar b ->
      	...
        and the redundant case wasn't getting eliminated because of the coerce.
      111cee3f
  32. 08 Mar, 2000 1 commit
    • simonmar's avatar
      [project @ 2000-03-08 17:48:24 by simonmar] · de896403
      simonmar authored
      - generalise the per-module initialisation stubs so that we use it
        in normal (non-profiled) code too.  The initialisation stubs are
        now called '__init_<module>' rather than '_reg<module>'.
      
      - Register foreign exported functions as stable pointers in the
        initialisation code for the module.  This fixes the foreign export
        problems reported by several people.
      
      - remove the concept of "module groups" from the profiling subsystem.
      
      - change the profiling semantics slightly; it should be unnecessary
        to use '-caf-all' to get reasonable profiles now.
      de896403
  33. 11 May, 1999 1 commit
    • keithw's avatar
      [project @ 1999-05-11 16:44:02 by keithw] · 5c0b6550
      keithw authored
      (this is number 7 of 9 commits to be applied together)
      
        The code generator now incorporates the update avoidance
        optimisation: a thunk of __o type is now made SingleEntry rather
        than Updatable.
      
        We want to verify that SingleEntry thunks are indeed entered at most
        once.  In order to do this, -ticky turns on eager blackholing.
        Ordinary thunks will be dealt with by the RTS, but CAFs are
        blackholed by the code generator.  We blackhole with new blackholes:
        SE_CAF_BLACKHOLE.  We will enter one of these if we attempt to enter
        a SingleEntry thunk twice.
      5c0b6550
  34. 23 Apr, 1999 1 commit
  35. 08 Apr, 1999 1 commit
    • simonm's avatar
      [project @ 1999-04-08 15:46:12 by simonm] · 36e45f65
      simonm authored
      Profiling fixes:
      
      Function closures which are inside a lambda now *set* the CCCS,
      instead of possibly appending to it.
      
      In Simplify.lhs: allow inlining imported functions when profiling.
      What we really want to do is allow any top-level binding to be
      inlined, but there doesn't seem to be an easy way to tell whether a
      binding is top-level or not.
      36e45f65
  36. 02 Mar, 1999 1 commit
  37. 27 Jan, 1999 1 commit
    • simonpj's avatar
      [project @ 1999-01-27 14:51:14 by simonpj] · 18976e61
      simonpj authored
      Finally!  This commits the ongoing saga of Simon's hygiene sweep
      
      FUNCTIONALITY
      ~~~~~~~~~~~~~
      a) The 'unused variable' warnings from the renamer work.  
      b) Better error messages here and there, esp type checker
      c) Fixities for Haskell 98 (maybe I'd done that before)
      d) Lazy reporting of name clashes for Haskell 98 (ditto)
      
      HYGIENE
      ~~~~~~~
      a) type OccName has its own module.  OccNames are represented
         by a single FastString, not three as in the last round.  This
         string is held in Z-encoded form; a decoding function decodes
         for printing in user error messages.  There's a nice tight
         encoding for (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)
      
      b) type Module is a proper ADT, in module OccName
      
      c) type RdrName is a proper ADT, in its own module
      
      d) type Name has a new, somwhat tidier, representation
      
      e) much grunting in the renamer to get Provenances right.
         This makes error messages look better (no spurious qualifiers)
      18976e61
  38. 18 Dec, 1998 1 commit
    • simonpj's avatar
      [project @ 1998-12-18 17:40:31 by simonpj] · 7e602b0a
      simonpj authored
      Another big commit from Simon.  Actually, the last one
      didn't all go into the main trunk; because of a CVS glitch it
      ended up in the wrong branch.
      
      So this commit includes:
      
      * Scoped type variables
      * Warnings for unused variables should work now (they didn't before)
      * Simplifier improvements:
      	- Much better treatment of strict arguments
      	- Better treatment of bottoming Ids
      	- No need for w/w split for fns that are merely strict
      	- Fewer iterations needed, I hope
      * Less gratuitous renaming in interface files and abs C
      * OccName is a separate module, and is an abstract data type
      
      I think the whole Prelude and Exts libraries compile correctly.
      Something isn't quite right about typechecking existentials though.
      7e602b0a
  39. 02 Dec, 1998 1 commit
  40. 14 Aug, 1998 1 commit