1. 07 Feb, 2002 10 commits
    • sewardj's avatar
      [project @ 2002-02-07 16:11:42 by sewardj] · b6ed8e7c
      sewardj authored
      Describe ultrakludge^Hclever engineering which makes IO types work in the
      interpreter.
      b6ed8e7c
    • sewardj's avatar
      [project @ 2002-02-07 15:31:20 by sewardj] · df108ac9
      sewardj authored
      Add many details about bytecode generation, the interpreter, and
      compiled/interpreted code interop.
      df108ac9
    • simonpj's avatar
      [project @ 2002-02-07 14:56:29 by simonpj] · a9ba9584
      simonpj authored
      Remove duplication of CVS info, and improve Win32 notes
      a9ba9584
    • simonpj's avatar
      [project @ 2002-02-07 14:06:00 by simonpj] · ad552fe2
      simonpj authored
      -------------------------------------------
      	Improve the "stragely-kinded tyvar" problem
      	-------------------------------------------
      
      When the type checker finds a type variable with no binding,
      which means it can be instantiated with an arbitrary type, it
      usually instantiates it to Void.  Eg.
      
      	length []
      ===>
      	length Void (Nil Void)
      
      But in really obscure programs, the type variable might have
      a kind other than *, so we need to invent a suitably-kinded type.
      
      This commit uses
      	Void for kind *
      	List for kind *->*
      	Tuple for kind *->...*->*
      
      which deals with most cases.  (Previously, it only dealt with
      kind *.)
      
      In the other cases, it just makes up a TyCon with a suitable
      kind.  If this gets into an interface file, anyone reading that
      file won't understand it.  This is fixable (by making the client
      of the interface file make up a TyCon too) but it is tiresome and
      never happens, so I am leaving it.
      
      Most of the added lines are comments.
      ad552fe2
    • simonpj's avatar
      [project @ 2002-02-07 12:51:47 by simonpj] · 5df7aa32
      simonpj authored
      --------------------------------------------------
      	Slurp in a few more instance decls with ghc --make
      	--------------------------------------------------
      
      ghc --make wasn't slurping in quite enough instance decls.
      The relevant comment is in RnIfaces; the new part is marked.
      George Russel's Uniform showed this up.
      
      We slurp in an instance decl from the gated instance pool iff
      
      	all its gates are either in the gates of the module,
      	or are a previously-loaded tycon or class.
      
      The latter constraint is because there might have been an instance
      decl slurped in during an earlier compilation, like this:
      
      	instance Foo a => Baz (Maybe a) where ...
      
      In the module being compiled we might need (Baz (Maybe T)), where T
      is defined in this module, and hence we need (Foo T).  So @Foo@ becomes
      a gate.  But there's no way to 'see' that.
      
      NEW:  More generally, types might be involved as well:
      NEW:  	instance Foo2 T a => Baz2 a where ...
      NEW:
      NEW: Now we must treat T as a gate too, as well as Foo.  So the solution
      NEW: we adopt is:
      NEW:
      NEW: 	we simply treat all previously-loaded
      NEW: 	tycons and classes as gates.
      NEW:
      NEW: This gloss only affects ghc --make and ghc --interactive.
      5df7aa32
    • simonpj's avatar
      [project @ 2002-02-07 12:51:34 by simonpj] · 20f50b2a
      simonpj authored
      ----------------------------------------------------
      	Make TcType.match and TcUnify.uUnboundVar kind-aware
      	----------------------------------------------------
      
      George Russel had apparently-overlapping (ha) instance decls like
      
      	instance .. => C (a b) where
      	instance .. => C (x y) where
      
      But the a,b and x,y were different kinds!  Turned out that TcType.unify
      was kind-aware (so we didn't report a duplicate instance decl, but TcType.match
      was not (so we simply selected the wrong one, and got a mis-kinded constraint
      popping up from the ".."  part.  Very exciting to track down.
      
      I also make the ordinary unification kind-aware in the same way.  It's
      quite legitimate to attempt to unify, say,
      	(a b)    with     (c d)
      but the unification should fail if a's kind differs from c's.
      (There was a kind of debug warning before, but it's actually not an error
      in the compiler... so it should just make unification fail gracefully.)
      20f50b2a
    • simonpj's avatar
      [project @ 2002-02-07 12:50:00 by simonpj] · 35c63bfc
      simonpj authored
      Better pretty printing
      35c63bfc
    • simonmar's avatar
      [project @ 2002-02-07 10:20:05 by simonmar] · 54bab78d
      simonmar authored
      clean $(HC_OBJS) too
      54bab78d
    • simonmar's avatar
      [project @ 2002-02-07 10:15:39 by simonmar] · ad38b443
      simonmar authored
      - update some comments
      
      - split up DERIVED_SRCS into separate variables so we can refer to
        them separately in the specification of the various CLEAN_FILES
        variables.
      
      - only clean happy-generated files in maintainer-clean mode
      ad38b443
    • sof's avatar
      [project @ 2002-02-07 06:33:20 by sof] · c2d67cab
      sof authored
      Little bit more doc on suspended_ccalling_threads
      c2d67cab
  2. 06 Feb, 2002 12 commits
    • sof's avatar
      [project @ 2002-02-06 20:52:51 by sof] · 1084e251
      sof authored
      unbreak stdcall handling (caused by recent change to Outputable instance for CCallConv)
      1084e251
    • simonpj's avatar
      [project @ 2002-02-06 15:54:23 by simonpj] · 979947f5
      simonpj authored
      Eliminate all vestiages of UsageTy, in preparation for
      	Keith's new version.  Hurrah!
      
      	Keith: LBVarInfo and usOnce,usMany are still there,
      	because I know you have eliminated LBVarInfo, and I didn't
      	want to cause unnecessary conflicts.
      979947f5
    • 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.
      6e1e8a09
    • keithw's avatar
      [project @ 2002-02-06 12:12:25 by keithw] · 37a47dd0
      keithw authored
      Merging the following onto the HEAD:
      
      |   1.61.2.1  +2 -4      fptools/ghc/compiler/rename/RnHsSyn.lhs
      |   1.135.2.1 +10 -0     fptools/ghc/compiler/rename/RnSource.lhs
      
      Original comment (keithw):
      
      Remove derivings FVs from tyClDeclFVs, because they aren't needed by
      interface files.  Instead, we return these FVs from
      finishSourceTyClDecl.
      37a47dd0
    • simonmar's avatar
      [project @ 2002-02-06 11:41:01 by simonmar] · c19b2904
      simonmar authored
      Take into account the patchlevel when figuring out if we're
      bootstrapping or not.
      c19b2904
    • sewardj's avatar
      [project @ 2002-02-06 11:34:01 by sewardj] · 6f3c1152
      sewardj authored
      wibble
      6f3c1152
    • chak's avatar
      [project @ 2002-02-06 11:19:51 by chak] · 69a2acc3
      chak authored
      Add Julian to the author's list as he seems to shy to do it himself ;-)
      69a2acc3
    • sewardj's avatar
      [project @ 2002-02-06 11:13:47 by sewardj] · 70d68b08
      sewardj authored
      Clean up the AbsC -> AbsC translation of array operations.
      
      * MachOps MO_ReadOSBI and MO_WriteOSBI, which previously did
        array indexing, are gone.  We translate now just to plain
        memory references and explicit address computations.  This
        has the happy side effect that all MachOps now return exactly
        one result (previously it was 0 or 1), cleaning up various
        bits of code.
      
        As a result the Abstract C structure now contains an unneccessary
        restriction, which is that the result of a MachOp can only be
        assigned to a temporary.  This made sense when MachOps had variable
        numbers of results (0, 1 or 2, originally), but is no longer needed.
        MachOps applied to args could now be allowed to appear as
        arbitrary nodes in expression trees, but so far they are not.
      
      * Get rid of CAddrMode constructor CMem, since it is a special case of
        CVal with a RegRelative of CIndex.
      
      AbstractC is inconsistent and non-orthogonal.  The StixStmt + StixExpr
      combination expresses a large part of what AbstractC does in a cleaner
      and simpler way, IMO.
      70d68b08
    • simonmar's avatar
      [project @ 2002-02-06 11:00:58 by simonmar] · 49fe2112
      simonmar authored
      Import lookupModuleEnv inside #ifdef GHCI
      49fe2112
    • 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.
      91fd2101
    • 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).
      80c55dc7
    • sof's avatar
      [project @ 2002-02-06 01:21:40 by sof] · 7f906dc8
      sof authored
      make stat_getElapsedTime(), SMP-only again
      7f906dc8
  3. 05 Feb, 2002 10 commits
    • sewardj's avatar
      [project @ 2002-02-05 16:56:38 by sewardj] · 0fee0e07
      sewardj authored
      [non-code-change] complaint --> compliant
      0fee0e07
    • keithw's avatar
      [project @ 2002-02-05 16:44:37 by keithw] · 6eaccd1a
      keithw authored
      Generalise types of minusUFM and intersectUFM_C (this was applied long
      ago to FiniteMap, IIRC).
      
      Untested: I haven't got a build tree handy, so please shoot me if this
      2-line change to two type signatures is type-incorrect.  Sorry!
      6eaccd1a
    • simonpj's avatar
      [project @ 2002-02-05 15:42:04 by simonpj] · e6601808
      simonpj authored
      ```------
      		Main.main
      		---------
      
      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
      		Main_zdmain_closure
      
      * 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
      e6601808
    • simonpj's avatar
      [project @ 2002-02-05 15:37:01 by simonpj] · fcd0dea6
      simonpj authored
      add renamer stuff
      fcd0dea6
    • simonpj's avatar
      [project @ 2002-02-05 15:34:32 by simonpj] · 5b9d0e0f
      simonpj authored
      Add a bit of renamer documentation
      5b9d0e0f
    • simonpj's avatar
      [project @ 2002-02-05 15:02:23 by simonpj] · c43a63d3
      simonpj authored
      Imports only
      c43a63d3
    • simonpj's avatar
      [project @ 2002-02-05 14:46:26 by simonpj] · f50b860a
      simonpj authored
      Imports only
      f50b860a
    • simonpj's avatar
      [project @ 2002-02-05 14:43:35 by simonpj] · 144e841e
      simonpj authored
      Imports and comments only
      144e841e
    • simonpj's avatar
      [project @ 2002-02-05 14:39:24 by simonpj] · c7eeb711
      simonpj authored
      Imports only
      c7eeb711
    • 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.
      84a29fdd
  4. 04 Feb, 2002 8 commits
    • sof's avatar
      [project @ 2002-02-04 22:17:50 by sof] · e9f0f9d7
      sof authored
      .y/.ly handling: patsubst'ery broke when HAPPY_SRCS suddenly contained two file extensions; now fixed.
      e9f0f9d7
    • sof's avatar
      [project @ 2002-02-04 20:56:53 by sof] · 632827e0
      sof authored
      resumeThread: ifdef threads-specific code
      632827e0
    • 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.
      be72dc05
    • sof's avatar
      [project @ 2002-02-04 20:26:25 by sof] · cc517f07
      sof authored
      wibble
      cc517f07
    • sof's avatar
      [project @ 2002-02-04 20:25:39 by sof] · ea0e6441
      sof authored
      startupHaskell: Scheduler startup now handles task creation
      ea0e6441
    • 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.]
      e53c9fc7
    • 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.
      2374f2fd
    • 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.
      bf96cc34