ghc-hetmet.git
22 years ago[project @ 2001-12-10 01:27:59 by sebc]
sebc [Mon, 10 Dec 2001 01:28:00 +0000 (01:28 +0000)]
[project @ 2001-12-10 01:27:59 by sebc]
MacOS X 10.1 identifies as "darwin"

22 years ago[project @ 2001-12-10 01:21:17 by sebc]
sebc [Mon, 10 Dec 2001 01:21:17 +0000 (01:21 +0000)]
[project @ 2001-12-10 01:21:17 by sebc]
MacOS X 10.1 now has a libm

22 years ago[project @ 2001-12-07 20:57:53 by sof]
sof [Fri, 7 Dec 2001 20:57:53 +0000 (20:57 +0000)]
[project @ 2001-12-07 20:57:53 by sof]
- tidy up TICK_ALLOC_TSO() uses.
- scheduleThread: remove special-case for END_TSO_QUEUE. If you want
  to call schedule(), do so directly. (Only one of the scheduleThread()
  call sites depended on this feature).

22 years ago[project @ 2001-12-07 17:33:26 by simonpj]
simonpj [Fri, 7 Dec 2001 17:33:26 +0000 (17:33 +0000)]
[project @ 2001-12-07 17:33:26 by simonpj]
----------------------------
More jiggling in the renamer
----------------------------

I was a little hasty before.  (Thanks Sigbjorn for finding
this.)  This commit tidies up the handling of AvailEnvs.
Principally:

  * filterImports now deals completely with hiding
    (before it handed off part of the job to mkGlobalRdrEnv)

  * The AvailEnv in an ExportAvails does not have class ops and
    data constructors in its domain.  This makes plusExportAvails
    more efficient, but the main thing is that it collects things
    up right.  (Previously, if we had
import M( C )
import M( op )
    then we got an AvailEnv which had C |-> AvailTC C [C]
    (no 'op').

  * In Rename, we do need a "filled-out" version of the overall
    AvailEnv, full_avail_env, which we construct on the spot in 'rename'.

22 years ago[project @ 2001-12-07 15:49:41 by sof]
sof [Fri, 7 Dec 2001 15:49:41 +0000 (15:49 +0000)]
[project @ 2001-12-07 15:49:41 by sof]
Track the removal of ReallyUnsafePtrEqualityOp + InterTo{Int,Word}64Op primops.

22 years ago[project @ 2001-12-07 11:34:48 by sewardj]
sewardj [Fri, 7 Dec 2001 11:34:48 +0000 (11:34 +0000)]
[project @ 2001-12-07 11:34:48 by sewardj]
Change the story on shifting primops: SllOp, SrlOp, ISllOp, ISraOp, ISrlOp.

In the old primop story, these were implemented by C macros which
checked that the shift amount did not exceed the word size, and if so
returns a suitable value (0 or -1).  This gives consistent, defined
behaviour for any shift amount.  However, these checks were not
implemented on the NCG route, an inconsistency.

New story: these primops do NOT check their args; they just do the shift.
Shift values >= word size give undefined results.  To reflect this, their
Haskell names have been prefixed with 'unchecked'.

The checks are now done on the Bits instances in the Prelude.  This means
all code generation routes are consistently checked, and hopefully the
simplifier will remove the checks for literal shift amounts.

I have tried to fix up the implementation for 64-bit platforms too, but
not having one to hand, I don't know if it will work as-is.

22 years ago[project @ 2001-12-07 11:27:09 by sewardj]
sewardj [Fri, 7 Dec 2001 11:27:09 +0000 (11:27 +0000)]
[project @ 2001-12-07 11:27:09 by sewardj]
Comments only.

22 years ago[project @ 2001-12-07 08:12:53 by sof]
sof [Fri, 7 Dec 2001 08:12:53 +0000 (08:12 +0000)]
[project @ 2001-12-07 08:12:53 by sof]
mkExportAvails: computing the AvailEnv is rather delicate

22 years ago[project @ 2001-12-07 07:37:43 by sof]
sof [Fri, 7 Dec 2001 07:37:43 +0000 (07:37 +0000)]
[project @ 2001-12-07 07:37:43 by sof]
Tidyup - previous instance-decl commit fell a bit short:

 * RnEnv.lookupInstDeclBndr unceremoniously fell over when passed
   an out-of-scope class name.

 * the AvailEnv carried around didn't common up type/class info
   (i.e.,  AvailTCs), but rather type/class and method/label names,
   causing the renamer to (semi)randomly report instance methods as
   being out-of-scope in the presence of multiple imports for a module.

 * didn't support 'hiding' of class / method names (for the purposes
   of checking instance decls).

22 years ago[project @ 2001-12-06 17:33:30 by simonmar]
simonmar [Thu, 6 Dec 2001 17:33:30 +0000 (17:33 +0000)]
[project @ 2001-12-06 17:33:30 by simonmar]
Make the Name field of a Var strict - it doesn't hurt performance (in
fact it makes a tiny improvement) but it can help residency.

