ghc-hetmet.git
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.

22 years ago[project @ 2001-11-23 12:03:59 by simonmar]
simonmar [Fri, 23 Nov 2001 12:03:59 +0000 (12:03 +0000)]
[project @ 2001-11-23 12:03:59 by simonmar]
Replace a lazy pattern match in tcGetInstLoc with a strict one (fixes
a space leak).

22 years ago[project @ 2001-11-23 12:01:34 by simonmar]
simonmar [Fri, 23 Nov 2001 12:01:34 +0000 (12:01 +0000)]
[project @ 2001-11-23 12:01:34 by simonmar]
Adorn various constructor fields with strictness annotations - this
fixes at least one space leak, in the mi_usages field of a ModIface.

22 years ago[project @ 2001-11-23 11:59:21 by simonmar]
simonmar [Fri, 23 Nov 2001 11:59:21 +0000 (11:59 +0000)]
[project @ 2001-11-23 11:59:21 by simonmar]
Collect up _scc_ expressions on the right hand side of a closure
definition and attach them directly to the closure using PushCC-type
cost centres, so that the allocation of the closure gets attributed to
the right place.

22 years ago[project @ 2001-11-23 11:57:59 by simonmar]
simonmar [Fri, 23 Nov 2001 11:58:00 +0000 (11:58 +0000)]
[project @ 2001-11-23 11:57:59 by simonmar]
Fix a long-standing bug in the cost attribution of cost-center stacks.
The problem case is this:

let z = _scc_ "z" f x
in ... z ...

previously we were attributing the cost of allocating the closure 'z'
to the enclosing cost center stack (CCCS), when it should really be
attributed to "z":CCCS.  The effects are particularly visible with
retainer profiling, because the closure retaining 'f' and 'x' would
show up with the wrong CCS attached.

To fix this, we need a new form of CCS representation internally:
'PushCC CostCentre CostCentreStack' which subsumes (and therefore
replaces) SingletonCCS.  SingletonCCS is now represented by 'PushCC cc
NoCCS'.

The CCS argument to SET_HDR may now be an arbitrary expression, such
as PushCostCentre(CCCS,foo_cc), as may be the argument to CCS_ALLOC().
So we combine SET_HDR and CCS_ALLOC into a single macro, SET_HDR_, to
avoid repeated calls to PushCostCentre().

22 years ago[project @ 2001-11-23 11:47:37 by simonmar]
simonmar [Fri, 23 Nov 2001 11:47:37 +0000 (11:47 +0000)]
[project @ 2001-11-23 11:47:37 by simonmar]
Call LDV_ENTER() on entry to a constructor in profiling mode.

22 years ago[project @ 2001-11-23 11:47:12 by simonmar]
simonmar [Fri, 23 Nov 2001 11:47:12 +0000 (11:47 +0000)]
[project @ 2001-11-23 11:47:12 by simonmar]
Call LDV_ENTER() on entry to a thunk or function in profiling mode.

22 years ago[project @ 2001-11-23 11:46:31 by simonmar]
simonmar [Fri, 23 Nov 2001 11:46:31 +0000 (11:46 +0000)]
[project @ 2001-11-23 11:46:31 by simonmar]
Add
ldvEnter :: Code

for LDV profiling: it records that the closure pointed to by R1 has
just been entered.

22 years ago[project @ 2001-11-23 11:42:11 by simonmar]
simonmar [Fri, 23 Nov 2001 11:42:11 +0000 (11:42 +0000)]
[project @ 2001-11-23 11:42:11 by simonmar]
We don't need to consider Hp as a volatile register across C calls; it
is already saved by the CALLER_SAVES_SYSTEM macro.

22 years ago[project @ 2001-11-23 10:27:58 by simonmar]
simonmar [Fri, 23 Nov 2001 10:27:58 +0000 (10:27 +0000)]
[project @ 2001-11-23 10:27:58 by simonmar]
Fix compilation problems with Stats.c in the !DEBUG case.

