1. 02 Dec, 2011 2 commits
    • Simon Marlow's avatar
      More changes aimed at improving call stacks. · 1469f1eb
      Simon Marlow authored
        - Attach a SrcSpan to every CostCentre.  This had the side effect
          that CostCentres that used to be merged because they had the same
          name are now considered distinct; so I had to add a Unique to
          CostCentre to give them distinct object-code symbols.
      
        - New flag: -fprof-auto-calls.  This flag adds an automatic SCC to
          every call site (application, to be precise).  This is typically
          more useful for call stacks than annotating whole functions.
      
      Various tidy-ups at the same time: removed unused NoCostCentre
      constructor, and refactored a bit in Coverage.lhs.
      
      The call stack we get from traceStack now looks like this:
      
      Stack trace:
        Main.CAF (<entire-module>)
        Main.main.xs (callstack002.hs:18:12-24)
        Main.map (callstack002.hs:13:12-16)
        Main.map.go (callstack002.hs:15:21-34)
        Main.map.go (callstack002.hs:15:21-23)
        Main.f (callstack002.hs:10:7-43)
      1469f1eb
    • Simon Marlow's avatar
      remove unused coreExprCc · 6f4bde14
      Simon Marlow authored
      6f4bde14
  2. 30 Nov, 2011 4 commits
    • Ian Lynagh's avatar
      Fix parsing of OPTIONS*/LANGUAGE pragmas in haddock mode · b3e30449
      Ian Lynagh authored
      When getting options from basicTypes/RdrName.lhs, we were seeing
      text like "-- |\n-- ...\n" in the buffer, and lexer then recognises
      "-- |\n-- ..." as a complete ITdocCommentNext token, with the end of
      the buffer not reached.
      
      Next time round, when we get more input into the buffer, it started
      "\n-- * 'Var.Var': see", so the lexer gave us an ITdocSection token.
      
      However, getOptions' only knew about ITdocCommentNext, and so it
      stopped at that point, and didn't see the pragmas further down the file.
      This caused the build to fail due to -fwarn-tabs not being turned off.
      
      But actually, we don't really want the haddock docs at this point, so
      now we just unset Opt_Haddock in getOptionsFromFile.
      b3e30449
    • Simon Marlow's avatar
      Include a stack trace in the panic message, when GHC is compiled profiled. · f85c084c
      Simon Marlow authored
      I tried this out on the panic we're currently getting for #3103:
      
      ghc-stage2: panic! (the 'impossible' happened)
        (GHC version 7.3.20111128 for x86_64-unknown-linux):
              tcIfaceGlobal (local): not found:
          base:GHC.Word.W#{d 6w}
          [(32R, Type constructor `base:GHC.Word.Word{tc 32R}'),
           (r6O, Identifier `base:GHC.Word.$fNumWord{v r6O}'),
           (r6P, Identifier `base:GHC.Word.$fEqWord{v r6P}'),
           (r6Q, Identifier `base:GHC.Word.$fNumWord1{v r6Q}'),
           (r6R, Identifier `base:GHC.Word.$fNumWord2{v r6R}'),
           (r6S, Data constructor `base:GHC.Word.W#{d r6S}'),
           (r6U, Identifier `base:GHC.Word.W#{v r6U}'),
           (r75, Identifier `base:GHC.Word.$fNumWord_$csignum{v r75}'),
           (r76, Identifier `base:GHC.Word.$fEqWord_$c/={v r76}'),
           (r77, Identifier `base:GHC.Word.$fEqWord_$c=={v r77}')]
      { Main.main
         GHC.defaultErrorHandler
          GHC.runGhc
           GhcMonad.>>=
            GhcMonad.>>=.\
             Main.main'
              Main.doMake
               GhcMake.load
                GhcMake.load2
                 GhcMake.upsweep
                  GhcMake.upsweep.upsweep'
                   GhcMake.reTypecheckLoop
                    GhcMake.typecheckLoop
                     GhcMake.typecheckLoop.\
                      TcRnMonad.initIfaceCheck
                       TcRnMonad.initTcRnIf
                        IOEnv.runIOEnv
                         IOEnv.thenM
                          IOEnv.thenM.\
                           TcIface.typecheckIface
                            TcIface.typecheckIface.\
                             LoadIface.loadDecls
                              LoadIface.loadDecl
                               TcIface.tcIfaceDecl
                                TcIface.tc_iface_decl
                                 TcIface.tcIdInfo
                                  MonadUtils.foldlM
                                   TcIface.tcIdInfo.tcPrag
                                    TcIface.tcUnfolding
                                     TcIface.tcPragExpr
                                      TcIface.tcIfaceExpr
                                       TcIface.tcIfaceAlt
                                        TcIface.tcIfaceDataCon }
      f85c084c
    • Simon Marlow's avatar
      Further tweaks to the ccs primops · 1fc25dfd
      Simon Marlow authored
       - add getCCSOf# :: a -> State# s -> (# State# s, Addr# #)
         (returns the CCS attached to the supplied object)
      
       - remove traceCcs# (obsoleted by getCCSOf#)
      
       - rename getCCCS# to getCurrentCCS#
      1fc25dfd
    • Simon Marlow's avatar
      remove obsolete notes (#5660) · b35a12aa
      Simon Marlow authored
      b35a12aa
  3. 29 Nov, 2011 8 commits
    • dimitris's avatar
      e4d87e14
    • Simon Peyton Jones's avatar
      Refactor (again) the treatment of record-selector bindings · ac11b1f1
      Simon Peyton Jones authored
      We were generating them from the tcg_tcs field of the TcGblEnv,
      but that goes badly wrong when there are top-level Template
      Haskell splices, because the tcg_tcs field grows successively.
      If we generate record-selector binds for all the TyCons in the
      accumulated list, we generate them multiple times for TyCons
      earlier in the program.  This what was happening in Trac #5665:
        data T = T { x :: Int }
        $(f 4)  -- Top level splice
        ..more code..
      Here the record selector bindings for T were being generated
      twice.
      
      Better instead to generate the record-selector bindings in
      TcTyClsDecls, right where the new TyCons are being declared (as indeed
      they were some time ago).  This pushed me into doing some refactoring:
      instead of returning the record bindings, tcTyAndClassDecls adds them
      to the tcg_binds field of the TcGblEnv.  I think the result is a bit
      nicer, and it has the additional merit of working.
      ac11b1f1
    • Simon Marlow's avatar
      Add a new primop: getCCCS# :: State# s -> (# State# s, Addr# #) · 1f7433b7
      Simon Marlow authored
      Returns a pointer to the current cost-centre stack when profiling,
      NULL otherwise.
      1f7433b7
    • Simon Marlow's avatar
      Make profiling work with multiple capabilities (+RTS -N) · 50de6034
      Simon Marlow authored
      This means that both time and heap profiling work for parallel
      programs.  Main internal changes:
      
        - CCCS is no longer a global variable; it is now another
          pseudo-register in the StgRegTable struct.  Thus every
          Capability has its own CCCS.
      
        - There is a new built-in CCS called "IDLE", which records ticks for
          Capabilities in the idle state.  If you profile a single-threaded
          program with +RTS -N2, you'll see about 50% of time in "IDLE".
      
        - There is appropriate locking in rts/Profiling.c to protect the
          shared cost-centre-stack data structures.
      
      This patch does enough to get it working, I have cut one big corner:
      the cost-centre-stack data structure is still shared amongst all
      Capabilities, which means that multiple Capabilities will race when
      updating the "allocations" and "entries" fields of a CCS.  Not only
      does this give unpredictable results, but it runs very slowly due to
      cache line bouncing.
      
      It is strongly recommended that you use -fno-prof-count-entries to
      disable the "entries" count when profiling parallel programs. (I shall
      add a note to this effect to the docs).
      50de6034
    • Simon Peyton Jones's avatar
      White space only · e332180e
      Simon Peyton Jones authored
      e332180e
    • Simon Marlow's avatar
      Get rid of the "safety" field of CmmCall (OldCmm) · cbe24168
      Simon Marlow authored
      This field was doing nothing.  I think it originally appeared in a
      very old incarnation of the new code generator.
      cbe24168
    • Simon Peyton Jones's avatar
      Switch around the order of guards in exprIsConApp_maybe · 9ad4f0b9
      Simon Peyton Jones authored
      This is a vital wibble to:
       f7cf3dcd * Be a bit less gung-ho in exprIsConApp_maybe
      9ad4f0b9
    • dimitris's avatar
      Reintroducing isReflCo optimization: invariant · 4aa0a2d8
      dimitris authored
      that evVarPred.cc_id must be equal to ctPred
      needs no longer be true.
      4aa0a2d8
  4. 28 Nov, 2011 8 commits
  5. 27 Nov, 2011 3 commits
  6. 26 Nov, 2011 8 commits
  7. 25 Nov, 2011 6 commits
  8. 24 Nov, 2011 1 commit
    • Simon Marlow's avatar
      Relax the restriction on using abstract newtypes in FFI declarations. · c6b0fd62
      Simon Marlow authored
      Given the high impact of this change, we decided to back off and make
      abstract newtypes give a warning for one release, before we make it an
      error in 7.6.1.
      
      Codec/Compression/Zlib/Stream.hsc:884:1:
          Warning: newtype `CInt' is used in an FFI declaration,
                   but its constructor is not in scope.
                   This will become an error in GHC 7.6.1.
          When checking declaration:
            foreign import ccall unsafe "static zlib.h deflate" c_deflate
              :: StreamState -> CInt -> IO CInt
      c6b0fd62