1. 25 Jul, 2005 2 commits
  2. 21 May, 2005 1 commit
  3. 22 Apr, 2005 1 commit
    • simonmar's avatar
      [project @ 2005-04-22 09:32:39 by simonmar] · 0f3205e6
      simonmar authored
      SMP: the rest of the changes to support safe thunk entry & updates.  I
      thought the compiler changes were independent, but I ended up breaking
      the HEAD, so I'll have to commit the rest.  non-SMP compilation should
      not be affected.
      0f3205e6
  4. 05 Apr, 2005 2 commits
    • simonmar's avatar
      [project @ 2005-04-05 12:19:54 by simonmar] · 16214216
      simonmar authored
      Some multi-processor hackery, including
      
        - Don't hang blocked threads off BLACKHOLEs any more, instead keep
          them all on a separate queue which is checked periodically for
          threads to wake up.
      
          This is good because (a) we don't have to worry about locking the
          closure in SMP mode when we want to block on it, and (b) it means
          the standard update code doesn't need to wake up any threads or
          check for a BLACKHOLE_BQ, simplifying the update code.
      
          The downside is that if there are lots of threads blocked on
          BLACKHOLEs, we might have to do a lot of repeated list traversal.
          We don't expect this to be common, though.  conc023 goes slower
          with this change, but we expect most programs to benefit from the
          shorter update code.
      
        - Fixing up the Capability code to handle multiple capabilities (SMP
          mode), and related changes to get the SMP mode at least building.
      16214216
    • simonmar's avatar
      [project @ 2005-04-05 09:30:11 by simonmar] · b0ac0f91
      simonmar authored
      printf format type fixup
      b0ac0f91
  5. 27 Mar, 2005 1 commit
    • panne's avatar
      [project @ 2005-03-27 13:41:13 by panne] · 03dc2dd3
      panne authored
      * Some preprocessors don't like the C99/C++ '//' comments after a
        directive, so use '/* */' instead. For consistency, a lot of '//' in
        the include files were converted, too.
      
      * UnDOSified libraries/base/cbits/runProcess.c.
      
      * My favourite sport: Killed $Id$s.
      03dc2dd3
  6. 10 Feb, 2005 1 commit
    • simonmar's avatar
      [project @ 2005-02-10 13:01:52 by simonmar] · e7c3f957
      simonmar authored
      GC changes: instead of threading old-generation mutable lists
      through objects in the heap, keep it in a separate flat array.
      
      This has some advantages:
      
        - the IND_OLDGEN object is now only 2 words, so the minimum
          size of a THUNK is now 2 words instead of 3.  This saves
          some amount of allocation (about 2% on average according to
          my measurements), and is more friendly to the cache by
          squashing objects together more.
      
        - keeping the mutable list separate from the IND object
          will be necessary for our multiprocessor implementation.
      
        - removing the mut_link field makes the layout of some objects
          more uniform, leading to less complexity and special cases.
      
        - I also unified the two mutable lists (mut_once_list and mut_list)
          into a single mutable list, which lead to more simplifications
          in the GC.
      e7c3f957
  7. 10 Nov, 2004 1 commit
  8. 12 Sep, 2004 1 commit
  9. 03 Sep, 2004 1 commit
    • simonmar's avatar
      [project @ 2004-09-03 15:28:18 by simonmar] · 95ca6bff
      simonmar authored
      Cleanup: all (well, most) messages from the RTS now go through the
      functions in RtsUtils: barf(), debugBelch() and errorBelch().  The
      latter two were previously called belch() and prog_belch()
      respectively.  See the comments for the right usage of these message
      functions.
      
      One reason for doing this is so that we can avoid spurious uses of
      stdout/stderr by Haskell apps on platforms where we shouldn't be using
      them (eg. non-console apps on Windows).
      95ca6bff
  10. 13 Aug, 2004 1 commit
  11. 11 May, 2004 1 commit
  12. 19 Mar, 2004 1 commit
    • panne's avatar
      [project @ 2004-03-19 23:20:20 by panne] · 9b5e0886
      panne authored
      Fixed  the JOB line in heap  profiles, it contained superfluous spaces
      and an evil line break.
      
      Merge to STABLE
      (This fix looks quite right, but again, I leave this to the Master of
      Releases (tm), because there might already be tools depending on the
      slightly wrong old format.)
      9b5e0886
  13. 12 Nov, 2003 1 commit
    • sof's avatar
      [project @ 2003-11-12 17:49:05 by sof] · 20593d1d
      sof authored
      Tweaks to have RTS (C) sources compile with MSVC. Apart from wibbles
      related to the handling of 'inline', changed Schedule.h:POP_RUN_QUEUE()
      not to use expression-level statement blocks.
      20593d1d
  14. 24 Oct, 2003 1 commit
  15. 23 Sep, 2003 1 commit
    • simonmar's avatar
      [project @ 2003-09-23 15:38:35 by simonmar] · 76ebf3dc
      simonmar authored
      Add a BF_PINNED block flag, and attach it to blocks containing pinned
      objects (in addition to the usual BF_LARGE).
      
      In heapCensus, we now ignore blocks containing pinned objects, because
      they might contain gaps, and in any case it isn't clear that we want
      to include the whole block in a heap census, because much of it might
      well be dead.  Ignoring it isn't right either, though, so this patch
      just fixes the crash and leaves a ToDo.
      76ebf3dc
  16. 22 Aug, 2003 1 commit
    • sof's avatar
      [project @ 2003-08-22 22:24:12 by sof] · cffcb52b
      sof authored
      setupRtsFlags(): don't overwrite argv[0] with its basename:
         - argv[] may not point to writeable memory
         - System.Environment.getProgName strips off the 'dirname' portion
           anyway.
         - Not possible to get at the untransformed argv[0] from
           Haskell code, should such a need arise.
      
      Uses of prog_argv[0] within the RTS has now been replaced with prog_name,
      which is the basename of prog_argv[0].
      cffcb52b
  17. 16 May, 2003 1 commit
  18. 24 Mar, 2003 1 commit
    • simonmar's avatar
      [project @ 2003-03-24 14:46:53 by simonmar] · b3f53081
      simonmar authored
      Fix some bugs in compacting GC.
      
      Bug 1: When threading the fields of an AP or PAP, we were grabbing the
      info table of the function without unthreading it first.
      
      Bug 2: eval_thunk_selector() might accidentally find itself in
      to-space when going through indirections in a compacted generation.
      We must check for this case and bale out if necessary.
      
      Bug 3: This is somewhat more nasty.  When we have an AP or PAP that
      points to a BCO, the layout info for the AP/PAP is in the BCO's
      instruction array, which is two objects deep from the AP/PAP itself.
      The trouble is, during compacting GC, we can only safely look one
      object deep from the current object, because pointers from objects any
      deeper might have been already updated to point to their final
      destinations.
      
      The solution is to put the arity and bitmap info for a BCO into the
      BCO object itself.  This means BCOs become variable-length, which is a
      slight annoyance, but it also means that looking up the arity/bitmap
      is quicker.  There is a slight reduction in complexity in the byte
      code generator due to not having to stuff the bitmap at the front of
      the instruction stream.
      b3f53081
  19. 18 Mar, 2003 1 commit
    • simonmar's avatar
      [project @ 2003-03-18 14:36:56 by simonmar] · 428c025e
      simonmar authored
      Fix a profiling crash on Windows.
      
      fprint_ccs used snprintf() to avoid overflowing a buffer; on mingw32
      where snprintf() doesn't exist we were just using the straight
      sprintf(), which inevitably lead to a crash.  Rewritten to use a
      homegrown non-overflowing string copying function - it actually looks
      nicer now, anwyay.
      428c025e
  20. 20 Feb, 2003 1 commit
    • simonmar's avatar
      [project @ 2003-02-20 15:39:59 by simonmar] · 51a1c2a2
      simonmar authored
      closureSatisfiesConstraints: check whether the retainer set is valid
      before attempting to match it against a constraint.  It might not be
      valid if the object is an ex-weak-pointer which was finalized after
      the last GC.
      
      MERGE TO STABLE
      51a1c2a2
  21. 23 Jan, 2003 2 commits
    • simonmar's avatar
      [project @ 2003-01-23 16:39:30 by simonmar] · e989066d
      simonmar authored
      Fix compilation with DEBUG
      e989066d
    • simonmar's avatar
      [project @ 2003-01-23 12:13:10 by simonmar] · 70c1ca01
      simonmar authored
      - Add a new flag, -xt, which enables inclusion of TSOs in a heap profile.
      
      - Include large objects in heap profiles (except TSOs unless the -xt flag
        is given).
      
      - In order to make this work, I had to set the bd->free field of the
        block descriptor for a large object to the correct value.  Previously,
        it pointed to the start of the block (i.e. the same as bd->start).
        I hope this doesn't have any other consequences; it looks more
        correct this way in any case.
      70c1ca01
  22. 11 Dec, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-12-11 15:36:20 by simonmar] · 0bffc410
      simonmar authored
      Merge the eval-apply-branch on to the HEAD
      ------------------------------------------
      
      This is a change to GHC's evaluation model in order to ultimately make
      GHC more portable and to reduce complexity in some areas.
      
      At some point we'll update the commentary to describe the new state of
      the RTS.  Pending that, the highlights of this change are:
      
        - No more Su.  The Su register is gone, update frames are one
          word smaller.
      
        - Slow-entry points and arg checks are gone.  Unknown function calls
          are handled by automatically-generated RTS entry points (AutoApply.hc,
          generated by the program in utils/genapply).
      
        - The stack layout is stricter: there are no "pending arguments" on
          the stack any more, the stack is always strictly a sequence of
          stack frames.
      
          This means that there's no need for LOOKS_LIKE_GHC_INFO() or
          LOOKS_LIKE_STATIC_CLOSURE() any more, and GHC doesn't need to know
          how to find the boundary between the text and data segments (BIG WIN!).
      
        - A couple of nasty hacks in the mangler caused by the neet to
          identify closure ptrs vs. info tables have gone away.
      
        - Info tables are a bit more complicated.  See InfoTables.h for the
          details.
      
        - As a side effect, GHCi can now deal with polymorphic seq.  Some bugs
          in GHCi which affected primitives and unboxed tuples are now
          fixed.
      
        - Binary sizes are reduced by about 7% on x86.  Performance is roughly
          similar, some programs get faster while some get slower.  I've seen
          GHCi perform worse on some examples, but haven't investigated
          further yet (GHCi performance *should* be about the same or better
          in theory).
      
        - Internally the code generator is rather better organised.  I've moved
          info-table generation from the NCG into the main codeGen where it is
          shared with the C back-end; info tables are now emitted as arrays
          of words in both back-ends.  The NCG is one step closer to being able
          to support profiling.
      
      This has all been fairly thoroughly tested, but no doubt I've messed
      up the commit in some way.
      0bffc410
  23. 01 Nov, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-11-01 11:05:46 by simonmar] · 6226441f
      simonmar authored
      Fix the heapCensus crash.
      
      It turned out that after a GC, the small_alloc_list might be non-empty
      if a new finalizer thread had been started.  The last block on
      small_alloc_list doesn't have the free pointer set correctly (as a
      small optimisation, we don't normally set the free pointer after each
      allocation, only when the block is full).  The result was that the
      free pointer contains the wrong value, and the heap census traverses
      garbage.  The fix is to set the free pointer correctly before
      traversing small_alloc_list.
      
      The bug doesn't show up when DEBUG is on, because extra DEBUG checks
      cause the free pointer to be initialised to a sensible(-ish) value.
      Hence my difficulty in reproducing the bug.
      
      To reproduce: compile ghc-regress/lib/should_run/memo002 with
      profiling and run it with a sufficiently small sample interval (-i0.02
      did it for me).
      
      Thanks to the kind folks at ARM for helping out with the debugging of
      this one.
      
      MERGE TO STABLE
      6226441f
  24. 16 Aug, 2002 1 commit
  25. 18 Jul, 2002 1 commit
  26. 07 May, 2002 1 commit
  27. 12 Dec, 2001 3 commits
    • simonmar's avatar
      [project @ 2001-12-12 15:59:33 by simonmar] · 7738ad97
      simonmar authored
      Include the CCS ID in the heap profile, so you can find the full CCS
      description in <foo>.prof or the XML profile output.
      7738ad97
    • simonmar's avatar
      [project @ 2001-12-12 15:01:25 by simonmar] · 8098d689
      simonmar authored
      Fix a couple of assertions.
      8098d689
    • simonmar's avatar
      [project @ 2001-12-12 14:31:42 by simonmar] · 55c8be52
      simonmar authored
      - Add a new type of restriction: -hC, which restricts to closures
        whose CCS contains the specified CCs *anywhere* (not just at the
        top).
      
      - Complain if the user tries to request both retainer and biographical
        profiling.  We don't support both simultaneously, because they use
        the same header word in the closure.
      
      - Allow for the fact that the heap might contain some closures which
        don't have a valid retainer set during the heap census.  The only
        known closures of this kind so far are DEAD_WEAK closures.
      
      - Some cruft-removal and renaming of functions to follow conventions.
      55c8be52
  28. 29 Nov, 2001 1 commit
    • simonmar's avatar
      [project @ 2001-11-29 16:38:13 by simonmar] · b560e2a5
      simonmar authored
      Fix for heap profiling when selecting by lag/drag/void/use: I forgot
      to make the final LdvCensusKillAll() call just before outputing the
      census info.
      
      Having tested this stuff on the compiler itself, I now declare it to
      be working (famous last words!).
      b560e2a5
  29. 28 Nov, 2001 3 commits
    • simonmar's avatar
      [project @ 2001-11-28 17:45:13 by simonmar] · 20977132
      simonmar authored
      oops, I broke standard -hb profiles.  Unbreak them again.
      20977132
    • simonmar's avatar
      [project @ 2001-11-28 15:43:23 by simonmar] · f1829925
      simonmar authored
      Make it work in a DEBUG world again (when DEBUG is on we have ancient
      support for doing a heap profile based on info-tables - it is still
      there, but I haven't tested it).
      f1829925
    • simonmar's avatar
      [project @ 2001-11-28 15:01:02 by simonmar] · 6313b907
      simonmar authored
      As promised: allow selecting by lag, drag, void or use.  Currently
      this involves keeping around all the information about previous
      censuses, so memory use could get quite large.  If this turns out to
      be a problem, then we have a plan to throw away some of the info after
      each census.
      6313b907
  30. 27 Nov, 2001 1 commit
  31. 26 Nov, 2001 1 commit
    • simonmar's avatar
      [project @ 2001-11-26 16:54:21 by simonmar] · dbef766c
      simonmar authored
      Profiling cleanup.
      
      This commit eliminates some duplication in the various heap profiling
      subsystems, and generally centralises much of the machinery.  The key
      concept is the separation of a heap *census* (which is now done in one
      place only instead of three) from the calculation of retainer sets.
      Previously the retainer profiling code also did a heap census on the
      fly, and lag-drag-void profiling had its own census machinery.
      
      Value-adds:
      
         - you can now restrict a heap profile to certain retainer sets,
           but still display by cost centre (or type, or closure or
           whatever).
      
         - I've added an option to restrict the maximum retainer set size
           (+RTS -R<size>, defaulting to 8).
      
         - I've cleaned up the heap profiling options at the request of
           Simon PJ.  See the help text for details.  The new scheme
           is backwards compatible with the old.
      
         - I've removed some odd bits of LDV or retainer profiling-specific
           code from various parts of the system.
      
         - the time taken doing heap censuses (and retainer set calculation)
           is now accurately reported by the RTS when you say +RTS -Sstderr.
      
      Still to come:
      
         - restricting a profile to a particular biography
           (lag/drag/void/use).  This requires keeping old heap censuses
           around, but the infrastructure is now in place to do this.
      dbef766c
  32. 22 Nov, 2001 1 commit
    • simonmar's avatar
      [project @ 2001-11-22 14:25:11 by simonmar] · db61851c
      simonmar authored
      Retainer Profiling / Lag-drag-void profiling.
      
      This is mostly work by Sungwoo Park, who spent a summer internship at
      MSR Cambridge this year implementing these two types of heap profiling
      in GHC.
      
      Relative to Sungwoo's original work, I've made some improvements to
      the code:
      
         - it's now possible to apply constraints to retainer and LDV profiles
           in the same way as we do for other types of heap profile (eg.
           +RTS -hc{foo,bar} -hR -RTS gives you a retainer profiling considering
           only closures with cost centres 'foo' and 'bar').
      
         - the heap-profile timer implementation is cleaned up.
      
         - heap profiling no longer has to be run in a two-space heap.
      
         - general cleanup of the code and application of the SDM C coding
           style guidelines.
      
      Profiling will be a little slower and require more space than before,
      mainly because closures have an extra header word to support either
      retainer profiling or LDV profiling (you can't do both at the same
      time).
      
      We've used the new profiling tools on GHC itself, with moderate
      success.  Fixes for some space leaks in GHC to follow...
      db61851c
  33. 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