22 years ago[project @ 2001-11-22 16:33:06 by simonmar]
simonmar [Thu, 22 Nov 2001 16:33:06 +0000 (16:33 +0000)]
[project @ 2001-11-22 16:33:06 by simonmar]
Omit GC and SYSTEM from the cost centre summary at the top of the profile.

22 years ago[project @ 2001-11-22 15:15:27 by simonmar]
simonmar [Thu, 22 Nov 2001 15:15:27 +0000 (15:15 +0000)]
[project @ 2001-11-22 15:15:27 by simonmar]
Add rts_getThreadId to the Linker's built in symbol table

22 years ago[project @ 2001-11-22 14:25:11 by simonmar]
simonmar [Thu, 22 Nov 2001 14:25:13 +0000 (14:25 +0000)]
[project @ 2001-11-22 14:25:11 by simonmar]
Retainer Profiling / Lag-drag-void profiling.

This is mostly work by Sungwoo Park, who spent a summer internship at
MSR Cambridge this year implementing these two types of heap profiling
in GHC.

Relative to Sungwoo's original work, I've made some improvements to
the code:

   - it's now possible to apply constraints to retainer and LDV profiles
     in the same way as we do for other types of heap profile (eg.
     +RTS -hc{foo,bar} -hR -RTS gives you a retainer profiling considering
     only closures with cost centres 'foo' and 'bar').

   - the heap-profile timer implementation is cleaned up.

   - heap profiling no longer has to be run in a two-space heap.

   - general cleanup of the code and application of the SDM C coding
     style guidelines.

Profiling will be a little slower and require more space than before,
mainly because closures have an extra header word to support either
retainer profiling or LDV profiling (you can't do both at the same
time).

We've used the new profiling tools on GHC itself, with moderate
success.  Fixes for some space leaks in GHC to follow...

22 years ago[project @ 2001-11-22 12:22:42 by simonpj]
simonpj [Thu, 22 Nov 2001 12:22:42 +0000 (12:22 +0000)]
[project @ 2001-11-22 12:22:42 by simonpj]
Inlining pragma buglet

22 years ago[project @ 2001-11-22 12:06:55 by simonmar]
simonmar [Thu, 22 Nov 2001 12:06:55 +0000 (12:06 +0000)]
[project @ 2001-11-22 12:06:55 by simonmar]
Update this document.  Some of the implementation problems can be
solved in a cleaner way, and the document was confused about the
problems caused by slop in the heap (it's only a problem when
traversing the dead heap, not the live heap).

22 years ago[project @ 2001-11-21 20:55:10 by sof]
sof [Wed, 21 Nov 2001 20:55:10 +0000 (20:55 +0000)]
[project @ 2001-11-21 20:55:10 by sof]
initialize_virtual_timer: Robustified win32 version; don't
assume that the minimal resolution is one millisec, consult
the underlying impl via timeGetDevCaps().

22 years ago[project @ 2001-11-21 20:27:18 by sof]
sof [Wed, 21 Nov 2001 20:27:18 +0000 (20:27 +0000)]
[project @ 2001-11-21 20:27:18 by sof]
StablePtr indexes/counts are no longer weighted (i.e., sync wrt Stable.{c,h} changes)

22 years ago[project @ 2001-11-21 16:56:19 by sof]
sof [Wed, 21 Nov 2001 16:56:19 +0000 (16:56 +0000)]
[project @ 2001-11-21 16:56:19 by sof]
#ifdef protect generated config.h file.

22 years ago[project @ 2001-11-21 10:09:15 by simonmar]
simonmar [Wed, 21 Nov 2001 10:09:16 +0000 (10:09 +0000)]
[project @ 2001-11-21 10:09:15 by simonmar]
Turn the weighted reference count in a StablePtr into a simple counter
in the stable ptr table.  We never made use of the weighted count, and
it caused problems when making many StablePtrs to the same object.

In the future we could remove the reference counting altogether and
just make a new StablePtr each time, rather than attempting to use an
existing one.  This would save on the hash table lookup at creation
time.

