ghc-hetmet.git
22 years ago[project @ 2002-04-23 06:19:06 by sof]
sof [Tue, 23 Apr 2002 06:19:06 +0000 (06:19 +0000)]
[project @ 2002-04-23 06:19:06 by sof]
Simplified yieldToReturningWorker(), no need to have OS thread yield

22 years ago[project @ 2002-04-22 16:06:35 by simonpj]
simonpj [Mon, 22 Apr 2002 16:06:37 +0000 (16:06 +0000)]
[project @ 2002-04-22 16:06:35 by simonpj]
CPR control

1.  Remove -fno-cpr, add -fcpr-off which is a simple static flag
    for switching the new CPR analysis off altogether.
    (The "-fno" machinery is rather complicated.)

2.  Rejig SimplCore a little so that the "old strictness analyser"
    runs both the old strictness analyser and the old CPR analyser,
    which makes it more like the new strictness/CPR analyser.

    (How much longer we keep the old strictness/CPR analyser in the
    compiler at all I don't know.  It's just for comparision purposes
    when we write the paper.)

22 years ago[project @ 2002-04-22 14:54:09 by simonmar]
simonmar [Mon, 22 Apr 2002 14:54:10 +0000 (14:54 +0000)]
[project @ 2002-04-22 14:54:09 by simonmar]
Define out-of-line versions of strlen and memcmp for PrimPacked, and
remove the -monly-2-regs flag.

22 years ago[project @ 2002-04-22 14:35:02 by simonmar]
simonmar [Mon, 22 Apr 2002 14:35:02 +0000 (14:35 +0000)]
[project @ 2002-04-22 14:35:02 by simonmar]
temporary fix for PrimPacked compilation problems.

22 years ago[project @ 2002-04-22 14:24:55 by simonmar]
simonmar [Mon, 22 Apr 2002 14:24:55 +0000 (14:24 +0000)]
[project @ 2002-04-22 14:24:55 by simonmar]
Doc --force.

22 years ago[project @ 2002-04-22 14:20:41 by simonmar]
simonmar [Mon, 22 Apr 2002 14:20:41 +0000 (14:20 +0000)]
[project @ 2002-04-22 14:20:41 by simonmar]
Add a --force option to ignore errors about missing directories and libraries.

22 years ago[project @ 2002-04-22 13:50:40 by simonmar]
simonmar [Mon, 22 Apr 2002 13:50:40 +0000 (13:50 +0000)]
[project @ 2002-04-22 13:50:40 by simonmar]
Note the lack of quoting support in :set.

22 years ago[project @ 2002-04-22 13:08:34 by simonmar]
simonmar [Mon, 22 Apr 2002 13:08:34 +0000 (13:08 +0000)]
[project @ 2002-04-22 13:08:34 by simonmar]
Throw out OpApp patterns where the operator is not a constructor here,
rather than later in the typechecker(!).

22 years ago[project @ 2002-04-22 11:50:21 by simonpj]
simonpj [Mon, 22 Apr 2002 11:50:21 +0000 (11:50 +0000)]
[project @ 2002-04-22 11:50:21 by simonpj]
Do forall-hoisting recursively

22 years ago[project @ 2002-04-22 04:40:25 by ken]
ken [Mon, 22 Apr 2002 04:40:25 +0000 (04:40 +0000)]
[project @ 2002-04-22 04:40:25 by ken]
Replace strncmp() with memcmp() for comparing non-zero-terminated strings.

22 years ago[project @ 2002-04-22 00:53:59 by chak]
chak [Mon, 22 Apr 2002 00:53:59 +0000 (00:53 +0000)]
[project @ 2002-04-22 00:53:59 by chak]
Added Sigbjorn to authors list

22 years ago[project @ 2002-04-19 12:37:48 by simonmar]
simonmar [Fri, 19 Apr 2002 12:37:48 +0000 (12:37 +0000)]
[project @ 2002-04-19 12:37:48 by simonmar]
Update the system requirements section to mention Alpha and
PowerPC/MacOSX lest I forget later.

22 years ago[project @ 2002-04-19 12:31:07 by simonmar]
simonmar [Fri, 19 Apr 2002 12:31:07 +0000 (12:31 +0000)]
[project @ 2002-04-19 12:31:07 by simonmar]
Improve the code that finds the text/data section boundaries on
MacOS/X, from Wolfgang Thaller.

22 years ago[project @ 2002-04-19 12:27:51 by simonmar]
simonmar [Fri, 19 Apr 2002 12:27:51 +0000 (12:27 +0000)]
[project @ 2002-04-19 12:27:51 by simonmar]
MacOS/X fixes, from Wolfgang Thaller.

22 years ago[project @ 2002-04-19 12:26:47 by simonmar]
simonmar [Fri, 19 Apr 2002 12:26:47 +0000 (12:26 +0000)]
[project @ 2002-04-19 12:26:47 by simonmar]
#include "../includes/config.h", because we use WORDS_BIGENDIAN.

(from Wolfgang Thaller)

22 years ago[project @ 2002-04-19 12:25:06 by simonmar]
simonmar [Fri, 19 Apr 2002 12:25:06 +0000 (12:25 +0000)]
[project @ 2002-04-19 12:25:06 by simonmar]
MacOS/X fixes, from Wolfgang Thaller.