22 years ago[project @ 2001-12-06 14:42:56 by simonmar]
simonmar [Thu, 6 Dec 2001 14:42:56 +0000 (14:42 +0000)]
[project @ 2001-12-06 14:42:56 by simonmar]
Turn a lazy pattern match into a strict one in tidyIdBndr.  This
prevents us accidentally hanging onto stuff in the OccName field of a
Name after tidying.

22 years ago[project @ 2001-12-06 14:33:02 by simonmar]
simonmar [Thu, 6 Dec 2001 14:33:02 +0000 (14:33 +0000)]
[project @ 2001-12-06 14:33:02 by simonmar]
- Fix THUNK_SELECTOR printing code
- change some more stderrs into stdouts

22 years ago[project @ 2001-12-06 13:09:19 by sewardj]
sewardj [Thu, 6 Dec 2001 13:09:19 +0000 (13:09 +0000)]
[project @ 2001-12-06 13:09:19 by sewardj]
Make it compile -DDEBUG.

22 years ago[project @ 2001-12-06 13:05:03 by sewardj]
sewardj [Thu, 6 Dec 2001 13:05:03 +0000 (13:05 +0000)]
[project @ 2001-12-06 13:05:03 by sewardj]
Remove out-of-date ASSERT in deRefStablePtr_fast.

22 years ago[project @ 2001-12-06 12:30:13 by chak]
chak [Thu, 6 Dec 2001 12:30:13 +0000 (12:30 +0000)]
[project @ 2001-12-06 12:30:13 by chak]
Make prof package dependency more precise

22 years ago[project @ 2001-12-06 11:50:07 by sewardj]
sewardj [Thu, 6 Dec 2001 11:50:07 +0000 (11:50 +0000)]
[project @ 2001-12-06 11:50:07 by sewardj]
Add constructor CBytesPerWord to (the wildly-misnamed) CAddrMode, and
use this in various places to remove word size dependencies in the
C -> C simplification pass.  Tart up the Stix constant folder a bit
so as to be able to fold out the shift/mask literal expressions.

22 years ago[project @ 2001-12-06 10:45:42 by simonpj]
simonpj [Thu, 6 Dec 2001 10:45:43 +0000 (10:45 +0000)]
[project @ 2001-12-06 10:45:42 by simonpj]
--------------------------
Fix the instance-decl wart
--------------------------

This commit implements the (proposed) H98 rule for
resolving the class-method name in an instance decl.

module M( C( op1, op2 ) ) where
-- NB: op3 not exported
  class C a where
    op1, op2, op3 :: a -> a

module N where
  import qualified M as P( C )
  import qualified M as Q hiding( op2 )

  instance P.C Int where
    op1 x = x
    -- op2, op3 both illegal here

The point is that
  a) only methods that can be named are legal
     in the instance decl
(so op2, op3 are not legal)
  b) but it doesn't matter *how* they can be named
(in this case Q.op1 is in scope, though
the class is called P.C)

The AvailEnv carries the information about what's in scope,
so we now have to carry it around in the monad, so that
instance decl bindings can see it.  Quite simple really.

Same deal for export lists. E.g.

module N( P.C( op1 ) ) where
  import qualified M as P( C )
  import qualified M as Q hiding( op2 )

Actually this is what GHC has always implemented!

22 years ago[project @ 2001-12-06 10:45:14 by simonpj]
simonpj [Thu, 6 Dec 2001 10:45:14 +0000 (10:45 +0000)]
[project @ 2001-12-06 10:45:14 by simonpj]
Comments only

22 years ago[project @ 2001-12-06 10:17:35 by mbs]
mbs [Thu, 6 Dec 2001 10:17:36 +0000 (10:17 +0000)]
[project @ 2001-12-06 10:17:35 by mbs]
Established under cvs.

22 years ago[project @ 2001-12-06 10:00:01 by sewardj]
sewardj [Thu, 6 Dec 2001 10:00:01 +0000 (10:00 +0000)]
[project @ 2001-12-06 10:00:01 by sewardj]
Remove mention of PrimOpHelpers.h.

22 years ago[project @ 2001-12-06 09:21:31 by simonpj]
simonpj [Thu, 6 Dec 2001 09:21:32 +0000 (09:21 +0000)]
[project @ 2001-12-06 09:21:31 by simonpj]
Fix the simplIdInfo inconsistency Sigbjorn found