22 years ago[project @ 2001-11-21 02:29:00 by sof]
sof [Wed, 21 Nov 2001 02:29:00 +0000 (02:29 +0000)]
[project @ 2001-11-21 02:29:00 by sof]
Have prototypes and implementation of prel_PrelHandle_{write,read}() match
up with the stated Haskell FFI type in PrelHandle.hs, i.e., the size
parameter is a CInt, not an Int.

22 years ago[project @ 2001-11-20 21:39:12 by sof]
sof [Tue, 20 Nov 2001 21:39:12 +0000 (21:39 +0000)]
[project @ 2001-11-20 21:39:12 by sof]
getTimes (win32): Win9x OSes don't provide per-process timing data, so
GetProcessTimes() doesn't do anything interesting. So, resort to using
system-time instead to measure user/process time iff running under Win9x.
(the precision is not as good, deltas were ~6 millisecs when testing
on a Win98 box, but it's better than nothing).

This change should make profiling on Win9x boxes finally work.

22 years ago[project @ 2001-11-20 16:43:18 by sof]
sof [Tue, 20 Nov 2001 16:43:18 +0000 (16:43 +0000)]
[project @ 2001-11-20 16:43:18 by sof]
Nuke #include of MachDeps.h - nothing in there that cannot be
(better) gotten from the in-tree config.h

This is the only (last?) use of MachDeps.h, so if anyone won't argue
for its continued existence, I'll nuke it sometime soon.

22 years ago[project @ 2001-11-20 16:17:23 by simonmar]
simonmar [Tue, 20 Nov 2001 16:17:23 +0000 (16:17 +0000)]
[project @ 2001-11-20 16:17:23 by simonmar]
Print to stdout instead of stderr.  I'm pretty ambivalent about this,
but Sungwoo Park made the changes as part of his retainer profiling
work so he must have had a good reason for it at the time...

22 years ago[project @ 2001-11-20 14:12:48 by simonpj]
simonpj [Tue, 20 Nov 2001 14:12:48 +0000 (14:12 +0000)]
[project @ 2001-11-20 14:12:48 by simonpj]
Add constant-folding rules for Float# and Double#

22 years ago[project @ 2001-11-19 18:53:50 by sof]
sof [Mon, 19 Nov 2001 18:53:50 +0000 (18:53 +0000)]
[project @ 2001-11-19 18:53:50 by sof]
If the configure script determined that the build-tree version of happy
is to be used, descend into happy/ and build it, if needs be.

22 years ago[project @ 2001-11-19 18:47:43 by sof]
sof [Mon, 19 Nov 2001 18:47:44 +0000 (18:47 +0000)]
[project @ 2001-11-19 18:47:43 by sof]
- change the interpretation of FPTOOLS_TOP_ABS, it is now the UNIXy path.
  For Win32, it is of the form <drive>:<path> where '/' is the directory
  separator. Prior to this commit, the directory separator was '\'.
- for the (only) place we need to have a platform-native representation
  of FPTOOLS_TOP_ABS, use FPTOOLS_TOP_ABS_PLATFORM.

22 years ago[project @ 2001-11-19 16:34:12 by simonpj]
simonpj [Mon, 19 Nov 2001 16:34:14 +0000 (16:34 +0000)]
[project @ 2001-11-19 16:34:12 by simonpj]
Tidy up imports

22 years ago[project @ 2001-11-19 16:33:17 by simonpj]
simonpj [Mon, 19 Nov 2001 16:33:17 +0000 (16:33 +0000)]
[project @ 2001-11-19 16:33:17 by simonpj]
Improve error msg

22 years ago[project @ 2001-11-19 14:23:52 by simonpj]
simonpj [Mon, 19 Nov 2001 14:23:53 +0000 (14:23 +0000)]
[project @ 2001-11-19 14:23:52 by simonpj]
--------------------------------------
Yet another cut at the DmdAnal domains
--------------------------------------

This version of the domain for demand analysis was developed
in discussion with Peter Sestoft, so I think it might at last
be more or less right!

Our idea is mentally to separate
strictness analysis
from
absence and boxity analysis

Then we combine them back into a single domain.  The latter
is all you see in the compiler (the Demand type, as before)
but we understand it better now.

22 years ago[project @ 2001-11-18 12:32:22 by chak]
chak [Sun, 18 Nov 2001 12:32:22 +0000 (12:32 +0000)]
[project @ 2001-11-18 12:32:22 by chak]
Added a new section that covers lexing and parsing.

22 years ago[project @ 2001-11-16 16:58:41 by sof]
sof [Fri, 16 Nov 2001 16:58:41 +0000 (16:58 +0000)]
[project @ 2001-11-16 16:58:41 by sof]
if IS_CBITS_LIB is YES: Extend SRC_HS2HS_OPTS in the same way that SRC_CC_OPTS is

22 years ago[project @ 2001-11-16 15:42:26 by simonpj]
simonpj [Fri, 16 Nov 2001 15:42:26 +0000 (15:42 +0000)]
[project @ 2001-11-16 15:42:26 by simonpj]
---------------------------------------
Add continuation splitting to Simplify
---------------------------------------

When the simplifier finds a 'case', it calls mkDupableAlt
to make the "continuation" (that is, the context of the
case expression) duplicatable, so that it can push it into
the case branches.  This is crucial for the case-of-case
transformation.

But it turns out that it's a bad idea to do that when
the context is "I'm the argument of a strict function".  Consider

f (case x of { True -> False; False -> True }) arg2

where f is a strict function.  Then we *could* (and were)
transforming to

let $j a = f a arg2
in
case x of { True -> $j False; False -> $j True }

But this is in general a terribly bad thing to do.
See the example in comments with Simplify.mkDupableCont.

22 years ago[project @ 2001-11-16 15:33:53 by simonpj]
simonpj [Fri, 16 Nov 2001 15:33:53 +0000 (15:33 +0000)]
[project @ 2001-11-16 15:33:53 by simonpj]
Correct docs about SPECIALIZE instance; MERGE TO STABLE

22 years ago[project @ 2001-11-15 15:04:36 by simonmar]
simonmar [Thu, 15 Nov 2001 15:04:36 +0000 (15:04 +0000)]
[project @ 2001-11-15 15:04:36 by simonmar]
Don't restrict doc building to i386-linux.  please merge.

22 years ago[project @ 2001-11-14 16:34:22 by simonmar]
simonmar [Wed, 14 Nov 2001 16:34:22 +0000 (16:34 +0000)]
[project @ 2001-11-14 16:34:22 by simonmar]
use SET_HDR rather than explicitly setting p->header.info.

22 years ago[project @ 2001-11-14 11:46:12 by simonmar]
simonmar [Wed, 14 Nov 2001 11:46:12 +0000 (11:46 +0000)]
[project @ 2001-11-14 11:46:12 by simonmar]
Fix up the interpreter following the recent modifications to
suspendThread/resumeThread.  Someone should test that foreign imports
in the interpreter still work.

22 years ago[project @ 2001-11-14 11:39:29 by simonmar]
simonmar [Wed, 14 Nov 2001 11:39:29 +0000 (11:39 +0000)]
[project @ 2001-11-14 11:39:29 by simonmar]
Change the way we do finalization for duplex handles.  Previously, we
arranged that the read side pointed to the right side via a special
handle type (ReadSideHandle _), and the finalizer points to the write
side.  This turned out to interact badly with hGetContents, which
likes to explicitly close the read side of the handle after it reads
EOF or gets an error, which resulted in double-closes for duplex
handles.

Now we store the pointer from the read side to the write side in the
Handle structure itself, so it doesn't get lost when hGetContents
changes the handle type to SemiClosedHandle.  Furthermore, in hClose
we no longer close the file descriptor associated with the read side
of a duplex handle - the actual close will have to wait until the
finalizer runs, because someone might still be using the write side.

Thanks to Volker Stolz for pointing out the problem.

22 years ago[project @ 2001-11-14 11:35:23 by simonmar]
simonmar [Wed, 14 Nov 2001 11:35:23 +0000 (11:35 +0000)]
[project @ 2001-11-14 11:35:23 by simonmar]
remove an unnecessary duplicate binding

22 years ago[project @ 2001-11-14 11:15:53 by simonmar]
simonmar [Wed, 14 Nov 2001 11:15:53 +0000 (11:15 +0000)]
[project @ 2001-11-14 11:15:53 by simonmar]
GC unused import

22 years ago[project @ 2001-11-13 13:38:02 by simonmar]
simonmar [Tue, 13 Nov 2001 13:38:02 +0000 (13:38 +0000)]
[project @ 2001-11-13 13:38:02 by simonmar]
Remove unused ticks_since_timestamp.

22 years ago[project @ 2001-11-13 11:06:51 by simonmar]
simonmar [Tue, 13 Nov 2001 11:06:51 +0000 (11:06 +0000)]
[project @ 2001-11-13 11:06:51 by simonmar]
Fix daVinci URL.

22 years ago[project @ 2001-11-13 10:16:21 by simonmar]
simonmar [Tue, 13 Nov 2001 10:16:21 +0000 (10:16 +0000)]
[project @ 2001-11-13 10:16:21 by simonmar]
Mention in the summary of section 7 that extra arguments to
./configure may be required.

22 years ago[project @ 2001-11-13 10:07:28 by simonmar]
simonmar [Tue, 13 Nov 2001 10:07:28 +0000 (10:07 +0000)]
[project @ 2001-11-13 10:07:28 by simonmar]
Updated building guide, now incorporating the CVS cheat sheet.

22 years ago[project @ 2001-11-13 03:28:03 by chak]
chak [Tue, 13 Nov 2001 03:28:03 +0000 (03:28 +0000)]
[project @ 2001-11-13 03:28:03 by chak]
A little more info about type checking

22 years ago[project @ 2001-11-12 23:55:56 by chak]
chak [Mon, 12 Nov 2001 23:55:56 +0000 (23:55 +0000)]
[project @ 2001-11-12 23:55:56 by chak]
Added a link to apt's External Core document.

22 years ago[project @ 2001-11-12 14:13:35 by simonmar]
simonmar [Mon, 12 Nov 2001 14:13:35 +0000 (14:13 +0000)]
[project @ 2001-11-12 14:13:35 by simonmar]
Generate .a files into a temporary file before renaming to the actual
target, to avoid a problem whereby 'ar' could leave a partially-built
archive lying around.

22 years ago[project @ 2001-11-12 14:09:03 by simonmar]
simonmar [Mon, 12 Nov 2001 14:09:03 +0000 (14:09 +0000)]
[project @ 2001-11-12 14:09:03 by simonmar]
comment update

22 years ago[project @ 2001-11-12 12:18:50 by simonpj]
simonpj [Mon, 12 Nov 2001 12:18:50 +0000 (12:18 +0000)]
[project @ 2001-11-12 12:18:50 by simonpj]
Remove pprTrace

22 years ago[project @ 2001-11-09 21:25:56 by sof]
sof [Fri, 9 Nov 2001 21:25:57 +0000 (21:25 +0000)]
[project @ 2001-11-09 21:25:56 by sof]
GhcCanonVersion: leave out GhcPatchLevel, causes problems when
the GhcPatchLevel isn't a patchlevel but a date.

22 years ago[project @ 2001-11-09 20:58:40 by sof]
sof [Fri, 9 Nov 2001 20:58:40 +0000 (20:58 +0000)]
[project @ 2001-11-09 20:58:40 by sof]
prel_PrelHandle_read(): de-hebetudified.

22 years ago[project @ 2001-11-09 20:30:11 by sof]
sof [Fri, 9 Nov 2001 20:30:11 +0000 (20:30 +0000)]
[project @ 2001-11-09 20:30:11 by sof]
Make recent rts/ changes work by recognising symbols starting
with __stg as being known-funny-things.

Still recognise "^stg" as 'funny', not sure if that's still
needed.

22 years ago[project @ 2001-11-09 18:40:52 by sof]
sof [Fri, 9 Nov 2001 18:40:52 +0000 (18:40 +0000)]
[project @ 2001-11-09 18:40:52 by sof]
lookupInstEnv: "#ifdef DEBUG"-protect trace code
that got included in prev. commit.

(I'm guessing it either should be removed or moved
into the ASSERT, but I'll let the original committer
decide which).

22 years ago[project @ 2001-11-09 18:17:48 by sof]
sof [Fri, 9 Nov 2001 18:17:48 +0000 (18:17 +0000)]
[project @ 2001-11-09 18:17:48 by sof]
* Moved CANON_HC_VERSION out of ghc/compiler/Makefile and into mk/config.mk.in
  (and renamed it as GhcCanonVersion).
* Have ghc/driver/Makefile use it; cheaper and more robust than the version
  testing it was already doing.

22 years ago[project @ 2001-11-09 17:39:45 by sof]
sof [Fri, 9 Nov 2001 17:39:45 +0000 (17:39 +0000)]
[project @ 2001-11-09 17:39:45 by sof]
Optimised defn of CANON_HC_VERSION, synthesise it from config.mk info,
not via an expensive $(shell ...) call.

22 years ago[project @ 2001-11-09 17:02:09 by sof]
sof [Fri, 9 Nov 2001 17:02:09 +0000 (17:02 +0000)]
[project @ 2001-11-09 17:02:09 by sof]
Use -fvia-C when compiling rename/ParseIface.hs and parser/Parser.hs -
Int16 primops aren't supported by the NCG on all plats.

22 years ago[project @ 2001-11-09 16:41:15 by simonpj]
simonpj [Fri, 9 Nov 2001 16:41:15 +0000 (16:41 +0000)]
[project @ 2001-11-09 16:41:15 by simonpj]
---------------------------------------
Fix an obscure overlapping-instance bug
---------------------------------------

MERGE TO STABLE BRANCH

When searching for instances, we used bale out if the type
we seek could be instantiated to match the instance (because
it might be so instantiated later, in which case we don't
want to miss the opportunity).

The bug was that we used *matching* whereas we should use
*unification*.

Comments in the file InstEnv.

22 years ago[project @ 2001-11-09 16:29:06 by sof]
sof [Fri, 9 Nov 2001 16:29:06 +0000 (16:29 +0000)]
[project @ 2001-11-09 16:29:06 by sof]
Auto-rule for INSTALL_DATAS and cbits/ header files:

Nuke $(shell perl -e '...') use, i.e., don't load in and start up
a 3M binary just to capitalise a word (which gets done twice per
invocation of 'make').

22 years ago[project @ 2001-11-08 19:34:23 by sof]
sof [Thu, 8 Nov 2001 19:34:23 +0000 (19:34 +0000)]
[project @ 2001-11-08 19:34:23 by sof]
gen_Eq_binds: when comparing constructor tags, emit just

   a == b = case con2tag_Foo# a of
              a# -> case con2tag_Foo# b of b# -> a# PrelGHC.==# b#

and not

   a == b = case con2tag_Foo# a of
              a# -> case con2tag_Foo# b of
                      b# -> if a# PrelGHC.==# b# then PrelBase.True else PrelBase.False

(Not that this wouldn't get simplified, but still).

22 years ago[project @ 2001-11-08 19:20:55 by sof]
sof [Thu, 8 Nov 2001 19:20:55 +0000 (19:20 +0000)]
[project @ 2001-11-08 19:20:55 by sof]
rnHsForeignDecl: 'foreign import's (incl 'f.e.d's) _define_ local toplevel
names, so better use RnEnv.lookupTopBndrRn and not RnEnv.lookupOccRn to
resolve the name.

As was, declaring ForeignImports with the same name as an imported entity
wasn't permitted.

22 years ago[project @ 2001-11-08 18:55:19 by sof]
sof [Thu, 8 Nov 2001 18:55:19 +0000 (18:55 +0000)]
[project @ 2001-11-08 18:55:19 by sof]
gencode: for completeness sake only, handle CCallTypedefs

22 years ago[project @ 2001-11-08 18:53:44 by sof]
sof [Thu, 8 Nov 2001 18:53:44 +0000 (18:53 +0000)]
[project @ 2001-11-08 18:53:44 by sof]
ghc-inplace: single-quote -B option to avoid de-escaping those b-slashes

22 years ago[project @ 2001-11-08 18:51:03 by sof]
sof [Thu, 8 Nov 2001 18:51:03 +0000 (18:51 +0000)]
[project @ 2001-11-08 18:51:03 by sof]
hardtop_plat: escape those backslashes (exponentially so).

22 years ago[project @ 2001-11-08 17:39:14 by sof]
sof [Thu, 8 Nov 2001 17:39:14 +0000 (17:39 +0000)]
[project @ 2001-11-08 17:39:14 by sof]
Prev. commit upset world order - revert back to printing out
build tree loc. first.

22 years ago[project @ 2001-11-08 17:04:28 by simonmar]
simonmar [Thu, 8 Nov 2001 17:04:28 +0000 (17:04 +0000)]
[project @ 2001-11-08 17:04:28 by simonmar]
minor simplification

22 years ago[project @ 2001-11-08 17:02:41 by simonmar]
simonmar [Thu, 8 Nov 2001 17:02:41 +0000 (17:02 +0000)]
[project @ 2001-11-08 17:02:41 by simonmar]
inputReady can be an unsafe foreign import.

22 years ago[project @ 2001-11-08 16:37:54 by simonmar]
simonmar [Thu, 8 Nov 2001 16:37:54 +0000 (16:37 +0000)]
[project @ 2001-11-08 16:37:54 by simonmar]
wibble

22 years ago[project @ 2001-11-08 16:36:39 by simonmar]
simonmar [Thu, 8 Nov 2001 16:36:39 +0000 (16:36 +0000)]
[project @ 2001-11-08 16:36:39 by simonmar]
getProgArgv can be an unsafe foreign import.

22 years ago[project @ 2001-11-08 16:17:35 by simonmar]
simonmar [Thu, 8 Nov 2001 16:17:35 +0000 (16:17 +0000)]
[project @ 2001-11-08 16:17:35 by simonmar]
Revert resumeThread and suspendThread to working with StgRegTable
rather than Capability, and do the conversion in the functions
themselves rather than in the inline code.  This means I don't have to
fiddle with the NCG to fix the SUSPEND_THREAD/RESUME_THREAD macros.

22 years ago[project @ 2001-11-08 14:42:11 by simonmar]
simonmar [Thu, 8 Nov 2001 14:42:11 +0000 (14:42 +0000)]
[project @ 2001-11-08 14:42:11 by simonmar]
Fix a bug in the previous commit, and add some more sanity checking.

22 years ago[project @ 2001-11-08 12:56:00 by simonmar]
simonmar [Thu, 8 Nov 2001 12:56:01 +0000 (12:56 +0000)]
[project @ 2001-11-08 12:56:00 by simonmar]
Updates to the native code generator following the changes to fix the
large block allocation bug, and changes to use the new
function-address cache in the register table to reduce code size.

Also: I changed the pretty-printing machinery for assembly code to use
Pretty rather than Outputable, since we don't make use of the styles
and it should improve performance.  Perhaps the same should be done
for abstract C.

22 years ago[project @ 2001-11-08 12:50:07 by simonmar]
simonmar [Thu, 8 Nov 2001 12:50:07 +0000 (12:50 +0000)]
[project @ 2001-11-08 12:50:07 by simonmar]
Remove the heap-check-size panic, following the RTS fixes for this problem.

22 years ago[project @ 2001-11-08 12:46:31 by simonmar]
simonmar [Thu, 8 Nov 2001 12:46:31 +0000 (12:46 +0000)]
[project @ 2001-11-08 12:46:31 by simonmar]
Fix the large block allocation bug (Yay!)
-----------------------------------------

In order to do this, I had to

 1. in each heap-check failure branch, return the amount of heap
    actually requested, in a known location (I added another slot
    in StgRegTable called HpAlloc for this purpose).  This is
    useful for other reasons - in particular it makes it possible
    to get accurate allocation statistics.

 2. In the scheduler, if a heap check fails and we wanted more than
    BLOCK_SIZE_W words, then allocate a special large block and place
    it in the nursery.  The nursery now has to be double-linked so
    we can insert the new block in the middle.

 3. The garbage collector has to be able to deal with multiple objects
    in a large block.  It turns out that this isn't a problem as long as
    the large blocks only occur in the nursery, because we always copy
    objects from the nursery during GC.  One small change had to be
    made: in evacuate(), we may need to follow the link field from the
    block descriptor to get to the block descriptor for the head of a
    large block.

 4. Various other parts of the storage manager had to be modified
    to cope with a nursery containing a mixture of block sizes.

Point (3) causes a slight pessimization in the garbage collector.  I
don't see a way to avoid this.  Point (1) causes some code bloat (a
rough measurement is around 5%), so to offset this I made the
following change which I'd been meaning to do for some time:

  - Store the values of some commonly-used absolute addresses
    (eg. stg_update_PAP) in the register table.  This lets us use
    shorter instruction forms for some absolute jumps and saves some
    code space.

  - The type of Capability is no longer the same as an StgRegTable.
    MainRegTable renamed to MainCapability.  See Regs.h for details.

Other minor changes:

  - remove individual declarations for the heap-check-failure jump
    points, and declare them all in StgMiscClosures.h instead.  Remove
    HeapStackCheck.h.

Updates to the native code generator to follow.

22 years ago[project @ 2001-11-08 12:41:07 by simonmar]
simonmar [Thu, 8 Nov 2001 12:41:07 +0000 (12:41 +0000)]
[project @ 2001-11-08 12:41:07 by simonmar]
(addendum to the previous commit) also set bd->blocks to zero in
coalesce().

22 years ago[project @ 2001-11-08 10:18:49 by simonmar]
simonmar [Thu, 8 Nov 2001 10:18:49 +0000 (10:18 +0000)]
[project @ 2001-11-08 10:18:49 by simonmar]
For each non-head block in a block group, set its 'blocks' field to
zero (as per comments elsewhere).

22 years ago[project @ 2001-11-07 22:51:08 by sof]
sof [Wed, 7 Nov 2001 22:51:08 +0000 (22:51 +0000)]
[project @ 2001-11-07 22:51:08 by sof]
When generating dependencies, look for both source files _and_
interface files.

If STABLE is still a branch with a future, I'd encourage merging.

22 years ago[project @ 2001-11-07 20:17:37 by sof]
sof [Wed, 7 Nov 2001 20:17:37 +0000 (20:17 +0000)]
[project @ 2001-11-07 20:17:37 by sof]
Avoid using $(shell ...) functions - expensive buggers.

22 years ago[project @ 2001-11-07 20:14:21 by sof]
sof [Wed, 7 Nov 2001 20:14:21 +0000 (20:14 +0000)]
[project @ 2001-11-07 20:14:21 by sof]
subst new variable hardtop_plat - platform-specific version of hardtop

22 years ago[project @ 2001-11-07 20:13:26 by sof]
sof [Wed, 7 Nov 2001 20:13:26 +0000 (20:13 +0000)]
[project @ 2001-11-07 20:13:26 by sof]
FPTOOLS_HAPPY: have it subst default HappyOpts too

22 years ago[project @ 2001-11-07 19:37:17 by sof]
sof [Wed, 7 Nov 2001 19:37:17 +0000 (19:37 +0000)]
[project @ 2001-11-07 19:37:17 by sof]
made to work on Unices

22 years ago[project @ 2001-11-07 19:36:11 by sof]
sof [Wed, 7 Nov 2001 19:36:11 +0000 (19:36 +0000)]
[project @ 2001-11-07 19:36:11 by sof]
Cope with conditional presence of o_BINARY in PrelPosix.

(Something's not quite right here - O_BINARY, a non-Posix flag,
being defined by PrelPosix).