22 years ago[project @ 2002-04-19 12:23:11 by simonmar]
simonmar [Fri, 19 Apr 2002 12:23:11 +0000 (12:23 +0000)]
[project @ 2002-04-19 12:23:11 by simonmar]
Update this file to not use ISO C99 labelled initializers - this means
it will compile on MacOS/X.

22 years ago[project @ 2002-04-19 10:25:00 by simonmar]
simonmar [Fri, 19 Apr 2002 10:25:00 +0000 (10:25 +0000)]
[project @ 2002-04-19 10:25:00 by simonmar]
- traverse_weak_ptr_list(): Deal with EVACUATED objects on the weak
  pointer list.

- mark_weak_ptr_list(): add an assertion.

22 years ago[project @ 2002-04-19 10:23:43 by simonmar]
simonmar [Fri, 19 Apr 2002 10:23:43 +0000 (10:23 +0000)]
[project @ 2002-04-19 10:23:43 by simonmar]
Skip over DEAD_WEAK objects when starting finalizers.

22 years ago[project @ 2002-04-19 10:22:58 by simonmar]
simonmar [Fri, 19 Apr 2002 10:22:58 +0000 (10:22 +0000)]
[project @ 2002-04-19 10:22:58 by simonmar]
Update the comment next to DEAD_WEAK

22 years ago[project @ 2002-04-19 10:15:22 by simonmar]
simonmar [Fri, 19 Apr 2002 10:15:22 +0000 (10:15 +0000)]
[project @ 2002-04-19 10:15:22 by simonmar]
A WEAK pointer gets turned into a DEAD_WEAK by the finalizeWeak#
primop.  It's important that we keep all the fields of the original
WEAK pointer when this happens, so as not to break the linked list of
weak pointers.  Hence, we give the payload size of DEAD_WEAK as 4
non-pointers instead of just 1.

22 years ago[project @ 2002-04-18 19:12:43 by ken]
ken [Thu, 18 Apr 2002 19:12:43 +0000 (19:12 +0000)]
[project @ 2002-04-18 19:12:43 by ken]
Save $gp in StgRun() on the Alpha

22 years ago[project @ 2002-04-18 12:15:56 by simonmar]
simonmar [Thu, 18 Apr 2002 12:15:56 +0000 (12:15 +0000)]
[project @ 2002-04-18 12:15:56 by simonmar]
Check the exit status of the generated C program when we run it, and
exit if it failed (partly from Axel Simon).

22 years ago[project @ 2002-04-18 11:27:59 by simonmar]
simonmar [Thu, 18 Apr 2002 11:27:59 +0000 (11:27 +0000)]
[project @ 2002-04-18 11:27:59 by simonmar]
Don't use doesFileExist on mingw32 as a replacement for checkPerms -
the argument might be a directory, in which case the result will be
False.  Just return True instead - if the file/directory doesn't
exist, the open operation will fail later.

22 years ago[project @ 2002-04-16 21:29:00 by ken]
ken [Tue, 16 Apr 2002 21:29:00 +0000 (21:29 +0000)]
[project @ 2002-04-16 21:29:00 by ken]
Use $(MAKE) rather than literal "make" when making happy-inplace

22 years ago[project @ 2002-04-13 15:06:37 by panne]
panne [Sat, 13 Apr 2002 15:06:37 +0000 (15:06 +0000)]
[project @ 2002-04-13 15:06:37 by panne]
readRational__ has vanished, cut-n-paste to the rescue!
(Is there something similar in the new Read machinery??)

