1. 09 Jul, 2010 1 commit
  2. 25 Jun, 2010 1 commit
  3. 20 Mar, 2010 1 commit
  4. 07 Dec, 2009 1 commit
  5. 17 Oct, 2009 1 commit
  6. 18 Aug, 2009 1 commit
    • Thomas Schilling's avatar
      Remove the lock around NameCache for readBinIface. · cadba810
      Thomas Schilling authored
      Turns out using atomic update instead of a full-blown lock was easier
      than I thought.  It should also be safe in the case where we
      concurrently read the same interface file.  Whichever thread loses the
      race will simply find that all of the names are already defined and
      will have no effect on the name cache.
      cadba810
  7. 17 Aug, 2009 1 commit
    • Thomas Schilling's avatar
      Make access to NameCache atomic. Sometimes needs a lock. · 9f68c348
      Thomas Schilling authored
      'readBinIface' updates the name cache in a way that is hard to use
      with atomicModifyIORef, so this patch introduces a lock for this case.
      All other updates use atomicModifyIORef.
      
      Having a single lock is quite pessimistic, so it remains to be seen
      whether this will become a problem.  In principle we only need to make
      sure that we do not load the same file concurrently (or that it's
      idempotent).  In practice we also need to ensure that concurrent reads
      do not cancel each other out (since the new NameCache may be based on
      an outdated version).
      9f68c348
  8. 07 Jul, 2009 1 commit
  9. 28 May, 2009 1 commit
    • simonpj@microsoft.com's avatar
      Improve printing of Orig RdrNames · 30ced404
      simonpj@microsoft.com authored
      In Tempate Haskell -ddump-splices, the "after" expression is populated 
      with RdrNames, many of which are Orig things.  We used to print these
      fully-qualified, but that's a bit heavy.
      
      This patch refactors the code a bit so that the same print-unqualified
      mechanism we use for Names also works for RdrNames.  Lots of comments
      too, because it took me a while to figure out how it all worked again.
      30ced404
  10. 13 Mar, 2009 1 commit
  11. 06 Feb, 2009 1 commit
    • Simon Marlow's avatar
      Improvements to the "can't find module" error message (#2980) · 305b24aa
      Simon Marlow authored
      If the module was found in multiple hidden packages, we list them all.
      
      Could not find module `Data.Generics':
        it is a member of the hidden package `base-3.0.3.0'
        it is a member of the hidden package `syb'
        Use -v to see a list of the files searched for.
      305b24aa
  12. 27 Jan, 2009 1 commit
  13. 02 Jan, 2009 1 commit
    • simonpj@microsoft.com's avatar
      Make record selectors into ordinary functions · 9ffadf21
      simonpj@microsoft.com authored
      This biggish patch addresses Trac #2670.  The main effect is to make
      record selectors into ordinary functions, whose unfoldings appear in
      interface files, in contrast to their previous existence as magic
      "implicit Ids".  This means that the usual machinery of optimisation,
      analysis, and inlining applies to them, which was failing before when
      the selector was somewhat complicated.  (Which it can be when
      strictness annotations, unboxing annotations, and GADTs are involved.)
      
      The change involves the following points
      
      * Changes in Var.lhs to the representation of Var.  Now a LocalId can
        have an IdDetails as well as a GlobalId.  In particular, the
        information that an Id is a record selector is kept in the
        IdDetails.  While compiling the current module, the record selector
        *must* be a LocalId, so that it participates properly in compilation
        (free variables etc).
      
        This led me to change the (hidden) representation of Var, so that there
        is now only one constructor for Id, not two.
      
      * The IdDetails is persisted into interface files, so that an
        importing module can see which Ids are records selectors.
      
      * In TcTyClDecls, we generate the record-selector bindings in renamed,
        but not typechecked form.  In this way, we can get the typechecker
        to add all the types and so on, which is jolly helpful especially
        when GADTs or type families are involved.  Just like derived
        instance declarations.
      
        This is the big new chunk of 180 lines of code (much of which is
        commentary).  A call to the same function, mkAuxBinds, is needed in
        TcInstDcls for associated types.
      
      * The typechecker therefore has to pin the correct IdDetails on to 
        the record selector, when it typechecks it.  There was a neat way
        to do this, by adding a new sort of signature to HsBinds.Sig, namely
        IdSig.  This contains an Id (with the correct Name, Type, and IdDetails);
        the type checker uses it as the binder for the final binding.  This
        worked out rather easily.
      
      * Record selectors are no longer "implicit ids", which entails changes to
           IfaceSyn.ifaceDeclSubBndrs
           HscTypes.implicitTyThings
           TidyPgm.getImplicitBinds
        (These three functions must agree.)
      
      * MkId.mkRecordSelectorId is deleted entirely, some 300+ lines (incl
        comments) of very error prone code.  Happy days.
      
      * A TyCon no longer contains the list of record selectors: 
        algTcSelIds is gone
      
      The renamer is unaffected, including the way that import and export of
      record selectors is handled.
      
      Other small things
      
      * IfaceSyn.ifaceDeclSubBndrs had a fragile test for whether a data
        constructor had a wrapper.  I've replaced that with an explicit flag
        in the interface file. More robust I hope.
      
      * I renamed isIdVar to isId, which touched a few otherwise-unrelated files.
      
      9ffadf21
  14. 02 Dec, 2008 2 commits
  15. 28 Nov, 2008 2 commits
    • Thomas Schilling's avatar
    • Thomas Schilling's avatar
      Use a per-session data structure for callbacks. Make 'WarnErrLogger' · 9a4607c3
      Thomas Schilling authored
      part of it.
      
      Part of the GHC API essentially represents a compilation framework.
      The difference of a *framework* as opposed to a *library* is that the
      overall structure of the functionality is pre-defined but certain
      details can be customised via callbacks.  (Also known as the Hollywood
      Principle: "Don't call us, we'll call you.")
      
      This patch introduces a per-session data structure that contains all
      the callbacks instead of adding lots of small function arguments
      whenever we want to give the user more control over certain parts of
      the API.  This should also help with future changes: Adding a new
      callback doesn't break old code since code that doesn't know about the
      new callback will use the (hopefully sane) default implementation.
      
      Overall, however, we should try and keep the number of callbacks small
      and well-defined (and provide useful defaults) and use simple library
      routines for the rest.
      9a4607c3
  16. 26 Nov, 2008 1 commit
    • Thomas Schilling's avatar
      Force recompilation of BCOs when they were compiled in HscNothing mode. · 5e0453ca
      Thomas Schilling authored
      Previously, loading a set of modules in HscNothing mode and then
      switching to HscInterpreted could lead to crashes since modules
      compiled with HscNothing were thought to be valid bytecode objects.
      
      This patch forces recompilation in these cases, hence switching between
      HscNothing and HscInterpreted should be safe now.
      5e0453ca
  17. 25 Nov, 2008 1 commit
    • Thomas Schilling's avatar
      Major clean-up of HscMain. · e06951a7
      Thomas Schilling authored
      This patch entails a major restructuring of HscMain and a small bugfix
      to MkIface (which required the restructuring in HscMain).
      
      In MkIface:
      
        - mkIface* no longer outputs orphan warnings directly and also no
          longer quits GHC when -Werror is set.  Instead, errors are
          reported using the common IO (Messages, Maybe result) scheme.
      
      In HscMain:
      
        - Get rid of the 'Comp' monad.  This monad was mostly GhcMonad + two
          reader arguments, a ModSummary for the currently compiled module
          and a possible old interface.  The latter actually lead to a small
          space-leak since only its hash was needed (to check whether the
          newly-generated interface file was the same as the original one).
      
          Functions originally of type 'Comp' now only take the arguments
          that they actually need.  This leads to slighly longer argument
          lists in some places, however, it is now much easier to see what
          is actually going on.
      
        - Get rid of 'myParseModule'.  Rename 'parseFile' to 'hscParse'.
      
        - Join 'deSugarModule' and 'hscDesugar' (keeping the latter).
      
        - Rename 'typecheck{Rename}Module{'}' to 'hscTypecheck{Rename}'.
          One variant keeps the renamed syntax, the other doesn't.
      
        - Parameterise 'HscStatus', so that 'InteractiveStatus' is just a
          different parameterisation of 'HscStatus'.
      
        - 'hscCompile{OneShot,Batch,Nothing,Interactive}' are now
          implemented using a (local) typeclass called 'HsCompiler'.  The
          idea is to make the common structure more obvious.  Using this
          typeclass we now have two functions 'genericHscCompile' (original
          'hscCompiler') and 'genericHscRecompile' (original 'genComp')
          describing the default pipeline.  The methods of the typeclass
          describe a sort of "hook" interface (in OO-terms this would be
          called the "template method" pattern).
      
          One problem with this approach is that we parameterise over the
          /result/ type which, in fact, is not actually different for
          "nothing" and "batch" mode.  To avoid functional dependencies or
          associated types, we use type tags to make them artificially
          different and parameterise the type class over the result type.
          A perhaps better approach might be to use records instead.
          
        - Drop some redundant 'HscEnv' arguments.  These were likely
          different from what 'getSession' would return because during
          compilation we temporarily set the module's DynFlags as well as a
          few other fields.  We now use the 'withTempSession' combinator to
          temporarily change the 'HscEnv' and automatically restore the
          original session after the enclosed action has returned (even in
          case of exceptions).
      
        - Rename 'hscCompile' to 'hscGenHardCode' (since that is what it
          does).
      
      Calls in 'GHC' and 'DriverPipeline' accordingly needed small
      adaptions.
      e06951a7
  18. 22 Nov, 2008 1 commit
  19. 28 Oct, 2008 1 commit
  20. 30 Oct, 2008 1 commit
    • simonpj@microsoft.com's avatar
      Add (a) CoreM monad, (b) new Annotations feature · 9bcd95ba
      simonpj@microsoft.com authored
      This patch, written by Max Bolingbroke,  does two things
      
      1.  It adds a new CoreM monad (defined in simplCore/CoreMonad),
          which is used as the top-level monad for all the Core-to-Core
          transformations (starting at SimplCore).  It supports
             * I/O (for debug printing)
             * Unique supply
             * Statistics gathering
             * Access to the HscEnv, RuleBase, Annotations, Module
          The patch therefore refactors the top "skin" of every Core-to-Core
          pass, but does not change their functionality.
      
      2.  It adds a completely new facility to GHC: Core "annotations".
          The idea is that you can say
             {#- ANN foo (Just "Hello") #-}
          which adds the annotation (Just "Hello") to the top level function
          foo.  These annotations can be looked up in any Core-to-Core pass,
          and are persisted into interface files.  (Hence a Core-to-Core pass
          can also query the annotations of imported things.)  Furthermore,
          a Core-to-Core pass can add new annotations (eg strictness info)
          of its own, which can be queried by importing modules.
      
      The design of the annotation system is somewhat in flux.  It's
      designed to work with the (upcoming) dynamic plug-ins mechanism,
      but is meanwhile independently useful.
      
      Do not merge to 6.10!  
      9bcd95ba
  21. 14 Oct, 2008 1 commit
  22. 10 Oct, 2008 1 commit
  23. 06 Oct, 2008 2 commits
  24. 03 Oct, 2008 2 commits
  25. 18 Sep, 2008 1 commit
    • pepe's avatar
      Fix a couple of issues with :print · decbb181
      pepe authored
            
            - Ticket #1995: Unsoundness with newtypes
            - Ticket #2475: "Can't unify" error when stopped at an exception
            
            In addition this patch adds the following:
            
            - Unfailingness: RTTI cannot panic anymore. 
              In case of failure, it recovers gracefully by returning the "I know nothing" type
            - A -ddump-rtti flag
      decbb181
  26. 14 Sep, 2008 1 commit
  27. 27 Aug, 2008 1 commit
    • Simon Marlow's avatar
      re-fix of #1205, fix #2542 · 3d73e45b
      Simon Marlow authored
      New form of :load in GHCi:
      
      > :load *A
      
      forces A to be loaded as byte-code.  See the manual for details.  The
      previous behaviour for specifying filenames vs. module names on the
      command line and in :load has been restored.
      
      The Target datatype has a new Bool field, which is True if the target
      is allowed to be loaded from compiled code, or False otherwise, so
      this functionality is available via the GHC API.  guessTarget
      understands the *-prefix form for specifying targets.
      3d73e45b
  28. 07 Aug, 2008 1 commit
  29. 31 Jul, 2008 2 commits
  30. 20 Jul, 2008 2 commits
  31. 30 May, 2008 1 commit
    • Simon Marlow's avatar
      Fix a bug to do with recursive modules in one-shot mode · d83e1ac4
      Simon Marlow authored
      The problem was that when loading interface files in checkOldIface, we
      were not passing the If monad the mutable variable for use when
      looking up entities in the *current* module, with the result that the
      knots wouldn't be tied properly, and some instances of TyCons would
      be incorrectly abstract.
      
      This bug has subtle effects: for example, recompiling a module without
      making any changes might lead to a slightly different result (noticed
      due to the new interface-file fingerprints).  The bug doesn't lead to
      any direct failures that we're aware of.
      d83e1ac4
  32. 29 May, 2008 1 commit
    • dias@eecs.harvard.edu's avatar
      Cmm back end upgrades · 25628e27
      dias@eecs.harvard.edu authored
      Several changes in this patch, partially bug fixes, partially new code:
      o bug fixes in ZipDataflow
         - added some checks to verify that facts converge
         - removed some erroneous checks of convergence on entry nodes
         - added some missing applications of transfer functions
      o changed dataflow clients to use ZipDataflow, making ZipDataflow0 obsolete
      o eliminated DFA monad (no need for separate analysis and rewriting monads with ZipDataflow)
      o started stack layout changes
         - no longer generating CopyIn and CopyOut nodes (not yet fully expunged though)
         - still not using proper calling conventions
      o simple new optimizations:
         - common block elimination
            -- have not yet tried to move the Adams opt out of CmmProcPointZ
         - block concatenation
      o piped optimization fuel up to the HscEnv
         - can be limited by a command-line flag
         - not tested, and probably not yet properly used by clients
      o added unique supply to FuelMonad, also lifted unique supply to DFMonad
      25628e27
  33. 28 May, 2008 1 commit
    • Simon Marlow's avatar
      Use MD5 checksums for recompilation checking (fixes #1372, #1959) · 526c3af1
      Simon Marlow authored
      This is a much more robust way to do recompilation checking.  The idea
      is to create a fingerprint of the ABI of an interface, and track
      dependencies by recording the fingerprints of ABIs that a module
      depends on.  If any of those ABIs have changed, then we need to
      recompile.
      
      In bug #1372 we weren't recording dependencies on package modules,
      this patch fixes that by recording fingerprints of package modules
      that we depend on.  Within a package there is still fine-grained
      recompilation avoidance as before.
      
      We currently use MD5 for fingerprints, being a good compromise between
      efficiency and security.  We're not worried about attackers, but we
      are worried about accidental collisions.
      
      All the MD5 sums do make interface files a bit bigger, but compile
      times on the whole are about the same as before.  Recompilation
      avoidance should be a bit more accurate than in 6.8.2 due to fixing
      #1959, especially when using -O.
      526c3af1
  34. 12 Apr, 2008 1 commit