1. 14 Feb, 2002 19 commits
    • sof's avatar
      [project @ 2002-02-14 16:24:59 by sof] · 5f217c8d
      sof authored
      extsBitmap handling: avoid using Int instance for Bits (may not be there; cf. 4.08), use Int32 instead
      5f217c8d
    • 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.
      0d571ce3
    • simonmar's avatar
      [project @ 2002-02-14 15:14:00 by simonmar] · 4f0e92bc
      simonmar authored
      Fixes to 'make install' in fptools/libraries.  We have to maintain the
      directory structure when installing the .hi files, rather than just
      dumping them in a single directory as we do for packages in
      fptools/hslibs.
      4f0e92bc
    • 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)
      584da9b7
    • simonpj's avatar
      [project @ 2002-02-14 15:08:08 by simonpj] · debf9165
      simonpj authored
      -------------------------------------------------
      	Undo an earlier hack in postInlineUnconditionally
      	-------------------------------------------------
      
      In an earlier era I made postInlineUnconditionally rather less
      aggressive; it didn't inline even trivial things unless they
      occurred just once.  THis was a hack designed to avoid rules
      unexpectedly not firing.  But now we have much more control
      over rules, through the phase numbering stuff, so I can undo the
      hack.
      
      Well, so I believe.  Manuel, yell if your rules stop working!
      debf9165
    • simonpj's avatar
      [project @ 2002-02-14 15:03:38 by simonpj] · 98b23d27
      simonpj authored
      ------------------------------------
      	Desugar existential matches correctly
      	------------------------------------
      
      Consider
      	data T = forall a. Ord a => T a (a->Int)
      
      	f (T x f) True  = ...expr1...
      	f (T y g) False = ...expr2..
      
      When we put in the tyvars etc we get
      
      	f (T a (d::Ord a) (x::a) (f::a->Int)) True =  ...expr1...
      	f (T b (e::Ord a) (y::a) (g::a->Int)) True =  ...expr2...
      
      After desugaring etc we'll get a single case:
      
      	f = \t::T b::Bool ->
      	    case t of
      	       T a (d::Ord a) (x::a) (f::a->Int)) ->
      	    case b of
      		True  -> ...expr1...
      		False -> ...expr2...
      
      *** We have to substitute [a/b, d/e] in expr2! **
      
      
      Originally I tried to use
      	(\b -> let e = d in expr2) a
      to do this substitution.  While this is "correct" in a way, it fails
      Lint, because e::Ord b but d::Ord a.
      
      So now I simply do the substitution properly using substExpr.
      98b23d27
    • simonpj's avatar
      [project @ 2002-02-14 14:56:04 by simonpj] · 6aa2bf20
      simonpj authored
      ---------------------------------------
      	Record updates are ok for types involving
      	existential data constructors, so long as the
      	existential ones aren't the ones updated.
      	---------------------------------------
      
      This check was already in the type checker, but
      the desugarer had an over-zealous assert.
      6aa2bf20
    • simonpj's avatar
      [project @ 2002-02-14 14:02:55 by simonpj] · 0d8a0e7f
      simonpj authored
      ---------------------------------------
      	Stop CSE messing up workers annotations
      	---------------------------------------
      
      See the comments with CSE.do_one
      0d8a0e7f
    • simonpj's avatar
      [project @ 2002-02-14 14:01:40 by simonpj] · 1f315e01
      simonpj authored
      Do tcSub the right way round for pattern type signatures
      1f315e01
    • simonpj's avatar
      [project @ 2002-02-14 14:01:09 by simonpj] · 1a6810f8
      simonpj authored
      Do tcMonoExpr instead of tcExpr, here and there
      1a6810f8
    • simonpj's avatar
      [project @ 2002-02-14 13:59:22 by simonpj] · da0e7b0f
      simonpj authored
      Import wibbles
      da0e7b0f
    • 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
      closures.
      
      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
      TICK_ENT_STATIC_THK and TICK_ENT_DYN_THK).
      89577706
    • sof's avatar
      [project @ 2002-02-14 09:00:41 by sof] · 4fabd150
      sof authored
      make multi-threading story work under win32 also
      4fabd150
    • sof's avatar
      [project @ 2002-02-14 08:59:29 by sof] · 5e856f00
      sof authored
      debugged
      5e856f00
    • sof's avatar
      [project @ 2002-02-14 08:23:25 by sof] · 40d97663
      sof authored
      Right, that's it! Nuke rawSystem nonsense, as it turns
      out the SysTools replacement for it wasn't 4.08 compatible,
      hence nightly build break.
      
      Should you bootstrap with 4.08 under mingw, and subseq.
      do a stage2 build, you'll run into command-line length
      probs during the final big linker invocation. Nothing
      to lose sleep over, there are plenty of newer versions
      to base a stage1 build on.
      40d97663
    • sof's avatar
      [project @ 2002-02-14 07:55:47 by sof] · 910b485a
      sof authored
      import SystemExts.rawSystem in mingw builds only
      910b485a
    • 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.
      efa41d9d
    • sof's avatar
      [project @ 2002-02-14 07:40:17 by sof] · 05abfa38
      sof authored
      win32: make it compile
      05abfa38
    • sof's avatar
      [project @ 2002-02-14 07:39:16 by sof] · 2efe6e31
      sof authored
      wibble
      2efe6e31
  2. 13 Feb, 2002 21 commits
    • sof's avatar
      [project @ 2002-02-13 20:14:41 by sof] · 1fb39ac3
      sof authored
      The days of main/rawSystem.c and (its use in) main/SysTools.lhs are
      almost up..for now, don't bother copying it in if we're booting
      with 5.02 or later (which we are under mingw, which is the only
      plat. where this hack matters).
      1fb39ac3
    • sof's avatar
      [project @ 2002-02-13 19:43:46 by sof] · 07aea74a
      sof authored
      Use SGML_CATALOG_FILES, if defined
      07aea74a
    • sof's avatar
      [project @ 2002-02-13 19:42:38 by sof] · 17656ff2
      sof authored
      FPTOOLS_DOCBOOK_CATALOG: check whether the SGML_CATALOG_FILES env var is
      defined. If it is, treat it as gospel.
      17656ff2
    • simonmar's avatar
      [project @ 2002-02-13 15:57:19 by simonmar] · 44c6f87f
      simonmar authored
      print comes from System.IO these days
      44c6f87f
    • simonmar's avatar
      [project @ 2002-02-13 15:56:18 by simonmar] · e8d5235b
      simonmar authored
      Refer to stdout as IO.stdout, not PrelHandle.stdout, and similarly for stderr.
      e8d5235b
    • simonmar's avatar
      [project @ 2002-02-13 15:48:03 by simonmar] · a4b10a35
      simonmar authored
      Build $(GHCI_LIBRARY) whenever we build $(LIBRARY), not just when
      $(PACAGE) is set.
      a4b10a35
    • simonmar's avatar
      [project @ 2002-02-13 15:45:25 by simonmar] · eed458c7
      simonmar authored
      Packages that come in by way of -package-conf files override default
      packages (requested by Manuel Chakravarty).
      eed458c7
    • sof's avatar
      [project @ 2002-02-13 15:29:27 by sof] · 4e19ab1d
      sof authored
      Tweaks to the Windows section, in part. commented out
      the InstallShield section as it is no longer used.
      4e19ab1d
    • simonpj's avatar
      [project @ 2002-02-13 15:19:17 by simonpj] · 711e4d7a
      simonpj authored
      ----------------------------------
      	Do the Right Thing for TyCons where we
      	can't see all their constructors.
      	----------------------------------
      
      Inside a TyCon, three things can happen
      
      1. GHC knows all the constructors, and has them to hand.
         (Nowadays, there may be zero constructors.)
      
      2. GHC knows all the constructors, but has declined to slurp
         them all in, to avoid sucking in more declarations than
         necessary.  All we remember is the number of constructors,
         so we can get the return convention right.
      
      3. GHC doesn't know anything. This happens *only* for decls
         coming from .hi-boot files, where the programmer declines to
         supply a representation.
      
      Until now, these three cases have been conflated together.  Matters
      are worse now that a TyCon really can have zero constructors.  In
      fact, by confusing (3) with (1) we can actually generate bogus code.
      
      With this commit, the dataCons field of a TyCon is of type:
      
      data DataConDetails datacon
        = DataCons [datacon]	-- Its data constructors, with fully polymorphic types
      			-- A type can have zero constructors
      
        | Unknown		-- We're importing this data type from an hi-boot file
      			-- and we don't know what its constructors are
      
        | HasCons Int		-- In a quest for compilation speed we have imported
      			-- only the number of constructors (to get return
      			-- conventions right) but not the constructors themselves
      
      This says exactly what is going on.  There are lots of consequential small
      changes.
      711e4d7a
    • simonpj's avatar
      [project @ 2002-02-13 15:14:06 by simonpj] · e7030995
      simonpj authored
      --------------------------------------------
      	Fix a bugs in type inference for rank-N types
      	--------------------------------------------
      
      We discovered this bug when looking at type rules!
      
      1. When type checking (e :: sigma-ty), we must specialise sigma-ty,
         else we lose the invariant that tcMonoType has.
      
      2. In tcExpr_id, we should pass in a Hole tyvar not an ordinary tyvar.
      
      As usual, I moved some functions around in consequence.
      e7030995
    • simonmar's avatar
      [project @ 2002-02-13 15:07:59 by simonmar] · d113ae78
      simonmar authored
      Don't translate out negative (boxed) literals too early.
      d113ae78
    • simonmar's avatar
      [project @ 2002-02-13 14:52:43 by simonmar] · f405fb59
      simonmar authored
      Catch up with Haskell 98 revisions: allow sections like (++ x ++ y)
      and (3 + 4 +).
      f405fb59
    • simonpj's avatar
      [project @ 2002-02-13 14:14:09 by simonpj] · 726258fc
      simonpj authored
      ------------------------------
      	Fix the "occurs check" so that
      	it handles unifying a type variable
      	with a type scheme
      	------------------------------
      
      It's illegal to unify a type variable with a type scheme:
      
      	a  :=:  (forall b. b->b) -> Int
      
      But I wasn't detecting that properly.  Now, the same code
      that does the occurs check also looks for foralls.
      726258fc
    • simonpj's avatar
      [project @ 2002-02-13 14:05:50 by simonpj] · af93bb78
      simonpj authored
      Import wibbles
      af93bb78
    • simonmar's avatar
      [project @ 2002-02-13 12:17:48 by simonmar] · ab96f60d
      simonmar authored
      Add {-# OPTIONS -fno-implicit-prelude #-} to the top of GHC/PrimopWrappers.hs
      ab96f60d
    • simonmar's avatar
      [project @ 2002-02-13 11:51:40 by simonmar] · aa0db183
      simonmar authored
      - Detect presence of a POSIX-compatible regex interface in configure,
        and omit Text.Regex.Posix (and hence Text.Regex) if it is missing.
        ToDo: pull in a suitably-licensed implementation of POSIX regex
        to be used in the event that the system doesn't supply one.
      
      - Rename old HaveRegex to HaveGNURegex.
      aa0db183
    • simonmar's avatar
      [project @ 2002-02-13 10:45:28 by simonmar] · 27e90065
      simonmar authored
      Use --update-package rather than --remove-package followed by --add-package
      27e90065
    • simonmar's avatar
      [project @ 2002-02-13 10:40:24 by simonmar] · 9f66c841
      simonmar authored
      Fixes to SplitObjs: we now put the split object files in a
      subdirectory M_split/ rather than just M/, because the latter
      interacts badly with our hierarchical module structure.
      9f66c841
    • simonpj's avatar
      [project @ 2002-02-13 10:39:36 by simonpj] · 9b7de002
      simonpj authored
      -------------------------------
      	dosifyPath before opening files
      	-------------------------------
      
      If you call
      	hsc2hs foo/baz
      
      you get the amazing response:
      
      	'foo' is not recognized as an internal or external command,
      	operable program or batch file.
      
      On the other hand
      	hsc2hs foo\baz
      
      works fine.  Solution: call dosifyPath before opening or writing the file.
      
      
      Somehow we should make it less easy to trip up when doing file I/O on
      Windows.  And provide a library of path-manipulation primitives.
      9b7de002
    • 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
      	   available.
      
            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.
      e289780e
    • sof's avatar
      [project @ 2002-02-13 07:51:01 by sof] · 3470e75b
      sof authored
      removed taskNotAvailable(), taskAvailable() and getTaskCount() - simplified away
      3470e75b