22 years ago[project @ 2002-04-13 15:02:35 by panne]
panne [Sat, 13 Apr 2002 15:02:35 +0000 (15:02 +0000)]
[project @ 2002-04-13 15:02:35 by panne]
Dirty workaround for a strange error after bootstrapping:

   stgSyn/CoreToStg.lhs:1112:
       Couldn't match `#' against `*'
       When matching types `GHC.Prim.Int#' and `a'
   Expected type: GHC.Prim.Int#
           Inferred type: a
   In the application `error ("cafRefs " ++ (showSDoc (ppr id)))'

Should be fixed elsewhere, but I don't know how... :-}

22 years ago[project @ 2002-04-13 13:34:03 by sof]
sof [Sat, 13 Apr 2002 13:34:03 +0000 (13:34 +0000)]
[project @ 2002-04-13 13:34:03 by sof]
Calling-in section: clarify truth vs. fiction

22 years ago[project @ 2002-04-13 05:43:42 by sof]
sof [Sat, 13 Apr 2002 05:43:43 +0000 (05:43 +0000)]
[project @ 2002-04-13 05:43:42 by sof]
added design/impl doc describing ConcHask MT extension

22 years ago[project @ 2002-04-13 05:33:02 by sof]
sof [Sat, 13 Apr 2002 05:33:03 +0000 (05:33 +0000)]
[project @ 2002-04-13 05:33:02 by sof]
- clarified/fixed sched_mutex locking problems when
  calling raiseAsync() from withing the bowels of the Scheduler.
- we now yieldToReturningWorker() as part of the main Scheduler
  loop.
- simplified grabCapability() and waitForWorkCapability() usage.

22 years ago[project @ 2002-04-13 05:28:04 by sof]
sof [Sat, 13 Apr 2002 05:28:04 +0000 (05:28 +0000)]
[project @ 2002-04-13 05:28:04 by sof]
entry points that scheduled/created an external thread weren't correctly blocking on the TSO condition variable; now fixed.

22 years ago[project @ 2002-04-13 05:25:38 by sof]
sof [Sat, 13 Apr 2002 05:25:38 +0000 (05:25 +0000)]
[project @ 2002-04-13 05:25:38 by sof]
yieldToReturningWorker(): once yielded to a returning worker,
thread now directly waits for capability to become available
again (via waitForWorkCapability()) -- simplifies Cap. grabbing
'logic' in the Scheduler.

grabReturnCapability(): assume pMutex is held upon entry.

22 years ago[project @ 2002-04-13 05:18:07 by sof]
sof [Sat, 13 Apr 2002 05:18:07 +0000 (05:18 +0000)]
[project @ 2002-04-13 05:18:07 by sof]
fixed config of PACKAGE_CPP_OPTS in DEBUG mode

22 years ago[project @ 2002-04-13 05:17:11 by sof]
sof [Sat, 13 Apr 2002 05:17:11 +0000 (05:17 +0000)]
[project @ 2002-04-13 05:17:11 by sof]
debug versions of ACQUIRE_LOCK() and RELEASE_LOCK() macros

22 years ago[project @ 2002-04-13 05:16:25 by sof]
sof [Sat, 13 Apr 2002 05:16:25 +0000 (05:16 +0000)]
[project @ 2002-04-13 05:16:25 by sof]
GarbageCollect(): thread resurrection now assumes sched_mutex is held

22 years ago[project @ 2002-04-12 04:00:35 by sof]
sof [Fri, 12 Apr 2002 04:00:35 +0000 (04:00 +0000)]
[project @ 2002-04-12 04:00:35 by sof]
getMBlocks(): if we run into a ENOMEM situation, report blocks requested

22 years ago[project @ 2002-04-12 03:52:31 by sof]
sof [Fri, 12 Apr 2002 03:52:31 +0000 (03:52 +0000)]
[project @ 2002-04-12 03:52:31 by sof]
quibble

22 years ago[project @ 2002-04-11 12:03:29 by simonpj]
simonpj [Thu, 11 Apr 2002 12:03:45 +0000 (12:03 +0000)]
[project @ 2002-04-11 12:03:29 by simonpj]
-------------------
Mainly derived Read
-------------------

This commit is a tangle of several things that somehow got wound up
together, I'm afraid.

The main course
~~~~~~~~~~~~~~~
Replace the derived-Read machinery with Koen's cunning new parser
combinator library.   The result should be
* much smaller code sizes from derived Read
* faster execution of derived Read

WARNING: I have not thoroughly tested this stuff; I'd be glad if you did!
 All the hard work is done, but there may be a few nits.

The Read class gets two new methods, not exposed
in the H98 inteface of course:
  class Read a where
    readsPrec    :: Int -> ReadS a
    readList     :: ReadS [a]
    readPrec     :: ReadPrec a -- NEW
    readListPrec :: ReadPrec [a] -- NEW

There are the following new libraries:

  Text.ParserCombinators.ReadP Koens combinator parser
  Text.ParserCombinators.ReadPrec Ditto, but with precedences

  Text.Read.Lex An emasculated lexical analyser
that provides the functionality
of H98 'lex'

TcGenDeriv is changed to generate code that uses the new libraries.
The built-in instances of Read (List, Maybe, tuples, etc) use the new
libraries.

Other stuff
~~~~~~~~~~~
1. Some fixes the the plumbing of external-core generation. Sigbjorn
did most of the work earlier, but this commit completes the renaming and
typechecking plumbing.

2. Runtime error-generation functions, such as GHC.Err.recSelErr,
GHC.Err.recUpdErr, etc, now take an Addr#, pointing to a UTF8-encoded
C string, instead of a Haskell string.  This makes the *calls* to these
functions easier to generate, and smaller too, which is a good thing.

In particular, it means that MkId.mkRecordSelectorId doesn't need to
be passed "unpackCStringId", which was GRUESOME; and that in turn means
that tcTypeAndClassDecls doesn't need to be passed unf_env, which is
a very worthwhile cleanup.   Win/win situation.

3.  GHC now faithfully translates do-notation using ">>" for statements
with no binding, just as the report says.  While I was there I tidied
up HsDo to take a list of Ids instead of 3 (but now 4) separate Ids.
Saves a bit of code here and there.  Also introduced Inst.newMethodFromName
to package a common idiom.

22 years ago[project @ 2002-04-11 12:01:13 by simonpj]
simonpj [Thu, 11 Apr 2002 12:01:13 +0000 (12:01 +0000)]
[project @ 2002-04-11 12:01:13 by simonpj]
Add stuff about non-blocking I/O for Win32

22 years ago[project @ 2002-04-11 11:59:39 by simonmar]
simonmar [Thu, 11 Apr 2002 11:59:39 +0000 (11:59 +0000)]
[project @ 2002-04-11 11:59:39 by simonmar]
add missing file to source dist

22 years ago[project @ 2002-04-11 08:39:27 by simonmar]
simonmar [Thu, 11 Apr 2002 08:39:27 +0000 (08:39 +0000)]
[project @ 2002-04-11 08:39:27 by simonmar]
Fix some wibbles with the :m command

22 years ago[project @ 2002-04-10 13:52:49 by simonpj]
simonpj [Wed, 10 Apr 2002 13:52:49 +0000 (13:52 +0000)]
[project @ 2002-04-10 13:52:49 by simonpj]
Make the earlier context-simplification loop-detection fix work properly

22 years ago[project @ 2002-04-10 13:09:39 by simonmar]
simonmar [Wed, 10 Apr 2002 13:09:39 +0000 (13:09 +0000)]
[project @ 2002-04-10 13:09:39 by simonmar]
(from Simon P.J) Make generics work with zero-constructor datatypes.

22 years ago[project @ 2002-04-10 11:43:43 by stolz]
stolz [Wed, 10 Apr 2002 11:43:49 +0000 (11:43 +0000)]
[project @ 2002-04-10 11:43:43 by stolz]
Two new scheduler-API primops:

1) GHC.Conc.forkProcess/forkProcess# :: IO Int
   This is a low-level call to fork() to replace Posix.forkProcess().
   In a Concurrent Haskell setting, only the thread invoking forkProcess()
   is alive in the child process. Other threads will be GC'ed!
      This brings the RTS closer to pthreads, where a call to fork()
   doesn't clone any pthreads, either.
      The result is 0 for the child and the child's pid for the parent.
   The primop will barf() when used on mingw32, sorry.

2) GHC.Conc.labelThread/forkProcess# :: String -> IO ()
   Useful for scheduler debugging: If the RTS is compiled with DEBUGging
   support, this primitive assigns a name to the current thread which
   will be used in debugging output (+RTS -D1). For larger applications,
   simply numbering threads is not sufficient.
     Notice: The Haskell side of this call is always available, but if
   you are not compiling with debugging support, the actual primop will
   turn into a no-op.

22 years ago[project @ 2002-04-10 09:49:47 by simonmar]
simonmar [Wed, 10 Apr 2002 09:49:47 +0000 (09:49 +0000)]
[project @ 2002-04-10 09:49:47 by simonmar]
Don't claim that i386-unknown-cygwin32 is supported, replace it with
i386-unknown-mingw32.

(the build docs for Win32 are probably also out of date, but I didn't
touch those)

22 years ago[project @ 2002-04-10 09:41:16 by simonmar]
simonmar [Wed, 10 Apr 2002 09:41:16 +0000 (09:41 +0000)]
[project @ 2002-04-10 09:41:16 by simonmar]
Currently configure falls over if $srcdir/ghc exists and Happy >= 1.9
can't be found.  For a source distribution this is too paranoid,
because we ship the Happy-generated .hs files with the sources.  Now
we ignore a missing Happy if ghc/compiler/parser/Parser.hs exists,
which should be a reasonable heuristic.

22 years ago[project @ 2002-04-09 12:56:36 by simonmar]
simonmar [Tue, 9 Apr 2002 12:56:36 +0000 (12:56 +0000)]
[project @ 2002-04-09 12:56:36 by simonmar]
If we free a StablePtr which has no StableName attached, then just
add its entry to the free list immediately, rather than waiting for
the garbage collector to free it.

22 years ago[project @ 2002-04-09 12:55:11 by simonmar]
simonmar [Tue, 9 Apr 2002 12:55:11 +0000 (12:55 +0000)]
[project @ 2002-04-09 12:55:11 by simonmar]
- Revert rev. 1.7, i.e. go back to using malloc/free and a free list
  to manage hash list cells, because the arena method doesn't recycle
  used cells, resulting in memory leaks.

- Add a freeHashList() call which was missing in removeHashTable().

22 years ago[project @ 2002-04-09 11:00:11 by njn]
njn [Tue, 9 Apr 2002 11:00:11 +0000 (11:00 +0000)]
[project @ 2002-04-09 11:00:11 by njn]
Removed the unnecessary arg from TICK_ENT_{STATIC,DYN}_THK macros in the
"#ifdef TICKY_TICKY" case.  This meant the libraries would not compile with
way=t for SimonPJ even though they did for me...

22 years ago[project @ 2002-04-08 19:28:39 by sof]
sof [Mon, 8 Apr 2002 19:28:39 +0000 (19:28 +0000)]
[project @ 2002-04-08 19:28:39 by sof]
renameExtCore: bring locally defined names into scope before closing up

22 years ago[project @ 2002-04-08 08:25:55 by simonpj]
simonpj [Mon, 8 Apr 2002 08:25:55 +0000 (08:25 +0000)]
[project @ 2002-04-08 08:25:55 by simonpj]
Import notNull

22 years ago[project @ 2002-04-05 23:24:25 by sof]
sof [Fri, 5 Apr 2002 23:24:31 +0000 (23:24 +0000)]
[project @ 2002-04-05 23:24:25 by sof]
Friday afternoon pet peeve removal: define (Util.notNull :: [a] -> Bool) and use it

22 years ago[project @ 2002-04-05 16:43:56 by sof]
sof [Fri, 5 Apr 2002 16:43:56 +0000 (16:43 +0000)]
[project @ 2002-04-05 16:43:56 by sof]
Catch the use of non-existent output directories &
report this back to the user. By not doing this, we relied
on external tools (such as the linker or assembler) to give
good feedback about this error condition -- this wasn't
the case (cf. GAS on mingw/cygwin.)

To insert more sanity checks of the effective options
(to the batch compiler), use Main.checkOptions

22 years ago[project @ 2002-04-05 15:18:25 by sof]
sof [Fri, 5 Apr 2002 15:18:27 +0000 (15:18 +0000)]
[project @ 2002-04-05 15:18:25 by sof]
Cleaned up the way the External Core front-end was
integrated with the rest of the compiler;
guided by detailed and helpful feedback from Simon PJ.

Input files ending in ".hcr" are now assumed to contain
external core -- still working on getting the renamer
to slurp in interface files (implicitly) referred to
in the Core source.

22 years ago[project @ 2002-04-05 11:33:28 by simonpj]
simonpj [Fri, 5 Apr 2002 11:33:28 +0000 (11:33 +0000)]
[project @ 2002-04-05 11:33:28 by simonpj]
More wibbles

22 years ago[project @ 2002-04-05 09:18:25 by simonpj]
simonpj [Fri, 5 Apr 2002 09:18:25 +0000 (09:18 +0000)]
[project @ 2002-04-05 09:18:25 by simonpj]
More head-healing

22 years ago[project @ 2002-04-05 08:12:21 by simonpj]
simonpj [Fri, 5 Apr 2002 08:12:22 +0000 (08:12 +0000)]
[project @ 2002-04-05 08:12:21 by simonpj]
Heal the head

22 years ago[project @ 2002-04-04 16:23:42 by simonmar]
simonmar [Thu, 4 Apr 2002 16:23:43 +0000 (16:23 +0000)]
[project @ 2002-04-04 16:23:42 by simonmar]
This is Haddock, my stab at a Haskell documentation tool.  It's not
quite ready for release yet, but I'm putting it in the repository so
others can take a look.

It uses a locally modified version of the hssource parser, extended
with support for GHC extensions and documentation annotations.

22 years ago[project @ 2002-04-04 13:15:18 by simonpj]
simonpj [Thu, 4 Apr 2002 13:15:19 +0000 (13:15 +0000)]
[project @ 2002-04-04 13:15:18 by simonpj]
---------------------------------------
A glorious improvement to CPR analysis
---------------------------------------

Working on the CPR paper, I finally figured out how to
do a decent job of taking account of strictness analyis when doing
CPR analysis.

There are two places we do that:

1.  Usually, on a letrec for a *thunk* we discard any CPR info from
the RHS.  We can't worker/wrapper a thunk.  BUT, if the let is
non-recursive
non-top-level
used strictly
we don't need to discard the CPR info, because the thunk-splitting
transform (WorkWrap.splitThunk) works.  This idea isn't new in this
commit.

2. Arguments to strict functions.  Consider

  fac n m = if n==0 then m
    else fac (n-1) (m*n)

Does it have the CPR property?  Apparently not, because it returns the
accumulating parameter, m.  But the strictness analyser will
discover that fac is strict in m, so it will be passed unboxed to
the worker for fac.  More concretely, here is the worker/wrapper
split that will result from strictness analysis alone:

  fac n m = case n of MkInt n' ->
    case m of MkInt m' ->
    facw n' m'

  facw n' m' = if n' ==# 0#
       then I# m'
       else facw (n' -# 1#) (m' *# n')

Now facw clearly does have the CPR property!  We can take advantage
of this by giving a demanded lambda the CPR property.

To make this work nicely, I've made NewDemandInfo into Maybe Demand
rather than simply Demand, so that we can tell when we are on the
first iteration.  Lots of comments about this in Note [CPR-AND-STRICTNESS].

I don't know how much all this buys us, but it is simple and elegant.

22 years ago[project @ 2002-04-04 08:49:46 by simonmar]
simonmar [Thu, 4 Apr 2002 08:49:46 +0000 (08:49 +0000)]
[project @ 2002-04-04 08:49:46 by simonmar]
An I/O error while opening/writing the output file is *not* a panic.

22 years ago[project @ 2002-04-03 11:17:05 by simonpj]
simonpj [Wed, 3 Apr 2002 11:17:05 +0000 (11:17 +0000)]
[project @ 2002-04-03 11:17:05 by simonpj]
Make -fgenerics the default

22 years ago[project @ 2002-04-03 09:45:14 by simonpj]
simonpj [Wed, 3 Apr 2002 09:45:16 +0000 (09:45 +0000)]
[project @ 2002-04-03 09:45:14 by simonpj]
-----------------------------
Put existential tyvars second
[fixes ParsecPerm lint error]
-----------------------------

In an existential data constr:

data Eq a => T a = forall b. Ord b => MkT a [b]

the type of MkT is

MkT :: forall a b . Ord b => a -> [b] -> MkT a

Note that the existential tyvars (b in this case) come *after*
the "ordinary" tyvars.

I had switched this around earlier in the week, but I'm putting
it back (and fixing a bug) because I found it really works better second.

Reason: in a case expression we may find:
case (e :: T t) of { MkT b (d:Ord b) (x:t) (xs:[b]) -> ... }
It's convenient to apply the rep-type of MkT to 't', to get
forall b. Ord b => ...
and use that to check the pattern.  Mind you, this is really only
use in CoreLint.

22 years ago[project @ 2002-04-02 13:56:32 by simonmar]
simonmar [Tue, 2 Apr 2002 13:56:34 +0000 (13:56 +0000)]
[project @ 2002-04-02 13:56:32 by simonmar]
Allow the use of 'let' for implcit bindings.

Support for 'with' is left in place for the time being, but on seeing
a 'with' we emit a non-suppressible warning about 'with' being
deprecated in favour of 'let'.

22 years ago[project @ 2002-04-02 13:21:36 by simonpj]
simonpj [Tue, 2 Apr 2002 13:21:37 +0000 (13:21 +0000)]
[project @ 2002-04-02 13:21:36 by simonpj]
-----------------------------------------------------
Fix two nasty, subtle loops in context simplification
-----------------------------------------------------

The context simplifier in TcSimplify was building a recursive
dictionary, which meant the program looped when run.  The reason
was pretty devious; in fact there are two independent causes.

Cause 1
~~~~~~~
Consider
  class Eq b => Foo a b
instance Eq a => Foo [a] a
If we are reducing
d:Foo [t] t
we'll first deduce that it holds (via the instance decl), thus:
d:Foo [t] t = $fFooList deq
deq:Eq t = ...some rhs depending on t...
Now we add d's superclasses.  We must not then overwrite the Eq t
constraint with a superclass selection!!

The only decent way to solve this is to track what dependencies
a binding has; that is what the is_loop parameter to TcSimplify.addSCs
now does.

Cause 2
~~~~~~~
This shows up when simplifying the superclass context of an
instance declaration.  Consider

  class S a

  class S a => C a where { opc :: a -> a }
  class S b => D b where { opd :: b -> b }

  instance C Int where
     opc = opd

  instance D Int where
     opd = opc

From (instance C Int) we get the constraint set {ds1:S Int, dd:D Int}
Simplifying, we may well get:
$dfCInt = :C ds1 (opd dd)
dd  = $dfDInt
ds1 = $p1 dd
Notice that we spot that we can extract ds1 from dd.

Alas!  Alack! We can do the same for (instance D Int):

$dfDInt = :D ds2 (opc dc)
dc  = $dfCInt
ds2 = $p1 dc

And now we've defined the superclass in terms of itself.

Solution: treat the superclass context separately, and simplify it
all the way down to nothing on its own.  Don't toss any 'free' parts
out to be simplified together with other bits of context.

This is done in TcInstDcls.tcSuperClasses, which is well commented.

All this from a bug report from Peter White!

22 years ago[project @ 2002-04-02 13:17:09 by simonmar]
simonmar [Tue, 2 Apr 2002 13:17:09 +0000 (13:17 +0000)]
[project @ 2002-04-02 13:17:09 by simonmar]
Make this compile with 4.08.

22 years ago[project @ 2002-04-02 13:07:48 by simonpj]
simonpj [Tue, 2 Apr 2002 13:07:48 +0000 (13:07 +0000)]
[project @ 2002-04-02 13:07:48 by simonpj]
Error message tidy up

22 years ago[project @ 2002-04-02 12:22:37 by simonmar]
simonmar [Tue, 2 Apr 2002 12:22:37 +0000 (12:22 +0000)]
[project @ 2002-04-02 12:22:37 by simonmar]
oops, accidentally committed some untested (and non-working) cleanups
in the last commit.  This commit fixes it up again.

(fixes the ByteCodeGen panic in GHCi on the HEAD)

22 years ago[project @ 2002-04-02 10:34:56 by simonmar]
simonmar [Tue, 2 Apr 2002 10:34:56 +0000 (10:34 +0000)]
[project @ 2002-04-02 10:34:56 by simonmar]
Add my build.mk file as a sample, and point to it in the comments at
the top of config.mk.

22 years ago[project @ 2002-04-02 10:27:28 by simonpj]
simonpj [Tue, 2 Apr 2002 10:27:28 +0000 (10:27 +0000)]
[project @ 2002-04-02 10:27:28 by simonpj]
Comments

22 years ago[project @ 2002-04-02 10:18:07 by simonmar]
simonmar [Tue, 2 Apr 2002 10:18:07 +0000 (10:18 +0000)]
[project @ 2002-04-02 10:18:07 by simonmar]
- Reverse the meaning of the *-prefix in the :module and :browse
  commands: '*Foo' now means the full contents of Foo, whereas just
  'Foo' means Foo's exports only.  This seems more intuitive to me,
  but the downside is that ':m Foo' doesn't do the same thing in
  GHC as Hugs (you have to say ':m *Foo' to get Hugs's behaviour).

- Update the help text

22 years ago[project @ 2002-04-02 09:09:21 by simonmar]
simonmar [Tue, 2 Apr 2002 09:09:21 +0000 (09:09 +0000)]
[project @ 2002-04-02 09:09:21 by simonmar]
The hPutBuf bug looks to be in 5.00 as well as 4.08 - so enable the
workaround on GHC <= 5.00.  Hopefully should fix bootstrapping
problems on Alpha.

22 years ago[project @ 2002-04-01 15:32:46 by panne]
panne [Mon, 1 Apr 2002 15:32:46 +0000 (15:32 +0000)]
[project @ 2002-04-01 15:32:46 by panne]
Sigbjorn's last optimization (checking for -mno-cygwin only for
mingw32 targets) kicked out -O from the default SRC_CC_OPTS. Apart
from a minor performance hit for some parts of GHC, it yields a GHCi
which can't load HSbase_cbits.o because `lstat' is unknown, at least
on SuSE 7.3.

