1. 28 Nov, 2001 7 commits
    • 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.
    • simonmar's avatar
      [project @ 2001-11-28 14:55:34 by simonmar] · 3c22fb21
      simonmar authored
      The curly braces around heap profile selectors are now optional (and
      Two reasons: having to quote the options is a real PITA and gets even
      worse when trying to use them from a Makefile, and this also brings us
      closer to nhc's option format.
    • simonmar's avatar
      [project @ 2001-11-28 14:47:54 by simonmar] · 4746806f
      simonmar authored
      Cross fingers and remove code that zeroes the nursery when doing LDV
      profiling.  This was required for two reasons:
        - the compiler might leave slop between objects when it is
          allocating.  However, it doesn't do this any more: we always
          move the heap pointer back at the end of a basic block if it
          turns out we didn't need all the heap,
        - After a heap check failure, we don't know what the previous
          value of Hp was, so we don't know where the end of the real
          data in the current nursery block is.
          This isn't the case any more, because as a side effect of the
          fixes to support big-block allocation we always shift Hp back
          by the required amount after a heap check failure, so now
          bd->free always points to the byte after the last allocated
          byte in a nursery block.
    • simonmar's avatar
      [project @ 2001-11-28 14:31:27 by simonmar] · 4321b113
      simonmar authored
      Revert previous commit:  I accidentally committed my local version of
      this file which has BLOCK_SIZE set to 2k rather than 4k (for testing).
    • simonmar's avatar
      [project @ 2001-11-28 14:30:32 by simonmar] · 117bf3f0
      simonmar authored
      Add a non-inline version of Bdescr() for use in gdb.
    • simonmar's avatar
      [project @ 2001-11-28 14:29:59 by simonmar] · 652b549f
      simonmar authored
      Don't close the stats file if it is stderr.
    • simonmar's avatar
      [project @ 2001-11-28 14:29:33 by simonmar] · 46eb785a
      simonmar authored
      oops!  There's a hand-written magic heap check in stg_update_PAP that
      I missed when I did the recent HpAlloc changes to fix the big block
      alloc problem.  Also remove a redundant comment about LDV profiling,
      and a redundant #ifdef.
  2. 27 Nov, 2001 13 commits
  3. 26 Nov, 2001 15 commits
    • sof's avatar
      [project @ 2001-11-26 23:56:04 by sof] · 343b371a
      sof authored
      have happy-inplace rule depend on glafp-utils/
    • sof's avatar
      [project @ 2001-11-26 23:55:27 by sof] · b5cfaf64
      sof authored
      make it work on non-mingw platforms
    • sof's avatar
      [project @ 2001-11-26 20:04:00 by sof] · 9746e23a
      sof authored
      Make the IO implementation work with WinSock once again.
      When creating sockets with WinSock, you don't get back
      a file descriptor, but a SOCKET (which just so happens
      to map to the same type as a 'normal' file descriptor).
      This SOCKET value cannot be used with the CRT ops
      read(), write(), close(), but you have to use the
      socket-specific operations (recv(), send(), and closesocket(),
      respectively) instead.
      To keep track of this distinction between file and
      socket file descriptors, the following changes were
      * a Handle__ has got a new field, haIsStream, which is True
        for sockets / streams.
        (this field is essentially unused in non-Win32 settings,
         but I decided not to conditionalise its presence).
      * PrelHandle.openFd now takes an extra (Maybe FDType) argument,
        which lets you force what type of FD we're converting into
        a Handle (this is crucial for WinSock SOCKETs, since we don't
        want to attempt fstat()ing them).
      Fixes breakage that was introduced with May 2001 (or earlier)
      rewrite of the IO layer. This commit build upon recent IO changes
      to HEAD, so merging it to STABLE will require importing those
      changes too (I'll let others be the judge whether this should
      be done or not).
    • sof's avatar
      [project @ 2001-11-26 19:43:23 by sof] · 254849fc
      sof authored
      win32 only - provide closeFd, which closes a file descriptor, be it of
      file or socket ilk.
    • 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.
         - you can now restrict a heap profile to certain retainer sets,
           but still display by cost centre (or type, or closure or
         - 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.
    • sof's avatar
      [project @ 2001-11-26 16:37:33 by sof] · 5680ea4b
      sof authored
      fdType: clarify that this op will fail with non-file handles/descriptors
              under Win32.
    • simonmar's avatar
      [project @ 2001-11-26 13:06:49 by simonmar] · 18ea22a1
      simonmar authored
      Use an arena internally to allocate hash bucket cells instead of the
      current home-brewed combination of malloc/free and a free list.
      We still allocate hash table segments using malloc/free because these
      are large (4k by default) and might interact badly with the blockish
      nature of the arena allocator.
    • simonpj's avatar
      [project @ 2001-11-26 12:58:17 by simonpj] · d6181fe1
      simonpj authored
      In the Win32 build, don't call initProfTimer unless PROFILING
      is on.  This mirrors the Unix deal.   Indeed initProfTimer
      isn't defined if PROFILING is on.
      I don't know how this works for anyone else on Win32!
      Sigbjorn: have I done this right, or am I misunderstanding?
    • simonpj's avatar
      [project @ 2001-11-26 10:33:40 by simonpj] · 5a1ac8dc
      simonpj authored
      Complete previous tcAddImportedIdInfo commit
    • simonpj's avatar
      [project @ 2001-11-26 10:30:15 by simonpj] · aa2901f9
      simonpj authored
      Improve error reporting
    • simonpj's avatar
      [project @ 2001-11-26 10:27:14 by simonpj] · eb06b89f
      simonpj authored
      Comments only
    • simonpj's avatar
      [project @ 2001-11-26 10:26:59 by simonpj] · 1fdd97b6
      simonpj authored
      	Finally get rid of tcAddImportedIdInfo
      TcEnv.tcAddImportedIdInfo is a notorious source of space leaks.
      Simon M got rid of the need for it on default methods.
      This commit gets rid of the need for it for dictionary function Ids,
      and finally nukes the beast altogether. Hurrah!
      The change really involves putting tcInterfaceSigs *before*
      tcInstDecls1, so that any imported DFunIds are in the typechecker's
      environment before we get to tcInstDecls.
    • simonpj's avatar
      [project @ 2001-11-26 09:22:05 by simonpj] · 0760818e
      simonpj authored
      Add missing files for Rank-N commit
    • simonpj's avatar
      [project @ 2001-11-26 09:20:25 by simonpj] · 5e3f005d
      simonpj authored
      	Implement Rank-N types
      This commit implements the full glory of Rank-N types, using
      the Odersky/Laufer approach described in their paper
      	"Putting type annotations to work"
      In fact, I've had to adapt their approach to deal with the
      full glory of Haskell (including pattern matching, and the
      scoped-type-variable extension).  However, the result is:
      * There is no restriction to rank-2 types.  You can nest forall's
        as deep as you like in a type.  For example, you can write a type
      	p :: ((forall a. Eq a => a->a) -> Int) -> Int
        This is a rank-3 type, illegal in GHC 5.02
      * When matching types, GHC uses the cunning Odersky/Laufer coercion
        rules.  For example, suppose we have
      	q :: (forall c. Ord c => c->c) -> Int
        Then, is this well typed?
      	x :: Int
      	x = p q
        Yes, it is, but GHC has to generate the right coercion.  Here's
        what it looks like with all the big lambdas and dictionaries put in:
      	x = p (\ f :: (forall a. Eq a => a->a) ->
      		 q (/\c \d::Ord c -> f c (eqFromOrd d)))
        where eqFromOrd selects the Eq superclass dictionary from the Ord
        dicationary:		eqFromOrd :: Ord a -> Eq a
      * You can use polymorphic types in pattern type signatures.  For
      	f (g :: forall a. a->a) = (g 'c', g True)
        (Previously, pattern type signatures had to be monotypes.)
      * The basic rule for using rank-N types is that you must specify
        a type signature for every binder that you want to have a type
        scheme (as opposed to a plain monotype) as its type.
        However, you don't need to give the type signature on the
        binder (as I did above in the defn for f).  You can give it
        in a separate type signature, thus:
      	f :: (forall a. a->a) -> (Char,Bool)
      	f g = (g 'c', g True)
        GHC will push the external type signature inwards, and use
        that information to decorate the binders as it comes across them.
        I don't have a *precise* specification of this process, but I
        think it is obvious enough in practice.
      * In a type synonym you can use rank-N types too.  For example,
        you can write
      	type IdFun = forall a. a->a
      	f :: IdFun -> (Char,Bool)
      	f g = (g 'c', g True)
        As always, type synonyms must always occur saturated; GHC
        expands them before it does anything else.  (Still, GHC goes
        to some trouble to keep them unexpanded in error message.)
      The main plan is as before.  The main typechecker for expressions,
      tcExpr, takes an "expected type" as its argument.  This greatly
      improves error messages.  The new feature is that when this
      "expected type" (going down) meets an "actual type" (coming up)
      we use the new subsumption function
      which checks that the actual type can be coerced into the
      expected type (and produces a coercion function to demonstrate).
      The main new chunk of code is TcUnify.tcSub.  The unifier itself
      is unchanged, but it has moved from TcMType into TcUnify.  Also
      checkSigTyVars has moved from TcMonoType into TcUnify.
      Result: the new module, TcUnify, contains all stuff relevant
      to subsumption and unification.
      Unfortunately, there is now an inevitable loop between TcUnify
      and TcSimplify, but that's just too bad (a simple TcUnify.hi-boot
      All of this doesn't come entirely for free.  Here's the typechecker
      line count (INCLUDING comments)
      	Before	16,551
      	After	17,116
    • chak's avatar
      [project @ 2001-11-26 08:31:05 by chak] · f5a6b456
      chak authored
      Added a new section that describes how GHC defines its hardwired knowledge
      about primitives and special prelude definitions.
  4. 25 Nov, 2001 3 commits
    • sof's avatar
      [project @ 2001-11-25 16:59:11 by sof] · 2b8262a3
      sof authored
      Tidyup - only declare&use half-a-dozen prof-only global variables
      when PROFILING.
    • sof's avatar
      [project @ 2001-11-25 16:57:38 by sof] · a412def3
      sof authored
      Retainer/LDV changes.
      The recent prof-related commit forgot to include RtsFlags.h, methinks.
      But, modulo trivia, I'm reasonably sure that this commit mirrors
      whatever mods that unchecked-in file contains.
    • sof's avatar
      [project @ 2001-11-25 03:56:39 by sof] · 502a4dc8
      sof authored
      extend the scope of the doNothing() macro; can now be used in Stg headers
  5. 23 Nov, 2001 2 commits