1. 19 May, 2009 1 commit
  2. 17 May, 2009 1 commit
  3. 15 May, 2009 2 commits
    • Duncan Coutts's avatar
      Set the soname when creating a shared lib · 6efacfe8
      Duncan Coutts authored
      It's still possible to override it, just use -optl-Wl,-soname, eg:
      ghc -shared -dynamic foo.o -o libfoo.so -optl-Wl,-soname,libbar.so
      6efacfe8
    • Duncan Coutts's avatar
      Keep C main separate from rts lib and link it in for standalone progs · fa00cc50
      Duncan Coutts authored
      Previously the object code for the C main function lived in the rts
      lib, however this is a problem when the rts is built as a shared lib.
      With Windows DLLs it always causes problems while on ELF systems it's a
      problem when the user decides to use their own C main function rather
      than a Haskell Main.main. So instead we now put main in it's own tiny
      little static lib libHSrtsmain.a which we install next to the rts libs.
      Whenever ghc links a program (without -no-hs-main) then it also links
      in -lHSrtsmain. For consistency we always do it this way now rather
      than trying to do it differently for static vs shared libraries.
      fa00cc50
  4. 14 May, 2009 1 commit
    • Duncan Coutts's avatar
      Remove old Windows-only implementation of keeping main outside the rts · 3d411991
      Duncan Coutts authored
      We now do it for all ways and for all platforms. This was a Windows-only
      version that only kept a separate Main.dyn_o for the dynamic linking case.
      It had to do that because Windows DLLs are stricter about unresolved symbols
      where as for ELF platforms we only run into the problem when we're not using
      a Haskell main function.
      3d411991
  5. 20 May, 2009 5 commits
  6. 19 May, 2009 1 commit
  7. 01 May, 2009 1 commit
    • Duncan Coutts's avatar
      Make ghc -dynamic imply -fPIC for C code · 431e40e1
      Duncan Coutts authored
      As is already the case for ghc -fPIC. This is needed because ghc -dynamic
      means to generate code that is capable of being linked to Haskell shared
      libs and for C code the equivalent is -fPIC. Normally C code does not need
      -fPIC merely to link to shared libs however Haskell shared libs do not
      follow common conventions. In particular the static data cannot be
      referenced statically because it cannot be copied by the static linker.
      The linker cannot copy them because we do not specify a .size for the
      _closure entries (in the .data section) though in principle we could.
      431e40e1
  8. 13 May, 2009 1 commit
  9. 22 Apr, 2009 1 commit
  10. 28 Apr, 2009 1 commit
    • Ian Lynagh's avatar
      Fix error handling · e213baf0
      Ian Lynagh authored
      After the fix to #2500, we could get "Failing due to -Werror." but no
      warnings printed. Now we don't fail in that case.
      e213baf0
  11. 26 Apr, 2009 2 commits
  12. 24 Apr, 2009 1 commit
  13. 21 Apr, 2009 3 commits
    • Simon Marlow's avatar
      FIX #2682: banish silly cases of the "module Foo is not loaded" error · ef03a76a
      Simon Marlow authored
      In GHCi if you say 'import Foo' meaning to load a package module Foo,
      and Foo.hs is found on the search path, then GHCi replies "module Foo
      is not loaded", because it knows Foo refers to the source file rather
      than the package module, and you haven't loaded that module with
      :load.
      
      This is consistent with the usual module-finding semantics.  However,
      it isn't particularly useful.  And it leads to silly problems like not
      being able to start GHCi when you happen to be sitting in
      libraries/base, because GHCi thinks the Prelude hasn't been loaded.
      
      So now I've made a slight change to the way that 'import M' works: if
      M is loaded, then it refers to the loaded module, otherwise it looks
      for a package module M.  This does what the reporter of #2682 wanted,
      and since it turns an error condition into meaningful behaviour it
      can't break anything.  
      
      The only undesirable consequence is that 'import M' might refer to a
      different M than ':load M'.  Hopefully that won't lead to confusion.
      ef03a76a
    • Simon Marlow's avatar
      FIX #2500: Don't log warnings in getHeader · a70a6e39
      Simon Marlow authored
      a70a6e39
    • Simon Marlow's avatar
  14. 20 Apr, 2009 1 commit
    • Simon Marlow's avatar
      FIX #2845: Allow breakpoints on expressions with unlifted type · 709c9ce0
      Simon Marlow authored
      It turns out we can easily support breakpoints on expressions with
      unlifted types, by translating 
      
        case tick# of _ -> e
      
      into
      
        let f = \s . case tick# of _ -> e 
        in  f realWorld#
      
      instead of just a plain let-binding.  This is the same trick that GHC
      uses for abstracting join points of unlifted type.
      
      In #2845, GHC has eta-expanded the tick expression, changing the
      result type from IO a to (# State#, a #), which was the reason the
      tick was suddenly being ignored.  By supporting ticks on unlifted
      expressions we can make it work again, although some confusion might
      arise because _result will no longer be available (it now has
      unboxed-tuple type, so we can't bind it in the environment).  The
      underlying problem here is that GHC does transformations like
      eta-expanding the tick expressions, and there's nothing we can do to
      prevent that.
      709c9ce0
  15. 09 Apr, 2009 1 commit
    • simonpj@microsoft.com's avatar
      Fix Trac #3155: better error message when -XRankNTypes is omitted · 6c06fdc7
      simonpj@microsoft.com authored
      This patch sligtly re-adjusts the way in which the syntax of types 
      is handled:
      
       * In the lexer, '.' and '*' are always accepted in types
         (previously it was conditional).  This things can't mean
         anything else in H98, which is the only reason for doing things
         conditionally in the lexer.
      
       * As a result '.' in types is never treated as an operator.
         Instead, lacking a 'forall' keyword, it turns into a plain parse error.
      
       * Test for -XKindSignatures in the renamer when processing
           a) type variable bindings
           b) types with sigs (ty :: kind-sig)
      
       * Make -XKindSignatures be implied by -XTypeFamilies 
         Previously this was buried in the conditonal lexing of '*'
      6c06fdc7
  16. 03 Apr, 2009 1 commit
    • simonpj@microsoft.com's avatar
      Adjust inlining heursitics · b71760aa
      simonpj@microsoft.com authored
      This patch is the result of a long series of nofib-based experiments
      to improve GHC's inlining heuristics.
      
      In the end, I'm not sure how worthwhile it all was: I only got a 
         1% decrease in code size
         1% decrease in allocation
      and I don't trust the runtime statistics enough to quote.
      
      Still, in doing all this I tidied up the code quite a bit, and 
      I understand it much better now, so I'm going to commit it.
      
      The main changes are in CoreUnfold, which has lots of new comments.
      Other changes:
      
        - litSize moves from Literal to CoreUnfold
        - interestingArg moves from SimplUtils to CoreUnfold
        - the default unfolding threshold (in StaticFlags) 
            reduces from 8 to 6 (since the size calculation 
            has changed a bit)
      
      b71760aa
  17. 02 Apr, 2009 1 commit
    • simonpj@microsoft.com's avatar
      Float constants to top-level even in first full laziness pass · eaeca51e
      simonpj@microsoft.com authored
      This patch changes the compilation pipeline flags so that constants
      are floated to the top level even in the first full laziness pass.
      For some reason this was not done before.  Fixing this makes a big
      improvement in 'spectral/rewrite', and has zero effect on any other
      nofib benchmark.
      eaeca51e
  18. 26 Mar, 2009 1 commit
  19. 18 Mar, 2009 2 commits
    • Simon Marlow's avatar
      FIX unregisterised target by #ifdefing targetPlatform stuff · 1d34bd56
      Simon Marlow authored
      I'm not sure if this is the correct fix.  If targetPlatform is really
      NCG-specific, then maybe we should call it asmTargetPlatform or
      something.
      1d34bd56
    • simonpj@microsoft.com's avatar
      Add the notion of "constructor-like" Ids for rule-matching · 4bc25e8c
      simonpj@microsoft.com authored
      This patch adds an optional CONLIKE modifier to INLINE/NOINLINE pragmas, 
         {-# NOINLINE CONLIKE [1] f #-}
      The effect is to allow applications of 'f' to be expanded in a potential
      rule match.  Example
        {-# RULE "r/f" forall v. r (f v) = f (v+1) #-}
      
      Consider the term
           let x = f v in ..x...x...(r x)...
      Normally the (r x) would not match the rule, because GHC would be scared
      about duplicating the redex (f v). However the CONLIKE modifier says to
      treat 'f' like a constructor in this situation, and "look through" the
      unfolding for x.  So (r x) fires, yielding (f (v+1)).
      
      The main changes are:
        - Syntax
      
        - The inlinePragInfo field of an IdInfo has a RuleMatchInfo
          component, which records whether or not the Id is CONLIKE.
          Of course, this needs to be serialised in interface files too.
      
        - The occurrence analyser (OccAnal) and simplifier (Simplify) treat
          CONLIKE thing like constructors, by ANF-ing them
      
        - New function coreUtils.exprIsExpandable is like exprIsCheap, but
          additionally spots applications of CONLIKE functions
      
        - A CoreUnfolding has a field that caches exprIsExpandable
      
        - The rule matcher consults this field.  See 
          Note [Expanding variables] in Rules.lhs.
      
      On the way I fixed a lurking variable bug in the way variables are
      expanded.  See Note [Do not expand locally-bound variables] in
      Rule.lhs.  I also did a bit of reformatting and refactoring in
      Rules.lhs, so the module has more lines changed than are really
      different.
      4bc25e8c
  20. 17 Mar, 2009 1 commit
    • Simon Marlow's avatar
      Add fast event logging · 8b18faef
      Simon Marlow authored
      Generate binary log files from the RTS containing a log of runtime
      events with timestamps.  The log file can be visualised in various
      ways, for investigating runtime behaviour and debugging performance
      problems.  See for example the forthcoming ThreadScope viewer.
      
      New GHC option:
      
        -eventlog   (link-time option) Enables event logging.
      
        +RTS -l     (runtime option) Generates <prog>.eventlog with
                    the binary event information.
      
      This replaces some of the tracing machinery we already had in the RTS:
      e.g. +RTS -vg  for GC tracing (we should do this using the new event
      logging instead).
      
      Event logging has almost no runtime cost when it isn't enabled, though
      in the future we might add more fine-grained events and this might
      change; hence having a link-time option and compiling a separate
      version of the RTS for event logging.  There's a small runtime cost
      for enabling event-logging, for most programs it shouldn't make much
      difference.
      
      (Todo: docs)
      8b18faef
  21. 16 Mar, 2009 1 commit
  22. 13 Mar, 2009 1 commit
  23. 12 Mar, 2009 1 commit
    • Simon Marlow's avatar
      FIX #3079, dodgy parsing of LANGUAGE pragmas · c197fe60
      Simon Marlow authored
      I ended up rewriting this horrible bit of code, using (yikes) lazy I/O
      to slurp in the source file a chunk at a time.  The old code tried to
      read the file a chunk at a time, but failed with LANGUAGE pragmas
      because the parser for LANGUAGE has state and the state wasn't being
      saved between chunks.  We're still closing the Handle eagerly, so
      there shouldn't be any problems here.
      c197fe60
  24. 11 Mar, 2009 1 commit
  25. 10 Mar, 2009 1 commit
  26. 05 Mar, 2009 2 commits
  27. 03 Mar, 2009 1 commit
    • dias@eecs.harvard.edu's avatar
      A few bug fixes; some improvements spurred by paper writing · 31a9d048
      dias@eecs.harvard.edu authored
      Among others:
      - Fixed Stg->C-- translation of let-no-escapes -- it's important to use the
        right continuation...
      - Fixed infinite recursion in X86 backend (shortcutJump mishandled infinite loops)
      - Fixed yet another wrong calling convention -- primops take args only in vanilla regs,
        but they may return results on the stack!
      - Removed StackInfo from LGraph and Block -- now in LastCall and CmmZ
      - Updated avail-variable and liveness code
      31a9d048
  28. 26 Feb, 2009 1 commit
  29. 22 Feb, 2009 1 commit
  30. 15 Feb, 2009 1 commit
    • Ben.Lippmeier@anu.edu.au's avatar
      NCG: Split up the native code generator into arch specific modules · b04a210e
      Ben.Lippmeier@anu.edu.au authored
        - nativeGen/Instruction defines a type class for a generic
          instruction set. Each of the instruction sets we have, 
          X86, PPC and SPARC are instances of it.
        
        - The register alloctors use this type class when they need
          info about a certain register or instruction, such as
          regUsage, mkSpillInstr, mkJumpInstr, patchRegs..
        
        - nativeGen/Platform defines some data types enumerating
          the architectures and operating systems supported by the 
          native code generator.
        
        - DynFlags now keeps track of the current build platform, and 
          the PositionIndependentCode module uses this to decide what
          to do instead of relying of #ifdefs.
        
        - It's not totally retargetable yet. Some info info about the
          build target is still hardwired, but I've tried to contain
          most of it to a single module, TargetRegs.
        
        - Moved the SPILL and RELOAD instructions into LiveInstr.
        
        - Reg and RegClass now have their own modules, and are shared
          across all architectures.
      b04a210e