A little investigation showed the rather arcane reason: lstat and
friends are inline functions and therefore not in libc.so, only in its
static counterpart. Normally this is not a problem at all, but the CPP
INLINE trickery in fptools/libraries/base/cbits/PrelIOUtils.c manages
to get a reference to lstat into PrelIOUtils.o if -O is not given. %-}
A similar problem exists for fstat, too.

Simple solution: Re-add -O to SRC_CC_OPTS, simplifying configure.in a
bit on the way.

22 years ago[project @ 2002-04-01 13:57:10 by simonpj]
simonpj [Mon, 1 Apr 2002 13:57:10 +0000 (13:57 +0000)]
[project @ 2002-04-01 13:57:10 by simonpj]
Use hasktags for the HSTAGS_PGM

22 years ago[project @ 2002-04-01 12:23:20 by panne]
panne [Mon, 1 Apr 2002 12:23:20 +0000 (12:23 +0000)]
[project @ 2002-04-01 12:23:20 by panne]
Fixed imports for GHC >= 5.03

22 years ago[project @ 2002-04-01 11:18:18 by panne]
panne [Mon, 1 Apr 2002 11:18:19 +0000 (11:18 +0000)]
[project @ 2002-04-01 11:18:18 by panne]
"warning: unused variable"-police

22 years ago[project @ 2002-04-01 09:24:29 by simonpj]
simonpj [Mon, 1 Apr 2002 09:24:29 +0000 (09:24 +0000)]
[project @ 2002-04-01 09:24:29 by simonpj]
Comments