22 years ago[project @ 2001-12-06 08:24:36 by sof]
sof [Thu, 6 Dec 2001 08:24:36 +0000 (08:24 +0000)]
[project @ 2001-12-06 08:24:36 by sof]
package rts (mingw32): in installed mode, add gcc-lib/ to library_dirs,
forcing it to be used by default. This allows other backend tools to be
used (e.g., `dllwrap') without haphazardly mixing & matching (import)
libs.

MERGE TO STABLE.

22 years ago[project @ 2001-12-06 07:07:12 by sof]
sof [Thu, 6 Dec 2001 07:07:12 +0000 (07:07 +0000)]
[project @ 2001-12-06 07:07:12 by sof]
startupHaskell: if invoked more than once, do run initModules() each time,
as there might be more than one 'root module'.

22 years ago[project @ 2001-12-05 19:24:53 by sof]
sof [Wed, 5 Dec 2001 19:24:53 +0000 (19:24 +0000)]
[project @ 2001-12-05 19:24:53 by sof]
oops, changes not tested with a stage2 build

22 years ago[project @ 2001-12-05 17:35:12 by sewardj]
sewardj [Wed, 5 Dec 2001 17:35:15 +0000 (17:35 +0000)]
[project @ 2001-12-05 17:35:12 by sewardj]
--------------------------------------------
        Translate out PrimOps at the AbstractC level
        --------------------------------------------

This is the first in what might be a series of changes intended
to make GHC less dependent on its C back end.  The main change is
to translate PrimOps into vanilla abstract C inside the compiler,
rather than having to duplicate that work in each code generation
route.  The main changes are:

* A new type, MachOp, in compiler/absCSyn/MachOp.hs.  A MachOp
  is a primitive operation which we can reasonably expect the
  native code generators to implement.  The set is quite small
  and unlikely to change much, if at all.

* Translations from PrimOps to MachOps, at the end of
  absCSyn/AbsCUtils.  This should perhaps be moved to a different
  module, but it is hard to see how to do this without creating
  a circular dep between it and AbsCUtils.

* The x86 insn selector has been updated to track these changes.  The
  sparc insn selector remains to be done.

As a result of this, it is possible to compile much more code via the
NCG than before.  Almost all the Prelude can be compiled with it.
Currently it does not know how to do 64-bit code generation.  Once
this is fixed, the entire Prelude should be compilable that way.

I also took the opportunity to clean up the NCG infrastructure.
The old Stix data type has been split into StixStmt (statements)
and StixExpr (now denoting values only).  This removes a class
of impossible constructions and clarifies the NCG.

Still to do, in no particular order:

* String and literal lifting, currently done in the NCG at the top
  of nativeGen/MachCode, should be done in the AbstractC flattener,
  for the benefit of all targets.

* Further cleaning up of Stix assignments.

* Remove word-size dependency from Abstract C.  (should be easy).

* Translate out MagicIds in the AbsC -> Stix translation, not
  in the Stix constant folder. (!)

Testsuite failures caused by this:

* memo001 - fails (segfaults) for some unknown reason now.
* arith003 - wrong answer in gcdInt boundary cases.
* arith011 - wrong answer for shifts >= word size.
* cg044 - wrong answer for some FP boundary cases.

These should be fixed, but I don't think they are mission-critical for
anyone.

22 years ago[project @ 2001-12-05 17:21:43 by simonmar]
simonmar [Wed, 5 Dec 2001 17:21:43 +0000 (17:21 +0000)]
[project @ 2001-12-05 17:21:43 by simonmar]
Add -s flag to Happy if we have version 1.12+

22 years ago[project @ 2001-12-05 16:29:54 by sof]
sof [Wed, 5 Dec 2001 16:29:54 +0000 (16:29 +0000)]
[project @ 2001-12-05 16:29:54 by sof]
make it compile - i.e., use Subst.simplIdInfo in a manner
consistent with the repo contents. (wouldn't surprise me
if there's coreSyn/Subst.lhs change that hasn't been
committed yet...)

22 years ago[project @ 2001-12-05 15:00:21 by simonpj]
simonpj [Wed, 5 Dec 2001 15:00:21 +0000 (15:00 +0000)]
[project @ 2001-12-05 15:00:21 by simonpj]
Preserve IdInfo for strict binders

22 years ago[project @ 2001-12-05 13:52:19 by simonmar]
simonmar [Wed, 5 Dec 2001 13:52:19 +0000 (13:52 +0000)]
[project @ 2001-12-05 13:52:19 by simonmar]
Make some record selections strict to reduce space leaks.

22 years ago[project @ 2001-12-05 12:20:39 by simonmar]
simonmar [Wed, 5 Dec 2001 12:20:39 +0000 (12:20 +0000)]
[project @ 2001-12-05 12:20:39 by simonmar]
unbreak inputReady().

22 years ago[project @ 2001-12-05 11:05:21 by simonmar]
simonmar [Wed, 5 Dec 2001 11:05:21 +0000 (11:05 +0000)]
[project @ 2001-12-05 11:05:21 by simonmar]
Add seqDemand, seqDemands, seqDmdType and seqStrictSig.

22 years ago[project @ 2001-12-05 11:00:24 by simonmar]
simonmar [Wed, 5 Dec 2001 11:00:24 +0000 (11:00 +0000)]
[project @ 2001-12-05 11:00:24 by simonmar]
- fix a space leak in the cg_env passed back from the code generator
  to CoreTidy that was keeping the result of CoreToStg alive through
  code generation.

- some cost centre changes

22 years ago[project @ 2001-12-05 00:08:26 by sof]
sof [Wed, 5 Dec 2001 00:08:27 +0000 (00:08 +0000)]
[project @ 2001-12-05 00:08:26 by sof]
- new option, -keep-ilx-file, for stashing away ILX input.
- restrict ILX-specific code/defs to only be visible iff ILX is #defined.

22 years ago[project @ 2001-12-05 00:06:32 by sof]
sof [Wed, 5 Dec 2001 00:06:32 +0000 (00:06 +0000)]
[project @ 2001-12-05 00:06:32 by sof]
reuse Panic.showGhcException

22 years ago[project @ 2001-12-04 19:26:17 by sof]
sof [Tue, 4 Dec 2001 19:26:17 +0000 (19:26 +0000)]
[project @ 2001-12-04 19:26:17 by sof]
Enable the (already advertised) dependency generation options
--exclude-module=<mod> and -x <mod>.

22 years ago[project @ 2001-12-04 16:42:06 by sof]
sof [Tue, 4 Dec 2001 16:42:06 +0000 (16:42 +0000)]
[project @ 2001-12-04 16:42:06 by sof]
genPipeLine: DoMkDll didn't have a stop_phase, causing any use of
--mk-dll to fall over.

MERGE TO STABLE.

22 years ago[project @ 2001-12-04 11:54:02 by simonmar]
simonmar [Tue, 4 Dec 2001 11:54:02 +0000 (11:54 +0000)]
[project @ 2001-12-04 11:54:02 by simonmar]
Omit the whole file, not just the exports, if DEBUG is off.

22 years ago[project @ 2001-12-04 10:04:39 by sewardj]
sewardj [Tue, 4 Dec 2001 10:04:39 +0000 (10:04 +0000)]
[project @ 2001-12-04 10:04:39 by sewardj]
Update to follow the __init_Foo -> __stginit_Foo change.

22 years ago[project @ 2001-12-04 09:45:49 by sof]
sof [Tue, 4 Dec 2001 09:45:49 +0000 (09:45 +0000)]
[project @ 2001-12-04 09:45:49 by sof]
minor tidyup - move CollectedCCs tysyn to CostCentre (from SCCFinal), and
make use of it where that cost-centre info triple is being passed&returned.

22 years ago[project @ 2001-12-04 08:16:41 by sof]
sof [Tue, 4 Dec 2001 08:16:41 +0000 (08:16 +0000)]
[project @ 2001-12-04 08:16:41 by sof]
make it compile

22 years ago[project @ 2001-12-04 04:54:26 by keller]
keller [Tue, 4 Dec 2001 04:54:26 +0000 (04:54 +0000)]
[project @ 2001-12-04 04:54:26 by keller]
Sets the X11 C compiler and linker flags for package xlib correctly now

22 years ago[project @ 2001-12-04 04:47:38 by keller]
keller [Tue, 4 Dec 2001 04:47:38 +0000 (04:47 +0000)]
[project @ 2001-12-04 04:47:38 by keller]
added closing bracket at end of file

22 years ago[project @ 2001-12-03 22:44:48 by sof]
sof [Mon, 3 Dec 2001 22:44:48 +0000 (22:44 +0000)]
[project @ 2001-12-03 22:44:48 by sof]
Use the message queue friendly MsgWaitForMultipleObjects()

22 years ago[project @ 2001-12-03 20:59:08 by sof]
sof [Mon, 3 Dec 2001 20:59:08 +0000 (20:59 +0000)]
[project @ 2001-12-03 20:59:08 by sof]
Support IO.hWaitForInput on Win32 platforms (on file and socket handles).

22 years ago[project @ 2001-12-03 14:49:24 by sebc]
sebc [Mon, 3 Dec 2001 14:49:24 +0000 (14:49 +0000)]
[project @ 2001-12-03 14:49:24 by sebc]
On MacOS X, disable Apple's "smart" cpp

22 years ago[project @ 2001-12-03 14:34:45 by simonmar]
simonmar [Mon, 3 Dec 2001 14:34:45 +0000 (14:34 +0000)]
[project @ 2001-12-03 14:34:45 by simonmar]
Set the default heap profiling interval to something more sensible
(100ms).

22 years ago[project @ 2001-12-03 11:45:32 by simonpj]
simonpj [Mon, 3 Dec 2001 11:45:32 +0000 (11:45 +0000)]
[project @ 2001-12-03 11:45:32 by simonpj]
Dont fall over on data T deriving(Show)

22 years ago[project @ 2001-12-03 11:36:26 by simonpj]
simonpj [Mon, 3 Dec 2001 11:36:26 +0000 (11:36 +0000)]
[project @ 2001-12-03 11:36:26 by simonpj]
------------------------------------
Fix a tiresome and longstanding bug
in typechecking of unlifted bindings
------------------------------------

Consider

data T = MkT Int# Int#

f :: T -> Int#
f t = a +# b
    where
      MkT a b = if ... then t else t

This should really be OK, but if the "..." includes
some constraints, the constraint simplifier was trying to
generate some d1=d2 bindings. This is Bad because the desugarer
treats unlifted bindings very specially (they are strict).

This commit fixes the problem, by ensuring we never get
local dictionary binding for an unlifted group.

This fixes the bug which has been making the Alpha port fall
over with a pattern-match failure in DsExpr.  Nothing to do
with Alpha; it's just that the word-size change gave rise
to a little more commoning-up of literals in the type checker
which in turn made the desugarer it fall over.

22 years ago[project @ 2001-12-02 15:47:08 by panne]
panne [Sun, 2 Dec 2001 15:47:08 +0000 (15:47 +0000)]
[project @ 2001-12-02 15:47:08 by panne]
Hmmm, we probably should install HsStd.h, too. PackageSrc.hs mentions
it, and "make boot" in ghc/utils/hsc2hs fails without it. Perhaps this
should be fixed differently, but I can't figure out how to do this
correctly...

22 years ago[project @ 2001-11-30 15:14:43 by simonpj]
simonpj [Fri, 30 Nov 2001 15:14:43 +0000 (15:14 +0000)]
[project @ 2001-11-30 15:14:43 by simonpj]
Forget DmdEnv information after the work-wrap phase

22 years ago[project @ 2001-11-30 09:39:32 by simonpj]
simonpj [Fri, 30 Nov 2001 09:39:32 +0000 (09:39 +0000)]
[project @ 2001-11-30 09:39:32 by simonpj]
Print a bit more info if dsExpr fails for unlifted bindings

22 years ago[project @ 2001-11-30 09:32:27 by simonpj]
simonpj [Fri, 30 Nov 2001 09:32:28 +0000 (09:32 +0000)]
[project @ 2001-11-30 09:32:27 by simonpj]
Wibbles to rank-N

22 years ago[project @ 2001-11-29 16:38:13 by simonmar]
simonmar [Thu, 29 Nov 2001 16:38:13 +0000 (16:38 +0000)]
[project @ 2001-11-29 16:38:13 by simonmar]
Fix for heap profiling when selecting by lag/drag/void/use: I forgot
to make the final LdvCensusKillAll() call just before outputing the
census info.

Having tested this stuff on the compiler itself, I now declare it to
be working (famous last words!).

22 years ago[project @ 2001-11-29 13:47:09 by simonpj]
simonpj [Thu, 29 Nov 2001 13:47:12 +0000 (13:47 +0000)]
[project @ 2001-11-29 13:47:09 by simonpj]
------------------------------
Add linear implicit parameters
------------------------------

Linear implicit parameters are an idea developed by Koen Claessen,
Mark Shields, and Simon PJ, last week.  They address the long-standing
problem that monads seem over-kill for certain sorts of problem, notably:

* distributing a supply of unique names
* distributing a suppply of random numbers
* distributing an oracle (as in QuickCheck)

Linear implicit parameters are just like ordinary implicit parameters,
except that they are "linear" -- that is, they cannot be copied, and
must be explicitly "split" instead.  Linear implicit parameters are
written '%x' instead of '?x'.  (The '/' in the '%' suggests the
split!)

For example:

    data NameSupply = ...

    splitNS :: NameSupply -> (NameSupply, NameSupply)
    newName :: NameSupply -> Name

    instance PrelSplit.Splittable NameSupply where
split = splitNS

    f :: (%ns :: NameSupply) => Env -> Expr -> Expr
    f env (Lam x e) = Lam x' (f env e)
    where
      x'   = newName %ns
      env' = extend env x x'
    ...more equations for f...

Notice that the implicit parameter %ns is consumed
once by the call to newName
once by the recursive call to f

So the translation done by the type checker makes
the parameter explicit:

    f :: NameSupply -> Env -> Expr -> Expr
    f ns env (Lam x e) = Lam x' (f ns1 env e)
       where
   (ns1,ns2) = splitNS ns
 x' = newName ns2
 env = extend env x x'

Notice the call to 'split' introduced by the type checker.
How did it know to use 'splitNS'?  Because what it really did
was to introduce a call to the overloaded function 'split',
ndefined by

class Splittable a where
  split :: a -> (a,a)

The instance for Splittable NameSupply tells GHC how to implement
split for name supplies.  But we can simply write

g x = (x, %ns, %ns)

and GHC will infer

g :: (Splittable a, %ns :: a) => b -> (b,a,a)

The Splittable class is built into GHC.  It's defined in PrelSplit,
and exported by GlaExts.

Other points:

* '?x' and '%x' are entirely distinct implicit parameters: you
  can use them together and they won't intefere with each other.

* You can bind linear implicit parameters in 'with' clauses.

* You cannot have implicit parameters (whether linear or not)
  in the context of a class or instance declaration.

Warnings
~~~~~~~~
The monomorphism restriction is even more important than usual.
Consider the example above:

    f :: (%ns :: NameSupply) => Env -> Expr -> Expr
    f env (Lam x e) = Lam x' (f env e)
    where
      x'   = newName %ns
      env' = extend env x x'

If we replaced the two occurrences of x' by (newName %ns), which is
usually a harmless thing to do, we get:

    f :: (%ns :: NameSupply) => Env -> Expr -> Expr
    f env (Lam x e) = Lam (newName %ns) (f env e)
    where
      env' = extend env x (newName %ns)

But now the name supply is consumed in *three* places
(the two calls to newName,and the recursive call to f), so
the result is utterly different.  Urk!  We don't even have
the beta rule.

Well, this is an experimental change.  With implicit
parameters we have already lost beta reduction anyway, and
(as John Launchbury puts it) we can't sensibly reason about
Haskell programs without knowing their typing.

Of course, none of this is throughly tested, either.

22 years ago[project @ 2001-11-29 12:20:08 by simonpj]
simonpj [Thu, 29 Nov 2001 12:20:08 +0000 (12:20 +0000)]
[project @ 2001-11-29 12:20:08 by simonpj]
Wibble in TcPat; fixes the stage2 build problem in AsmCodeGen

22 years ago[project @ 2001-11-28 17:45:13 by simonmar]
simonmar [Wed, 28 Nov 2001 17:45:13 +0000 (17:45 +0000)]
[project @ 2001-11-28 17:45:13 by simonmar]
oops, I broke standard -hb profiles.  Unbreak them again.

22 years ago[project @ 2001-11-28 15:43:23 by simonmar]
simonmar [Wed, 28 Nov 2001 15:43:23 +0000 (15:43 +0000)]
[project @ 2001-11-28 15:43:23 by simonmar]
Make it work in a DEBUG world again (when DEBUG is on we have ancient
support for doing a heap profile based on info-tables - it is still
there, but I haven't tested it).

22 years ago[project @ 2001-11-28 15:42:26 by simonmar]
simonmar [Wed, 28 Nov 2001 15:42:26 +0000 (15:42 +0000)]
[project @ 2001-11-28 15:42:26 by simonmar]
Don't need the .prof file when LDV-profiling.

22 years ago[project @ 2001-11-28 15:42:05 by simonmar]
simonmar [Wed, 28 Nov 2001 15:42:05 +0000 (15:42 +0000)]
[project @ 2001-11-28 15:42:05 by simonmar]
Fix the test for calling LdvCensusForDead().

22 years ago[project @ 2001-11-28 15:01:02 by simonmar]
simonmar [Wed, 28 Nov 2001 15:01:02 +0000 (15:01 +0000)]
[project @ 2001-11-28 15:01:02 by simonmar]
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.

22 years ago[project @ 2001-11-28 14:55:34 by simonmar]
simonmar [Wed, 28 Nov 2001 14:55:34 +0000 (14:55 +0000)]
[project @ 2001-11-28 14:55:34 by simonmar]
The curly braces around heap profile selectors are now optional (and
deprecated).

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.

22 years ago[project @ 2001-11-28 14:47:54 by simonmar]
simonmar [Wed, 28 Nov 2001 14:47:54 +0000 (14:47 +0000)]
[project @ 2001-11-28 14:47:54 by simonmar]
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.

22 years ago[project @ 2001-11-28 14:31:27 by simonmar]
simonmar [Wed, 28 Nov 2001 14:31:27 +0000 (14:31 +0000)]
[project @ 2001-11-28 14:31:27 by simonmar]
Revert previous commit:  I accidentally committed my local version of
this file which has BLOCK_SIZE set to 2k rather than 4k (for testing).

22 years ago[project @ 2001-11-28 14:30:32 by simonmar]
simonmar [Wed, 28 Nov 2001 14:30:32 +0000 (14:30 +0000)]
[project @ 2001-11-28 14:30:32 by simonmar]
Add a non-inline version of Bdescr() for use in gdb.

22 years ago[project @ 2001-11-28 14:29:59 by simonmar]
simonmar [Wed, 28 Nov 2001 14:29:59 +0000 (14:29 +0000)]
[project @ 2001-11-28 14:29:59 by simonmar]
Don't close the stats file if it is stderr.

22 years ago[project @ 2001-11-28 14:29:33 by simonmar]
simonmar [Wed, 28 Nov 2001 14:29:33 +0000 (14:29 +0000)]
[project @ 2001-11-28 14:29:33 by simonmar]
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.

22 years ago[project @ 2001-11-27 16:35:57 by simonmar]
simonmar [Tue, 27 Nov 2001 16:35:57 +0000 (16:35 +0000)]
[project @ 2001-11-27 16:35:57 by simonmar]
Fix thinko.  Timing stats should add up properly again.

22 years ago[project @ 2001-11-27 15:30:06 by simonmar]
simonmar [Tue, 27 Nov 2001 15:30:06 +0000 (15:30 +0000)]
[project @ 2001-11-27 15:30:06 by simonmar]
Don't forget about the "MANY" retainer set when dumping a retainer profile.

22 years ago[project @ 2001-11-27 14:58:44 by sof]
sof [Tue, 27 Nov 2001 14:58:44 +0000 (14:58 +0000)]
[project @ 2001-11-27 14:58:44 by sof]
Just in case, constrain /cygdrive/<foo>/ hardtop transformation to
only apply at the root of the path.

22 years ago[project @ 2001-11-27 14:49:10 by simonmar]
simonmar [Tue, 27 Nov 2001 14:49:10 +0000 (14:49 +0000)]
[project @ 2001-11-27 14:49:10 by simonmar]
GC unused imports

22 years ago[project @ 2001-11-27 12:29:44 by simonmar]
simonmar [Tue, 27 Nov 2001 12:29:44 +0000 (12:29 +0000)]
[project @ 2001-11-27 12:29:44 by simonmar]
The notes at the top of this file were wrong, and totally confusing.
As far as I can tell, they never matched reality.

This commit up the comments, and adds a warning about editing this
file directly (a common mistake with fptools newbies).

22 years ago[project @ 2001-11-27 11:23:44 by simonmar]
simonmar [Tue, 27 Nov 2001 11:23:44 +0000 (11:23 +0000)]
[project @ 2001-11-27 11:23:44 by simonmar]
Add a DEBUG catch-all case in do_expr.

22 years ago[project @ 2001-11-27 10:03:51 by simonpj]
simonpj [Tue, 27 Nov 2001 10:03:51 +0000 (10:03 +0000)]
[project @ 2001-11-27 10:03:51 by simonpj]
Wibble in hi-boot file

22 years ago[project @ 2001-11-27 10:03:36 by simonpj]
simonpj [Tue, 27 Nov 2001 10:03:36 +0000 (10:03 +0000)]
[project @ 2001-11-27 10:03:36 by simonpj]
Behave better in decode_escape failure

22 years ago[project @ 2001-11-27 07:49:15 by sof]
sof [Tue, 27 Nov 2001 07:49:15 +0000 (07:49 +0000)]
[project @ 2001-11-27 07:49:15 by sof]
hardtop: newer versions of bash (and ash) have 'pwd' return paths
of the following form: /cygdrive/<drive>/<rest>

Transform these into <drive>:/<rest>, as that format is easier to
work with under mingw.

22 years ago[project @ 2001-11-27 01:57:59 by sof]
sof [Tue, 27 Nov 2001 01:57:59 +0000 (01:57 +0000)]
[project @ 2001-11-27 01:57:59 by sof]
make prev. commit compile on non-win32 boxes

22 years ago[project @ 2001-11-27 01:53:23 by sof]
sof [Tue, 27 Nov 2001 01:53:23 +0000 (01:53 +0000)]
[project @ 2001-11-27 01:53:23 by sof]
removed ToDo comment + braino

22 years ago[project @ 2001-11-27 01:51:23 by sof]
sof [Tue, 27 Nov 2001 01:51:23 +0000 (01:51 +0000)]
[project @ 2001-11-27 01:51:23 by sof]
Rearranged how the virtual timer 'subsystem' is brought up and down:

* "int startVirtTimer(nat ms)" now starts the vtimer/ticker.
* "int stopVirtTimer()" shuts down the ticker.

i.e., removed install_vtalrm_handler() and initialize_virtual_timer().

22 years ago[project @ 2001-11-27 00:18:59 by sof]
sof [Tue, 27 Nov 2001 00:18:59 +0000 (00:18 +0000)]
[project @ 2001-11-27 00:18:59 by sof]
track 5.03's change to PrelHandle.fillReadBuffer

22 years ago[project @ 2001-11-26 23:56:04 by sof]
sof [Mon, 26 Nov 2001 23:56:04 +0000 (23:56 +0000)]
[project @ 2001-11-26 23:56:04 by sof]
have happy-inplace rule depend on glafp-utils/

22 years ago[project @ 2001-11-26 23:55:27 by sof]
sof [Mon, 26 Nov 2001 23:55:27 +0000 (23:55 +0000)]
[project @ 2001-11-26 23:55:27 by sof]
make it work on non-mingw platforms

22 years ago[project @ 2001-11-26 20:04:00 by sof]
sof [Mon, 26 Nov 2001 20:04:00 +0000 (20:04 +0000)]
[project @ 2001-11-26 20:04:00 by sof]
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
made:

* 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).

22 years ago[project @ 2001-11-26 19:43:23 by sof]
sof [Mon, 26 Nov 2001 19:43:23 +0000 (19:43 +0000)]
[project @ 2001-11-26 19:43:23 by sof]
win32 only - provide closeFd, which closes a file descriptor, be it of
file or socket ilk.

22 years ago[project @ 2001-11-26 16:54:21 by simonmar]
simonmar [Mon, 26 Nov 2001 16:54:22 +0000 (16:54 +0000)]
[project @ 2001-11-26 16:54:21 by simonmar]
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.

Value-adds:

   - you can now restrict a heap profile to certain retainer sets,
     but still display by cost centre (or type, or closure or
     whatever).

   - 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.

22 years ago[project @ 2001-11-26 16:37:33 by sof]
sof [Mon, 26 Nov 2001 16:37:33 +0000 (16:37 +0000)]
[project @ 2001-11-26 16:37:33 by sof]
fdType: clarify that this op will fail with non-file handles/descriptors
        under Win32.

22 years ago[project @ 2001-11-26 13:06:49 by simonmar]
simonmar [Mon, 26 Nov 2001 13:06:49 +0000 (13:06 +0000)]
[project @ 2001-11-26 13:06:49 by simonmar]
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.

22 years ago[project @ 2001-11-26 12:58:17 by simonpj]
simonpj [Mon, 26 Nov 2001 12:58:17 +0000 (12:58 +0000)]
[project @ 2001-11-26 12:58:17 by simonpj]
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?

22 years ago[project @ 2001-11-26 10:33:40 by simonpj]
simonpj [Mon, 26 Nov 2001 10:33:40 +0000 (10:33 +0000)]
[project @ 2001-11-26 10:33:40 by simonpj]
Complete previous tcAddImportedIdInfo commit

22 years ago[project @ 2001-11-26 10:30:15 by simonpj]
simonpj [Mon, 26 Nov 2001 10:30:15 +0000 (10:30 +0000)]
[project @ 2001-11-26 10:30:15 by simonpj]
Improve error reporting

22 years ago[project @ 2001-11-26 10:27:14 by simonpj]
simonpj [Mon, 26 Nov 2001 10:27:14 +0000 (10:27 +0000)]
[project @ 2001-11-26 10:27:14 by simonpj]
Comments only

22 years ago[project @ 2001-11-26 10:26:59 by simonpj]
simonpj [Mon, 26 Nov 2001 10:26:59 +0000 (10:26 +0000)]
[project @ 2001-11-26 10:26:59 by simonpj]
--------------------------------------
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.

22 years ago[project @ 2001-11-26 09:22:05 by simonpj]
simonpj [Mon, 26 Nov 2001 09:22:05 +0000 (09:22 +0000)]
[project @ 2001-11-26 09:22:05 by simonpj]
Add missing files for Rank-N commit

22 years ago[project @ 2001-11-26 09:20:25 by simonpj]
simonpj [Mon, 26 Nov 2001 09:20:28 +0000 (09:20 +0000)]
[project @ 2001-11-26 09:20:25 by simonpj]
----------------------
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
  like
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
  example:

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
TcUnify.tcSub
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
file).

All of this doesn't come entirely for free.  Here's the typechecker
line count (INCLUDING comments)
Before 16,551
After 17,116

22 years ago[project @ 2001-11-26 08:31:05 by chak]
chak [Mon, 26 Nov 2001 08:31:05 +0000 (08:31 +0000)]
[project @ 2001-11-26 08:31:05 by chak]
Added a new section that describes how GHC defines its hardwired knowledge
about primitives and special prelude definitions.

22 years ago[project @ 2001-11-25 16:59:11 by sof]
sof [Sun, 25 Nov 2001 16:59:11 +0000 (16:59 +0000)]
[project @ 2001-11-25 16:59:11 by sof]
Tidyup - only declare&use half-a-dozen prof-only global variables
when PROFILING.

22 years ago[project @ 2001-11-25 16:57:38 by sof]
sof [Sun, 25 Nov 2001 16:57:38 +0000 (16:57 +0000)]
[project @ 2001-11-25 16:57:38 by sof]
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.

22 years ago[project @ 2001-11-25 03:56:39 by sof]
sof [Sun, 25 Nov 2001 03:56:39 +0000 (03:56 +0000)]
[project @ 2001-11-25 03:56:39 by sof]
extend the scope of the doNothing() macro; can now be used in Stg headers

22 years ago[project @ 2001-11-23 16:20:08 by simonpj]
simonpj [Fri, 23 Nov 2001 16:20:08 +0000 (16:20 +0000)]
[project @ 2001-11-23 16:20:08 by simonpj]
Put spaces round %, in preparation for splittable name supplies

22 years ago[project @ 2001-11-23 15:43:39 by simonmar]
simonmar [Fri, 23 Nov 2001 15:43:39 +0000 (15:43 +0000)]
[project @ 2001-11-23 15:43:39 by simonmar]
unbreak tcModule.

22 years ago[project @ 2001-11-23 12:06:49 by simonmar]
simonmar [Fri, 23 Nov 2001 12:06:49 +0000 (12:06 +0000)]
[project @ 2001-11-23 12:06:49 by simonmar]
Use (DefMeth Name) rather than (DefMeth Id) in ClassOpItem.  This not
only eliminates a space leak, because Names generally hold on to much
less stuff than Ids, but also turns out to be a minor cleanup.