1. 22 Nov, 2002 2 commits
  2. 21 Nov, 2002 2 commits
  3. 20 Nov, 2002 1 commit
  4. 17 Nov, 2002 1 commit
    • panne's avatar
      [project @ 2002-11-17 15:27:07 by panne] · 7e63e7e6
      panne authored
      Added RTS entry points as mandated by the FFI addendum to the Haskell
      98 report. NOTE: The implementations of hs_init, hs_exit, and
      hs_set_argv are still missing.
      7e63e7e6
  5. 07 Nov, 2002 1 commit
  6. 05 Nov, 2002 3 commits
  7. 01 Nov, 2002 3 commits
    • simonmar's avatar
      [project @ 2002-11-01 11:17:29 by simonmar] · 9bffc64e
      simonmar authored
      warning police: #include <string.h> to get proto for strlen()
      9bffc64e
    • simonmar's avatar
      [project @ 2002-11-01 11:16:33 by simonmar] · cbe4e8ae
      simonmar authored
      total_alloc should be a 64-bit couunter.
      
      MERGE TO STABLE
      cbe4e8ae
    • 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
  8. 27 Oct, 2002 1 commit
    • wolfgang's avatar
      [project @ 2002-10-27 21:46:27 by wolfgang] · 80498a8a
      wolfgang authored
      For Mac OS X, use the underlying Mach Microkernel calls instead of mmap.
      Darwin's mmap doesn't honor the passed-in address without MAP_FIXED,
      and MAP_FIXED replaces all existing mappings, so it can't be used.
      80498a8a
  9. 25 Oct, 2002 2 commits
    • simonmar's avatar
      [project @ 2002-10-25 12:56:34 by simonmar] · 24889e6a
      simonmar authored
      We shouldn't be using MAP_FIXED on solaris (fixes last night's crash).
      
      Unfortunately on Solaris the heuristics don't work too well.  Solaris
      seems to ignore the addr argument to mmap when MAP_FIXED is not
      specified, and starts handing out memory from the top of the address
      space.  So we allocate 2M each time and munmap() ends to leave an
      aligned 1M chunk.  This will eventually leave the address space
      completely full of 1M holes.  I don't have a good solution to this at
      the moment.
      
      MERGE TO STABLE
      24889e6a
    • simonmar's avatar
      [project @ 2002-10-25 09:40:47 by simonmar] · 67944e15
      simonmar authored
      In eval_thunk_selector(), don't follow IND_STATICs because they might
      lead us into to-space.  Fixes a case of "EVACUATED object entered!".
      
      Also, add an assertion to catch this bug earlier.
      
      MERGE TO STABLE
      67944e15
  10. 23 Oct, 2002 2 commits
  11. 22 Oct, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-10-22 11:01:18 by simonmar] · b7129526
      simonmar authored
      change the types of cmp_thread, rts_getThreadId, and labelThread to
      take StgPtr rather than StgTSO *, since the compiler now has no
      distinction between these two types in the back end.
      
      I also noticed that labelThread need not be a primitive: it could just
      as well be a normal C function called by the FFI, but I haven't made
      that change.
      b7129526
  12. 21 Oct, 2002 2 commits
    • simonmar's avatar
      [project @ 2002-10-21 12:42:31 by simonmar] · 5cc57129
      simonmar authored
      Turn an instance of 0xfff00000 into ~MBLOCK_MASK in the Win32 code.
      5cc57129
    • simonmar's avatar
      [project @ 2002-10-21 11:38:53 by simonmar] · 2be44cb2
      simonmar authored
      Bite the bullet and generalise the central memory allocation scheme.
      Previously we tried to allocate memory starting from a fixed address,
      which was set for each architecture (0x5000000 was a common one), and
      to decide whether a particular address was in the heap or not we would
      do a simple comparison against this address.
      
      This doesn't work too well, because:
      
       - if we dynamically-load some objects above the boundary, the
         heap-allocated test becomes invalid
      
       - on windows we have less control, and the heap might be
         split into multiple sections
      
       - it turns out that on some Linux kernels we don't get memory where
         we asked for it.  This might be a bug in those kernels, but it
         exposes the fragility of our allocation scheme.
      
      The solution is to bite the bullet and maintain a table mapping
      addresses to a value indicating whether that address is in the heap or
      not.  Since we normally allocate heap in chunks of 1Mb, the table is
      quite small: 4k on a 32-bit machine, using one byte for each 1Mb
      block.  Testing an address for heap residency now involves a memory
      access, but the table is normally cache-resident.  I didn't manage to
      measure any slowdown after making the change.
      
      On a 64-bit machine, we'll need to use a 2-level table; I haven't
      implemented that yet.
      
      Now we can generalise the procedure used to grab memory from the OS.
      In the general case, we allocate one megablock more than we need to,
      and trim off the slop around the allocation to leave an aligned chunk.
      The next time around, however, we try to allocate memory right after
      the last chunk allocated, on the grounds that it is aligned and
      probably free: if this doesn't work, we have to back off to the
      general mechanism (it seems to work most of the time).
      
      This cleans up the Windows story too: is_heap_alloced() has gone, and
      we should be able to handle more than 256M of memory (or whatever the
      arbitrary limit was before).
      
      MERGE TO STABLE (after lots of testing)
      2be44cb2
  13. 18 Oct, 2002 1 commit
  14. 15 Oct, 2002 1 commit
  15. 12 Oct, 2002 1 commit
    • wolfgang's avatar
      [project @ 2002-10-12 23:12:08 by wolfgang] · 31442604
      wolfgang authored
      Make the Mac OS X build use the HaskellSupport.framework (a MacOS-style "framework" that includes the required libraries libgmp and dlcompat) if it is present. The HaskellSupport.framework is not yet in CVS, but is available from me.
      31442604
  16. 05 Oct, 2002 2 commits
  17. 02 Oct, 2002 1 commit
  18. 01 Oct, 2002 1 commit
  19. 25 Sep, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-09-25 14:46:31 by simonmar] · 28e69a6b
      simonmar authored
      Fix a scheduling/GC bug, spotted by Wolfgang Thaller.  If a main
      thread completes, and a GC runs before the return (from rts_evalIO())
      happens, then the thread might be GC'd before we get a chance to
      extract its return value, leading to barf("main thread has been GC'd")
      from the garbage collector.
      
      The fix is to treat all main threads which have completed as roots:
      this is logically the right thing to do, because these threads must be
      retained by virtue of holding the return value, and this is a property of
      main threads only.
      28e69a6b
  20. 18 Sep, 2002 1 commit
  21. 17 Sep, 2002 5 commits
  22. 13 Sep, 2002 1 commit
    • simonpj's avatar
      [project @ 2002-09-13 15:02:25 by simonpj] · 9af77fa4
      simonpj authored
      --------------------------------------
      	Make Template Haskell into the HEAD
      	--------------------------------------
      
      This massive commit transfers to the HEAD all the stuff that
      Simon and Tim have been doing on Template Haskell.  The
      meta-haskell-branch is no more!
      
      WARNING: make sure that you
      
        * Update your links if you are using link trees.
          Some modules have been added, some have gone away.
      
        * Do 'make clean' in all library trees.
          The interface file format has changed, and you can
          get strange panics (sadly) if GHC tries to read old interface files:
          e.g.  ghc-5.05: panic! (the `impossible' happened, GHC version 5.05):
      	  Binary.get(TyClDecl): ForeignType
      
        * You need to recompile the rts too; Linker.c has changed
      
      
      However the libraries are almost unaltered; just a tiny change in
      Base, and to the exports in Prelude.
      
      
      NOTE: so far as TH itself is concerned, expression splices work
      fine, but declaration splices are not complete.
      
      
      		---------------
      		The main change
      		---------------
      
      The main structural change: renaming and typechecking have to be
      interleaved, because we can't rename stuff after a declaration splice
      until after we've typechecked the stuff before (and the splice
      itself).
      
      * Combine the renamer and typecheker monads into one
      	(TcRnMonad, TcRnTypes)
        These two replace TcMonad and RnMonad
      
      * Give them a single 'driver' (TcRnDriver).  This driver
        replaces TcModule.lhs and Rename.lhs
      
      * The haskell-src library package has a module
      	Language/Haskell/THSyntax
        which defines the Haskell data type seen by the TH programmer.
      
      * New modules:
      	hsSyn/Convert.hs 	converts THSyntax -> HsSyn
      	deSugar/DsMeta.hs 	converts HsSyn -> THSyntax
      
      * New module typecheck/TcSplice type-checks Template Haskell splices.
      
      		-------------
      		Linking stuff
      		-------------
      
      * ByteCodeLink has been split into
      	ByteCodeLink	(which links)
      	ByteCodeAsm	(which assembles)
      
      * New module ghci/ObjLink is the object-code linker.
      
      * compMan/CmLink is removed entirely (was out of place)
        Ditto CmTypes (which was tiny)
      
      * Linker.c initialises the linker when it is first used (no need to call
        initLinker any more).  Template Haskell makes it harder to know when
        and whether to initialise the linker.
      
      
      	-------------------------------------
      	Gathering the LIE in the type checker
      	-------------------------------------
      
      * Instead of explicitly gathering constraints in the LIE
      	tcExpr :: RenamedExpr -> TcM (TypecheckedExpr, LIE)
        we now dump the constraints into a mutable varabiable carried
        by the monad, so we get
      	tcExpr :: RenamedExpr -> TcM TypecheckedExpr
      
        Much less clutter in the code, and more efficient too.
        (Originally suggested by Mark Shields.)
      
      
      		-----------------
      		Remove "SysNames"
      		-----------------
      
      Because the renamer and the type checker were entirely separate,
      we had to carry some rather tiresome implicit binders (or "SysNames")
      along inside some of the HsDecl data structures.  They were both
      tiresome and fragile.
      
      Now that the typechecker and renamer are more intimately coupled,
      we can eliminate SysNames (well, mostly... default methods still
      carry something similar).
      
      		-------------
      		Clean up HsPat
      		-------------
      
      One big clean up is this: instead of having two HsPat types (InPat and
      OutPat), they are now combined into one.  This is more consistent with
      the way that HsExpr etc is handled; there are some 'Out' constructors
      for the type checker output.
      
      So:
      	HsPat.InPat	--> HsPat.Pat
      	HsPat.OutPat	--> HsPat.Pat
      	No 'pat' type parameter in HsExpr, HsBinds, etc
      
      	Constructor patterns are nicer now: they use
      		HsPat.HsConDetails
      	for the three cases of constructor patterns:
      		prefix, infix, and record-bindings
      
      	The *same* data type HsConDetails is used in the type
      	declaration of the data type (HsDecls.TyData)
      
      Lots of associated clean-up operations here and there.  Less code.
      Everything is wonderful.
      9af77fa4
  23. 10 Sep, 2002 1 commit
  24. 06 Sep, 2002 2 commits
    • simonmar's avatar
      [project @ 2002-09-06 14:34:13 by simonmar] · 77186ef4
      simonmar authored
      Partial rewrite of the POSIX library.
      
      The main purpose of this sweep is to remove the last dependencies of
      the compiler on hslibs.  When I've committed the associated compiler
      changes, only the 'base' package will be required to bootstrap the
      compiler.  Additionally to build GHCi, the 'readline' and 'unix'
      packages will be required.
      
      The new POSIX library lives mostly in libraries/unix, with a few bits
      required for compiler bootstrapping in libraries/base.  The 'base'
      package is mostly free of hsc2hs code to make bootstrapping from HC
      files easier, but the 'unix' package will use hsc2hs liberally.
      
      The old POSIX library continues to provide more-or-less the same
      interface as before, although some of the types are more correct now
      (previously lots of POSIX types were just mapped to Int).  The new
      interface is largely the same as the old, except that some new
      functionality from the latest POSIX spec has been added (eg. symbolic
      links).
      
      So far, the new POSIX library has signal support, directory/file
      operations and lots of stuff from unistd.h.  The module names are:
      
        System.Posix
      	The main dude, exports everything
      
        System.Posix.Types
      	All the POSIX types, using the same naming scheme as
              Foreign.C.Types, Eg. CUid, COff, etc.  Many of these types
              were previously exported by GHC.Posix.
      
              Additionally exports the "nicer" names used by the old POSIX
      	library for compatibility (eg. ProcessID == CPid, FileMode ==
      	CMode, etc.)
      
      	All reasonable instances are derived for these types.
      
        System.Posix.Signals
      	Signal support, contains most of which was in PosixProcPrim before.
      	The RTS interface to the signal handling support has been
      	rationalised slightly.
      
        System.Posix.Directory
       	Directory support, most were in PosixFiles before.
      
        System.Posix.Files
      	File operations, most were in PosixFiles before.
      
        System.Posix.Unistd
      	(for want of a better name) Miscellaneous bits that mostly come
      	from the unistd.h header file.  PosixProcEnv before.
      
      The rest of the library should pan out like so:
      
        System.Posix.IO
        System.Posix.Error   (maybe)
        System.Posix.Process
        System.Posix.Terminal
      
      (I've no doubt broken Win32 support, but I'm checking the build at the moment).
      77186ef4
    • simonmar's avatar
      [project @ 2002-09-06 09:56:12 by simonmar] · f8e722a4
      simonmar authored
      Selector Thunk Fix, take II.
      
      The previous version didn't deal well with selector thunks which point
      to more selector thunks, and on closer inspection the method was
      flawed.  Now I've introduced a function
      
      	StgClosure *eval_selector_thunk( int field, StgClosure * )
      
      which evaluates a selector thunk returning its value, in from-space,
      if possible.  It blackholes the thunk during evaluation.  It might
      recursively evaluate more selector thunks, but it does this in a
      bounded way and updates the thunks with indirections (NOT forwarding
      pointers) after evaluation.
      
      This cleans things up somewhat, and I believe it deals properly with
      both types of selector-thunk loops that arise.
      
      MERGE TO STABLE
      f8e722a4
  25. 05 Sep, 2002 1 commit
    • simonmar's avatar
      [project @ 2002-09-05 16:26:33 by simonmar] · 8435b2e4
      simonmar authored
      Fix for infinite loop when there is a THUNK_SELECTOR which eventually
      refers to itself, such as might be generated by code like
      
      	let x = (fst x, snd x) in ...
      
      At the same time, I re-enabled the code to traverse multiple selector
      thunks with bounded depth, because I believe it now works.
      
      MERGE TO STABLE (but test thoroughly in the HEAD first, this is
      fragile stuff)
      8435b2e4