22 years ago[project @ 2002-04-01 08:53:35 by simonpj]
simonpj [Mon, 1 Apr 2002 08:53:35 +0000 (08:53 +0000)]
[project @ 2002-04-01 08:53:35 by simonpj]
wibble

22 years ago[project @ 2002-04-01 08:23:30 by simonpj]
simonpj [Mon, 1 Apr 2002 08:23:36 +0000 (08:23 +0000)]
[project @ 2002-04-01 08:23:30 by simonpj]
------------------------------------
Change the treatment of the stupid
   context on data constructors
-----------------------------------

Data types can have a context:

data (Eq a, Ord b) => T a b = T1 a b | T2 a

and that makes the constructors have a context too
(notice that T2's context is "thinned"):

T1 :: (Eq a, Ord b) => a -> b -> T a b
T2 :: (Eq a) => a -> T a b

Furthermore, this context pops up when pattern matching
(though GHC hasn't implemented this, but it is in H98, and
I've fixed GHC so that it now does):

f (T2 x) = x
gets inferred type
f :: Eq a => T a b -> a

I say the context is "stupid" because the dictionaries passed
are immediately discarded -- they do nothing and have no benefit.
It's a flaw in the language.

Up to now I have put this stupid context into the type of
the "wrapper" constructors functions, T1 and T2, but that turned
out to be jolly inconvenient for generics, and record update, and
other functions that build values of type T (because they don't
have suitable dictionaries available).

So now I've taken the stupid context out.  I simply deal with
it separately in the type checker on occurrences of a constructor,
either in an expression or in a pattern.

To this end

* Lots of changes in DataCon, MkId

* New function Inst.tcInstDataCon to instantiate a data constructor

I also took the opportunity to

* Rename
dataConId --> dataConWorkId
  for consistency.

* Tidied up MkId.rebuildConArgs quite a bit, and renamed it
mkReboxingAlt

* Add function DataCon.dataConExistentialTyVars, with the obvious meaning

22 years ago[project @ 2002-04-01 08:22:38 by simonpj]
simonpj [Mon, 1 Apr 2002 08:22:38 +0000 (08:22 +0000)]
[project @ 2002-04-01 08:22:38 by simonpj]
Comments

22 years ago[project @ 2002-04-01 08:17:57 by simonpj]
simonpj [Mon, 1 Apr 2002 08:17:57 +0000 (08:17 +0000)]
[project @ 2002-04-01 08:17:57 by simonpj]
Split out FastMutInt separately

22 years ago[project @ 2002-04-01 08:17:03 by simonpj]
simonpj [Mon, 1 Apr 2002 08:17:03 +0000 (08:17 +0000)]
[project @ 2002-04-01 08:17:03 by simonpj]
Comments

22 years ago[project @ 2002-04-01 08:16:49 by simonpj]
simonpj [Mon, 1 Apr 2002 08:16:50 +0000 (08:16 +0000)]
[project @ 2002-04-01 08:16:49 by simonpj]
Import wibbles

22 years ago[project @ 2002-03-29 21:39:36 by sof]
sof [Fri, 29 Mar 2002 21:39:39 +0000 (21:39 +0000)]
[project @ 2002-03-29 21:39:36 by sof]
Front end for External Core.

Initial go at implementing a Core front end
(enabled via -fcore); work in progress (renamer
is currently not willing to slurp in & resolve
imports.)

22 years ago[project @ 2002-03-29 20:46:50 by krasimir]
krasimir [Fri, 29 Mar 2002 20:46:50 +0000 (20:46 +0000)]
[project @ 2002-03-29 20:46:50 by krasimir]
Latest Win32 implementation allows dynamic loading only for *.dll libraries. This commit add checking for *.drv libraries (drivers). This allows loading of winspool.drv needed for ObjectIO

22 years ago[project @ 2002-03-29 20:14:31 by krasimir]
krasimir [Fri, 29 Mar 2002 20:14:31 +0000 (20:14 +0000)]
[project @ 2002-03-29 20:14:31 by krasimir]
Hack hs_libraries package info for HSobjectio[1,2,3,4]

22 years ago[project @ 2002-03-28 17:52:08 by simonmar]
simonmar [Thu, 28 Mar 2002 17:52:08 +0000 (17:52 +0000)]
[project @ 2002-03-28 17:52:08 by simonmar]
In lookupTopBndrRn, if we're in an interface file, then create the
binder in the cache with the correct Module (inc. package name) rather
than making a vanilla module as we do currently.

This helps to get the package names right in names from interfaces
that we've read via checkOldIface (ie. "skipped" modules), and fixes a
bug to do with unnecessary version bumping and recompilation.

(Simon P.J. will add a better comment later)

MERGE TO STABLE

22 years ago[project @ 2002-03-28 15:31:05 by simonpj]
simonpj [Thu, 28 Mar 2002 15:31:05 +0000 (15:31 +0000)]
[project @ 2002-03-28 15:31:05 by simonpj]
Another readHoleResult glitch (fixes rn003)

22 years ago[project @ 2002-03-28 15:11:48 by sof]
sof [Thu, 28 Mar 2002 15:11:48 +0000 (15:11 +0000)]
[project @ 2002-03-28 15:11:48 by sof]
running binary-dist without having BIN_DIST set is now a no-no, I believe.

22 years ago[project @ 2002-03-28 14:46:59 by sof]
sof [Thu, 28 Mar 2002 14:46:59 +0000 (14:46 +0000)]
[project @ 2002-03-28 14:46:59 by sof]
recognise new cygwin moniker reported by config.guess

22 years ago[project @ 2002-03-28 14:43:14 by sof]
sof [Thu, 28 Mar 2002 14:43:14 +0000 (14:43 +0000)]
[project @ 2002-03-28 14:43:14 by sof]
cygwin-specific path mangling of CWD no longer reqd

22 years ago[project @ 2002-03-28 09:59:03 by simonmar]
simonmar [Thu, 28 Mar 2002 09:59:03 +0000 (09:59 +0000)]
[project @ 2002-03-28 09:59:03 by simonmar]
The test suite wins again: re-enable empty contexts in data
declarations.

22 years ago[project @ 2002-03-28 08:39:33 by stolz]
stolz [Thu, 28 Mar 2002 08:39:33 +0000 (08:39 +0000)]
[project @ 2002-03-28 08:39:33 by stolz]
posix/DLPrim now uses configure to check for RTLD_LOCAL.

22 years ago[project @ 2002-03-27 16:48:47 by simonmar]
simonmar [Wed, 27 Mar 2002 16:48:47 +0000 (16:48 +0000)]
[project @ 2002-03-27 16:48:47 by simonmar]
Sigh, recompilation checking in --make mdoe has been badly broken for
well, probably ever.

The problem is that in GHCi mode there's a restriction on the use of
object files, namely that an object file may only depend on other
up-to-date object files in order to be up-to-date itself, because we
don't have support for linking object code to interpreted code.
Unfortunately we were applying this restriction to --make compilations
too, with the result that far too much recompilation was happening.

MERGE TO STABLE

22 years ago[project @ 2002-03-27 12:35:44 by simonmar]
simonmar [Wed, 27 Mar 2002 12:35:44 +0000 (12:35 +0000)]
[project @ 2002-03-27 12:35:44 by simonmar]
Update the comment about how to add a new primop.

22 years ago[project @ 2002-03-27 12:09:00 by simonpj]
simonpj [Wed, 27 Mar 2002 12:09:02 +0000 (12:09 +0000)]
[project @ 2002-03-27 12:09:00 by simonpj]
More validity checking, esp for existential ctxt on data cons

22 years ago[project @ 2002-03-27 12:07:42 by simonpj]
simonpj [Wed, 27 Mar 2002 12:07:45 +0000 (12:07 +0000)]
[project @ 2002-03-27 12:07:42 by simonpj]
Comments and tracing only

22 years ago[project @ 2002-03-26 23:56:44 by sof]
sof [Tue, 26 Mar 2002 23:56:45 +0000 (23:56 +0000)]
[project @ 2002-03-26 23:56:44 by sof]
TEXT_BEFORE_HEAP & cygwin: same as for mingw

22 years ago[project @ 2002-03-26 23:51:27 by sof]
sof [Tue, 26 Mar 2002 23:51:27 +0000 (23:51 +0000)]
[project @ 2002-03-26 23:51:27 by sof]
initDefaultHandlers(): siginterrupt() not supported w/ cygwin

22 years ago[project @ 2002-03-26 23:47:17 by sof]
sof [Tue, 26 Mar 2002 23:47:17 +0000 (23:47 +0000)]
[project @ 2002-03-26 23:47:17 by sof]
re-add way 'p' to GhcLibWays

22 years ago[project @ 2002-03-26 22:08:44 by sof]
sof [Tue, 26 Mar 2002 22:09:20 +0000 (22:09 +0000)]
[project @ 2002-03-26 22:08:44 by sof]
mingw32_TARGET_OS -> mingw32_HOST_OS