1. 15 Feb, 2002 2 commits
  2. 14 Feb, 2002 12 commits
    • sof's avatar
      [project @ 2002-02-14 18:20:37 by sof] · f7e5d55c
      sof authored
      more comments
    • sof's avatar
      [project @ 2002-02-14 17:21:50 by sof] · 4acbbe8a
      sof authored
      widen the scope of is_heap_alloced() proto; for all mingw builds
    • sof's avatar
      [project @ 2002-02-14 17:17:08 by sof] · 18b9187c
      sof authored
      COMPILING_RTS wasn't being fed to the C compiler. It is arguably a
      bug/feature deficiency of GHC not to do the Right Thing for invocations
      such as these:
         ghc -c -DFOO foo.c
      i.e., pass -DFOO to the C compiler -- currently, you have to be explicit
      about this, -optc-DFOO
    • sof's avatar
      [project @ 2002-02-14 16:55:07 by sof] · 6319ebf3
      sof authored
      resetNonBlockingFd, setNonBlockingFd: mingw tidyup
    • simonmar's avatar
      [project @ 2002-02-14 15:51:30 by simonmar] · 0d571ce3
      simonmar authored
      oops, got the sense of an ifdef round the wrong way.
    • simonmar's avatar
      [project @ 2002-02-14 15:11:28 by simonmar] · 584da9b7
      simonmar authored
      fix typo: PKG_CPP_OPTS ==> PACKAGE_CPP_OPTS (fixes linking libgmp)
    • njn's avatar
      [project @ 2002-02-14 11:56:03 by njn] · 89577706
      njn authored
      This commit affects ticky-ticky profiling.  Entry counts for thunks,
      constructors, functions (standard and direct) and indirections are split into
      two counters, one for entries to static closures and one for entries to dynamic
      This required changing ticky-ticky details in the RTS (introducing new counters
      and corresponding TICK_* events), and also changing the code generator to
      generate the new event names (eg. TICK_ENT_THK is replaced by
    • sof's avatar
      [project @ 2002-02-14 09:00:41 by sof] · 4fabd150
      sof authored
      make multi-threading story work under win32 also
    • sof's avatar
      [project @ 2002-02-14 08:59:29 by sof] · 5e856f00
      sof authored
    • sof's avatar
      [project @ 2002-02-14 07:52:05 by sof] · efa41d9d
      sof authored
      Restructured / tidied a bit:
      * Capability.grabReturnCapability() is now called by resumeThread().
        It takes care of waiting on the (Capability.c-local) condition
        variable, 'returning_worker_cond' (moved here from Schedule.c)
      * If a worker notices upon entry to the Scheduler that there are
        worker threads waiting to deposit results of external calls,
        it gives up its capability by calling Capability.yieldCapability().
      * Added Scheduler.waitForWork(), which takes care of blocking
        on 'thread_ready_cond' (+ 'rts_n_waiting_tasks' book-keeping).
      Note: changes haven't been fully tested, due to HEAD instability.
    • sof's avatar
      [project @ 2002-02-14 07:40:17 by sof] · 05abfa38
      sof authored
      win32: make it compile
    • sof's avatar
      [project @ 2002-02-14 07:39:16 by sof] · 2efe6e31
      sof authored
  3. 13 Feb, 2002 2 commits
    • sof's avatar
      [project @ 2002-02-13 08:48:06 by sof] · e289780e
      sof authored
      Revised implementation of multi-threaded callouts (and callins):
      - unified synchronisation story for threaded and SMP builds,
        following up on SimonM's suggestion. The following synchro
        variables are now used inside the Scheduler:
          + thread_ready_cond - condition variable that is signalled
            when a H. thread has become runnable (via the THREAD_RUNNABLE()
            macro) and there are available capabilities. Waited on:
               + upon schedule() entry (iff no caps. available).
      	 + when a thread inside of the Scheduler spots that there
      	   are no runnable threads to service, but one or more
      	   external call is in progress.
      	 + in resumeThread(), waiting for a capability to become
            Prior to waiting on thread_ready_cond, a counter rts_n_waiting_tasks
            is incremented, so that we can keep track of the number of
            readily available worker threads (need this in order to make
            an informed decision on whether or not to create a new thread
            when an external call is made).
          + returning_worker_cond - condition variable that is waited
            on by an OS thread that has finished executing and external
            call & now want to feed its result back to the H thread
            that made the call. Before doing so, the counter
            rts_n_returning_workers is incremented.
            Upon entry to the Scheduler, this counter is checked for &
            if it is non-zero, the thread gives up its capability and
            signals returning_worker_cond before trying to re-grab a
            capability. (releaseCapability() takes care of this).
          + sched_mutex - protect Scheduler data structures.
          + gc_pending_cond - SMP-only condition variable for signalling
            completion of GCs.
      - initial implementation of call-ins, i.e., multiple OS threads
        may concurrently call into the RTS without interfering with
        each other. Implementation uses cheesy locking protocol to
        ensure that only one OS thread at a time can construct a
        function application -- stop-gap measure until the RtsAPI
        is revised (as discussed last month) *and* a designated
        block is used for allocating these applications.
      - In the implementation of call-ins, the OS thread blocks
        waiting for an RTS worker thread to complete the evaluation
        of the function application. Since main() also uses the
        RtsAPI, provide a separate entry point for it (rts_mainEvalIO()),
        which avoids creating a separate thread to evaluate Main.main,
        that can be done by the thread exec'ing main() directly.
        [Maybe there's a tidier way of doing this, a bit ugly the
        way it is now..]
      There are a couple of dark corners that needs to be looked at,
      such as conditions for shutting down (and how) + consider what
      ought to happen when async I/O is thrown into the mix (I know
      what will happen, but that's maybe not what we want).
      Other than that, things are in a generally happy state & I hope
      to declare myself done before the week is up.
    • sof's avatar
      [project @ 2002-02-13 07:51:01 by sof] · 3470e75b
      sof authored
      removed taskNotAvailable(), taskAvailable() and getTaskCount() - simplified away
  4. 12 Feb, 2002 6 commits
    • sof's avatar
      [project @ 2002-02-12 15:39:49 by sof] · 9d037f55
      sof authored
      THREAD_RUNNABLE(): make available in threaded mode
    • sof's avatar
      [project @ 2002-02-12 15:38:08 by sof] · a62d5cd2
      sof authored
      Snapshot (before heading into work):
      - thread_ready_aux_mutex is no more; use sched_mutex instead.
      - gc_pending_cond only used in SMP mode.
      - document the condition that thread_ready_cond captures.
    • sof's avatar
      [project @ 2002-02-12 15:34:25 by sof] · 3fa80568
      sof authored
      - give rts_n_free_capabilities an interpretation
        in threaded mode (possible values: 0,1)
      - noFreeCapabilities() -? noCapabilities()
    • simonmar's avatar
      [project @ 2002-02-12 15:17:13 by simonmar] · 2cc5b907
      simonmar authored
      Switch over to the new hierarchical libraries
      This commit reorganises our libraries to use the new hierarchical
      module namespace extension.
      The basic story is this:
         - fptools/libraries contains the new hierarchical libraries.
           Everything in here is "clean", i.e. most deprecated stuff has
           been removed.
      	- fptools/libraries/base is the new base package
      	  (replacing "std") and contains roughly what was previously
      	  in std, lang, and concurrent, minus deprecated stuff.
      	  Things that are *not allowed* in libraries/base include:
      		Addr, ForeignObj, ByteArray, MutableByteArray,
      		_casm_, _ccall_, ``'', PrimIO
      	  For ByteArrays and MutableByteArrays we use UArray and
      	  STUArray/IOUArray respectively now.
      	  Modules previously called PrelFoo are now under
      	  fptools/libraries/GHC.  eg. PrelBase is now GHC.Base.
      	- fptools/libraries/haskell98 provides the Haskell 98 std.
      	  libraries (Char, IO, Numeric etc.) as a package.  This
      	  package is enabled by default.
      	- fptools/libraries/network is a rearranged version of
      	  the existing net package (the old package net is still
      	  available; see below).
      	- Other packages will migrate to fptools/libraries in
      	  due course.
           NB. you need to checkout fptools/libraries as well as
           fptools/hslibs now.  The nightly build scripts will need to be
         - fptools/hslibs still contains (almost) the same stuff as before.
           Where libraries have moved into the new hierarchy, the hslibs
           version contains a "stub" that just re-exports the new version.
           The idea is that code will gradually migrate from fptools/hslibs
           into fptools/libraries as it gets cleaned up, and in a version or
           two we can remove the old packages altogether.
         - I've taken the opportunity to make some changes to the build
           system, ripping out the old hslibs Makefile stuff from
           mk/target.mk; the new package building Makefile code is in
           mk/package.mk (auto-included from mk/target.mk).
           The main improvement is that packages now register themselves at
           make boot time using ghc-pkg, and the monolithic package.conf
           in ghc/driver is gone.
           I've updated the standard packages but haven't tested win32,
           graphics, xlib, object-io, or OpenGL yet.  The Makefiles in
           these packages may need some further tweaks, and they'll need
           pkg.conf.in files added.
         - Unfortunately all this rearrangement meant I had to bump the
           interface-file version and create a bunch of .hi-boot-6 files :-(
    • sof's avatar
      [project @ 2002-02-12 05:01:26 by sof] · ccaf7057
      sof authored
      bring stuff in parallel/ into scope when running 'mkdependC'
    • sof's avatar
      [project @ 2002-02-12 04:49:13 by sof] · 45e237c1
      sof authored
      comment wibble
  5. 08 Feb, 2002 2 commits
  6. 07 Feb, 2002 2 commits
  7. 06 Feb, 2002 4 commits
    • sewardj's avatar
      [project @ 2002-02-06 15:48:56 by sewardj] · 6e1e8a09
      sewardj authored
      x86 only: make %esp be 8-aligned before entering HC-world code.
      This avoids misalignment penalties for C doubles stored on the C
      stack.  A quick test using nofib/imaginary/rfib shows that getting
      this wrong increases run time by about 10% on our 1 GHz PIII.
    • sof's avatar
      [project @ 2002-02-06 01:29:27 by sof] · 91fd2101
      sof authored
      - use task manager API to keep track of the number
        of tasks that are blocked waiting on the RTS lock.
      - comment updates/additions.
    • sof's avatar
      [project @ 2002-02-06 01:26:14 by sof] · 80c55dc7
      sof authored
      - in the threaded case, keep track of the number of
        tasks/threads that are currently waiting to enter
        the RTS.
      - taskStart():
           + only start up a new thread/task if there aren't
             any already waiting to gain RTS access.
           + honour thread/task limits (if any).
    • sof's avatar
      [project @ 2002-02-06 01:21:40 by sof] · 7f906dc8
      sof authored
      make stat_getElapsedTime(), SMP-only again
  8. 05 Feb, 2002 2 commits
    • simonpj's avatar
      [project @ 2002-02-05 15:42:04 by simonpj] · e6601808
      simonpj authored
      A bunch of related fixes concerning 'main'
      * Arrange that 'main' doesn't need to be defined in module Main;
        it can be imported.
      * The typechecker now injects a binding
      	Main.$main = PrelTopHandler.runMain main
        So the runtime system now calls Main.$main, not PrelMain.main.
        With z-encoding, this look like
      * The function
        	PrelTopHandler.runMain :: IO a -> IO ()
        wraps the programmer's 'main' in an exception-cacthing wrapper.
      * PrelMain.hs and Main.hi-boot are both removed from lib/std, along
        with multiple lines of special case handling in lib/std/Makefile.
        This is a worthwhile cleanup.
      * Since we now pick up whatever 'main' is in scope, the ranamer gets
        in on the act (RnRnv.checkMain).  There is a little more info to
        get from the renamer to the typechecker, so I've defined a new type
        Rename.RnResult (c.f. TcModule.TcResult)
      * With GHCi, it's now a warning, not an error, to omit the binding
        of main (RnEnv.checkMain)
      * It would be easy to add a flag "-main-is foo"; the place to use
        that information is in RnEnv.checkMain.
      On the way I made a new type,
      	type HscTypes.FixityEnv = NameEnv Fixity
      and used it in various places I'd tripped over
    • simonmar's avatar
      [project @ 2002-02-05 10:06:24 by simonmar] · 84a29fdd
      simonmar authored
      Fix bad bugs in deleteAllThreds: we were looping through the thread
      queues calling deleteThread() on each thread as we go, but calling
      deleteThread() has the side effect of removing the thread from the
      relevant queue, so we would end up breaking out of the loop after
      processing only a single thread.
      This may fix problems like "resurrectThreads: thread blocked in a
      strange way" seen after pressing ^C.
      Aside: we really shouldn't be using deleteThread() at all, since it
      doesn't give the thread a chance to clean up & release locks.  To be
      well-behaved a program has to catch ^C itself at the moment.
  9. 04 Feb, 2002 8 commits
    • sof's avatar
      [project @ 2002-02-04 20:56:53 by sof] · 632827e0
      sof authored
      resumeThread: ifdef threads-specific code
    • sof's avatar
      [project @ 2002-02-04 20:40:36 by sof] · be72dc05
      sof authored
      Snapshot of 'native thread'-friendly extension:
      - call-outs now work, i.e., a Concurrent Haskell thread which
        makes an external (C) call no longer stop other CH threads
        dead in their tracks. [More testing and tightening up of
        invariants reqd, this is just a snapshot].
      - separated task handling into sep. module.
    • sof's avatar
      [project @ 2002-02-04 20:26:25 by sof] · cc517f07
      sof authored
    • sof's avatar
      [project @ 2002-02-04 20:25:39 by sof] · ea0e6441
      sof authored
      startupHaskell: Scheduler startup now handles task creation
    • sof's avatar
      [project @ 2002-02-04 20:24:14 by sof] · e53c9fc7
      sof authored
      Factor out the task handling into separate 'module'.
      [Tasks represent native threads that execute STG code, with this
       module providing the API which the Scheduler uses to control
       their creation and destruction.]
    • sof's avatar
      [project @ 2002-02-04 20:21:16 by sof] · 2374f2fd
      sof authored
      - sm_mutex is now a Mutex (not a pthread_mutex_t).
      - sm_mutex lock/unlocks are only done for SMP builds.
    • sof's avatar
      [project @ 2002-02-04 20:18:26 by sof] · bf96cc34
      sof authored
      - renamed MutexVar to Mutex, CondVar to Condition.
      - added yieldThread().
      - simplified/specialised type of entry point to new (native) threads;
        now takes no args & returns no result.
    • sof's avatar
      [project @ 2002-02-04 20:14:56 by sof] · 237d1510
      sof authored
      simplified startup of this 'sub-system', initCapabilities() takes care of it all