Simon Marlow [Fri, 16 Jun 2006 10:33:42 +0000 (10:33 +0000)]
Asynchronous exception support for SMP
This patch makes throwTo work with -threaded, and also refactors large
parts of the concurrency support in the RTS to clean things up. We
have some new files:
RaiseAsync.{c,h} asynchronous exception support
Threads.{c,h} general threading-related utils
Some of the contents of these new files used to be in Schedule.c,
which is smaller and cleaner as a result of the split.
Asynchronous exception support in the presence of multiple running
Haskell threads is rather tricky. In fact, to my annoyance there are
still one or two bugs to track down, but the majority of the tests run
now.
Simon Marlow [Fri, 16 Jun 2006 10:23:11 +0000 (10:23 +0000)]
make rmp_tmp_w an StgWord instead of StgInt
sof@galois.com [Wed, 14 Jun 2006 16:46:50 +0000 (16:46 +0000)]
__compat_long_path_size(): have proto and defn agree on return type
Simon Marlow [Wed, 14 Jun 2006 13:47:28 +0000 (13:47 +0000)]
call wakeUpRts() in the correct place
sof@galois.com [Tue, 13 Jun 2006 23:26:05 +0000 (23:26 +0000)]
readerProc: split up text output using host's line termination convention
simonpj@microsoft.com [Mon, 12 Jun 2006 11:40:20 +0000 (11:40 +0000)]
Improve pretty-printing for bags
simonpj@microsoft.com [Mon, 12 Jun 2006 11:38:55 +0000 (11:38 +0000)]
Make scoped type variables work for default methods
Consider
class C a where
op :: forall b. a -> b -> b
op = <rhs>
Then 'b' should be in scope in <rhs>. I had omitted this case.
This patch fixes it.
Don Stewart [Mon, 12 Jun 2006 08:46:56 +0000 (08:46 +0000)]
And move 'Chasing ...' messages into verbosity 2 as well
Don Stewart [Sun, 11 Jun 2006 07:10:41 +0000 (07:10 +0000)]
Emit 'linking not required' messages only with -v 2 or above.
Similar in philosophy to the 'Skipping' patch, this is another case of
printing noisy messages when no work is being done. This patch makes the
building-when-nothing-to-do case smoother.
Don Stewart [Sat, 10 Jun 2006 14:57:13 +0000 (14:57 +0000)]
Don't emit 'Skipping' messages unless -v2 or higher is on
Following GNU make, this patch makes GHC not emit messages about modules
its skipping. This makes builds much quieter, and its a lot easier to
work out what effects a change had on the code.
The current behaviour can be recovered with -v2
Simon Marlow [Mon, 12 Jun 2006 08:41:14 +0000 (08:41 +0000)]
fix the stage3 build
Simon Marlow [Mon, 12 Jun 2006 08:35:20 +0000 (08:35 +0000)]
oops, undo accidental commit of version number
Simon Marlow [Fri, 9 Jun 2006 13:58:40 +0000 (13:58 +0000)]
Move readline configuration into the readline package
Simon Marlow [Thu, 8 Jun 2006 14:44:57 +0000 (14:44 +0000)]
fix possible ^C problems
Calling prodAllCapabilities() from interruptStgRts() was wrong, for
the same reasons that we stopped doing it in handle_tick(). We now
use the same mechanism (send a byte down the pipe to the IO manager
thread), but abstract it in a wakeUpRts() function in the scheduler.
Simon Marlow [Thu, 8 Jun 2006 14:42:10 +0000 (14:42 +0000)]
New tracing interface
A simple interface for generating trace messages with timestamps and
thread IDs attached to them. Most debugging output goes through this
interface now, so it is straightforward to get timestamped debugging
traces with +RTS -vt. Also, we plan to use this to generate
parallelism profiles from the trace output.
Simon Marlow [Thu, 8 Jun 2006 14:36:35 +0000 (14:36 +0000)]
fix warnings
Simon Marlow [Thu, 8 Jun 2006 14:35:20 +0000 (14:35 +0000)]
fix warnings
Simon Marlow [Thu, 8 Jun 2006 14:34:38 +0000 (14:34 +0000)]
Make it so that StgWord/StgInt are longs
This means we can use a %ld format specifier for StgWord/StgInt with
printf and not get shouted at by gcc.
Simon Marlow [Thu, 8 Jun 2006 14:28:44 +0000 (14:28 +0000)]
more warning fixage
Simon Marlow [Thu, 8 Jun 2006 14:19:03 +0000 (14:19 +0000)]
fix a warning
Simon Marlow [Thu, 8 Jun 2006 14:02:01 +0000 (14:02 +0000)]
fix some warnings
Simon Marlow [Thu, 8 Jun 2006 13:01:01 +0000 (13:01 +0000)]
Add new RTS flags for tracing:
-vs Trace scheduler events (see also -Ds with -debug)
-vt Time-stamp trace messages
the intention is that we will pipe the -vs output into a
profile-generating tool. This commit includes the flags only,
functionality to follow.
Simon Marlow [Wed, 7 Jun 2006 14:58:48 +0000 (14:58 +0000)]
codegen debug flag (+RTS -Dc) was unused; remove it
Simon Marlow [Wed, 7 Jun 2006 14:58:00 +0000 (14:58 +0000)]
add 'const' modifiers to types where appropriate
Simon Marlow [Wed, 7 Jun 2006 14:56:26 +0000 (14:56 +0000)]
rearrange casts to avoid gcc warnings
Simon Marlow [Wed, 7 Jun 2006 14:10:13 +0000 (14:10 +0000)]
warning fix
Simon Marlow [Wed, 7 Jun 2006 13:45:53 +0000 (13:45 +0000)]
remove //@ stuff
Simon Marlow [Wed, 7 Jun 2006 12:44:07 +0000 (12:44 +0000)]
Gather timing stats for a Task when it completes.
Previously we did this just for workers, now we do it for the main
thread and for forkOS threads too.
Simon Marlow [Wed, 7 Jun 2006 11:51:05 +0000 (11:51 +0000)]
Remove unnecessary SCHED_INTERRUPTED scheduler state
Simon Marlow [Thu, 27 Apr 2006 13:00:48 +0000 (13:00 +0000)]
fix a warning
simonmar@microsoft.com [Tue, 6 Jun 2006 12:46:56 +0000 (12:46 +0000)]
re-enable time package on Windows
Simon Marlow [Tue, 6 Jun 2006 11:23:57 +0000 (11:23 +0000)]
fix a case of "naughty I386 byte reg"
The fix is a little hacky, because we don't have support for register
classes in general, but it's an improvement.
Neil Mitchell [Fri, 2 Jun 2006 14:59:13 +0000 (14:59 +0000)]
A better icon for GHCi
simonmar@microsoft.com [Tue, 6 Jun 2006 08:58:05 +0000 (08:58 +0000)]
markSignalHandlers(): implementation was unnecessary, and had a bug
There's no need to mark the signal handler here, because it is stored
in a StablePtr and hence is a root anyway. Furthermore, the call to
evac() was passing the address of a local variable, which turned out
to be harmless for copying GC, but fatal for compacting GC: compacting
GC assumes that the addresses of the roots are the same each time.
Fixes: possibly #783, possibly #776, definitely #787
sof@galois.com [Mon, 5 Jun 2006 16:51:25 +0000 (16:51 +0000)]
disable time package on mingw to unblock builds.
simonpj@microsoft.com [Mon, 5 Jun 2006 15:43:05 +0000 (15:43 +0000)]
Remove one more IfaceInlineCall
simonpj@microsoft.com [Mon, 5 Jun 2006 11:49:00 +0000 (11:49 +0000)]
Remove InlinePlease and add inline function and RULE
For a long time GHC has had some internal mechanism designed to support
a call-site inline directive, thus
inline f xs
makes f be inlined at the call site even if f is big.
However, the surface syntax seems to have gone, and in any case it
can be done more neatly using a RULE.
This commit:
* Removes the InlineCall constructor for Note
and InlinePlease for SimplCont
* Adds a new known-key Id called 'inline', whose definition in
GHC.Base is just the identity function
* Adds a built-in RULE in PrelRules that rewrites (inline f) to
the body of f, if possible
* Adds documentation
NOTE: I have not tested this (aeroplane work). Give it a try!
simonpj@microsoft.com [Mon, 5 Jun 2006 11:47:19 +0000 (11:47 +0000)]
Fix typo
Simon Marlow [Thu, 1 Jun 2006 12:54:06 +0000 (12:54 +0000)]
fix type of allocateExec
Simon Marlow [Thu, 1 Jun 2006 12:33:14 +0000 (12:33 +0000)]
stgMallocBytesRWX --> allocateExec
Simon Marlow [Thu, 1 Jun 2006 12:14:35 +0000 (12:14 +0000)]
fix non-Windows build
simonmar@microsoft.com [Thu, 1 Jun 2006 11:54:23 +0000 (11:54 +0000)]
Win32: set up the console code pages
This may help with entering non-ASCII characters at the GHCi prompt,
but as usual with Unicode there's no simple solution that just works.
See commentary in InteractiveUI.hs for more details.
simonmar@microsoft.com [Thu, 1 Jun 2006 11:53:35 +0000 (11:53 +0000)]
add a type signature
simonmar@microsoft.com [Thu, 1 Jun 2006 11:53:06 +0000 (11:53 +0000)]
improvements to lexical error reporting
simonmar@microsoft.com [Thu, 1 Jun 2006 11:52:47 +0000 (11:52 +0000)]
commented-out debugging code
simonmar@microsoft.com [Thu, 1 Jun 2006 11:51:49 +0000 (11:51 +0000)]
understand Latin-1 symbols
Simon Marlow [Wed, 31 May 2006 09:12:02 +0000 (09:12 +0000)]
stgMallocBytesRWX --> allocateExec
Not sure how I left this out of the previous patch, oh well.
sof@galois.com [Tue, 30 May 2006 22:30:09 +0000 (22:30 +0000)]
'time' depends on 'Win32' when Windows=YES; mirror that
when setting up SUBDIRS.
simonmar@microsoft.com [Tue, 30 May 2006 10:14:52 +0000 (10:14 +0000)]
Win32: add _imp__tzname
simonmar@microsoft.com [Tue, 30 May 2006 10:14:18 +0000 (10:14 +0000)]
fix Win32 build
Simon Marlow [Tue, 30 May 2006 10:02:11 +0000 (10:02 +0000)]
replace stgMallocBytesRWX() with our own allocator
See bug #738
Allocating executable memory is getting more difficult these days. In
particular, the default SELinux policy on Fedora Core 5 disallows
making the heap (i.e. malloc()'d memory) executable, although it does
apparently allow mmap()'ing anonymous executable memory by default.
Previously, stgMallocBytesRWX() used malloc() underneath, and then
tried to make the page holding the memory executable. This was rather
hacky and fails with Fedora Core 5.
This patch adds a mini-allocator for executable memory, based on the
block allocator. We grab page-sized blocks and make them executable,
then allocate small objects from the page. There's a simple free
function, that will free whole pages back to the system when they are
empty.
Simon Marlow [Tue, 30 May 2006 07:07:21 +0000 (07:07 +0000)]
add time subdir
simonpj@microsoft.com [Thu, 25 May 2006 15:44:47 +0000 (15:44 +0000)]
Make rule-matching robust to lets
Consider a RULE like
forall arr. splitD (joinD arr) = arr
Until now, this rule would not match code of form
splitD (let { d = ... } in joinD (...d...))
because the 'let' got in the way.
This patch makes the rule-matcher robust to lets. See comments with
the Let case of Rules.match.
This improvement is highly desirable in the fusion rules for NDP
stuff that Roman is working on, where we are doing fusion of *overloaded*
functions (which may look lazy). The let expression that Roman tripped
up on was a dictioary binding.
simonpj@microsoft.com [Thu, 25 May 2006 09:45:45 +0000 (09:45 +0000)]
Improve error reporting in interface typechecking
simonpj@microsoft.com [Thu, 25 May 2006 09:43:00 +0000 (09:43 +0000)]
Fix egregious and long-standing tidying bug
A typo in tidyAlt meant that we could get shadowing of occurrence names
in the output of tidying. (Specifically, of existentially bound type
variables.) That in turn meant that an IfaceExpr could have shadowing, so
when the IfaceExpr was read in, it meant something different.
That in turn led to an obscure crash like:
Panic: tcIfaceTyVar
Anyway, this fixes it. MERGE into 6.4.3.
simonpj@microsoft.com [Thu, 25 May 2006 09:42:51 +0000 (09:42 +0000)]
Prune imports
Simon Marlow [Thu, 25 May 2006 09:00:35 +0000 (09:00 +0000)]
performGC_(): don't use the existing Task, always grab a new one
Simon Marlow [Wed, 24 May 2006 12:28:39 +0000 (12:28 +0000)]
Better control of the IO manager thread; improvements to deadlock checking
In the threaded RTS on *nix platforms:
- we now start the IO manager thread eagerly at startup time
(previously was started on demand).
- we now ask the IO manager thread to stop at shutdown
- In Timer.c:handle_tick, if it looks like we might be in a
deadlock, instead of calling prodOneCapability() which was known to be
wrong, we now send a byte down the IO manager's pipe to wake it up.
This also avoids a case of double-acquisition of a mutex, which
happened if prodOneCapability() was called while the current thread
was holding a mutex.
Simon Marlow [Wed, 24 May 2006 12:21:03 +0000 (12:21 +0000)]
TARGET_OS ==> HOST_OS
Simon Marlow [Wed, 24 May 2006 12:20:22 +0000 (12:20 +0000)]
fix a _TARGET_ARCH that should be _HOST_ARCH
Simon Marlow [Wed, 24 May 2006 11:20:07 +0000 (11:20 +0000)]
we don't need OutOfHeapHook(), and the version in the RTS has a better message
simonpj@microsoft.com [Tue, 23 May 2006 13:00:22 +0000 (13:00 +0000)]
Bug-fix to patch "Run simplifier before SpecConstr"
simonpj@microsoft.com [Tue, 23 May 2006 08:55:46 +0000 (08:55 +0000)]
Run simplifier before SpecConstr
Arrange to run the simplifier before SpecConstr, to (almost entirely)
eliminate shadowing.
Reason: otherwise SpecConstr can generate a RULE that never
files; and LiberateCase specifically *does* generate lots of shadowing.
See Note [Shadowing] in SpecConstr.lhs
simonpj@microsoft.com [Mon, 22 May 2006 19:25:32 +0000 (19:25 +0000)]
Prune imports
simonpj@microsoft.com [Mon, 22 May 2006 19:24:04 +0000 (19:24 +0000)]
Add deShadowBinds
Add CoreSubst.deShadowBinds, which removes shadowing from
a Core term. I thought we wanted it for SpecConstr, but in
fact decided not to use it. Nevertheless, it's a useful sort
of function to have around, and it has a particularly simple
definition!
simonpj@microsoft.com [Mon, 22 May 2006 16:32:55 +0000 (16:32 +0000)]
Inline in a call argument if the caller has RULES
This is an experimental change suggested by Roman. Consider
{-# INLINE f #-}
f x y = ...
....(g (f a b))...
where g has RULES. Then we'd like to inline f, even though the context of
the call is otherwise 100% boring -- g is lazy and we know nothing about
x and y.
This patch just records in the continuation that f has rules. And does so
somewhat recursively...e.g.
...(g (h (f a b)))...
where g has rules.
simonpj@microsoft.com [Mon, 22 May 2006 16:31:09 +0000 (16:31 +0000)]
Add idHasRules
Add Id.idHasRules :: Id -> Bool, with the obvious semantics.
This patch makes sense by itself, but it's just a tidy-up.
simonpj@microsoft.com [Mon, 22 May 2006 11:02:56 +0000 (11:02 +0000)]
Transmit inline pragmas faithfully
*** WARNING: you will need to recompile your libraries
*** when you pull this patch (make clean; make)
The inline pragma on wrapper-functions was being lost; this patch
makes it be transmitted faithfully.
The reason is that we don't write the full inlining for a wrapper into
an interface file, because it's generated algorithmically from its strictness
info. But previously the inline pragma as being written out only when we
wrote out an unfolding, and hence it was lost for a wrapper.
This makes a particular difference when a function has a NOINLINE[k] pragma.
Then it may be w/w'd, and we must retain the pragma. It's the only consistent
thing to do really.
The change does change the binary format of interface files, slightly.
So you need to recompile all your libraries.
simonpj@microsoft.com [Fri, 19 May 2006 10:34:33 +0000 (10:34 +0000)]
Improved RULE lhs typechecking; less dictionary sharing
See long comment with Simplify.tcSimplifyRuleLhs.
Here's the key example:
RULE "g" forall x y z. g (x == y) (y == z) = ...
Here, the two dictionaries are *identical*, but we do NOT WANT to
generate the rule
RULE forall x::a, y::a, z::a, d1::Eq a
f ((==) d1 x y) ((>) d1 y z) = ...
Instead we want
RULE forall x::a, y::a, z::a, d1::Eq a, d2:Eq a
f ((==) d1 x y) ((>) d2 y z) = ...
simonpj@microsoft.com [Fri, 19 May 2006 09:50:22 +0000 (09:50 +0000)]
Bug-fix for infix function definitions (parse/rename)
Fix a crash provoked by
x `op` y = x
op = True
The trouble was that there is currently a single 'infix' flag for the
whole group; and RnTypes.checkPrecMatch was therefore expecting the
second eqn to have two args.
This fixes the crash, and also or-s the infix flags for the various
eqns together; previously it was just taken from the first eqn, which
was wrong.
simonpj@microsoft.com [Fri, 19 May 2006 09:49:36 +0000 (09:49 +0000)]
Remove misleading comments
simonpj@microsoft.com [Thu, 18 May 2006 16:36:17 +0000 (16:36 +0000)]
Fix a nasty continuation-duplication bug
For a long-time mkDupableCont has had a bug that allows it to duplicate
an arbitrary continuation, which it should not do, of course.
The bug was that in the Select case of mkDupableCont we were calling
prepareCaseCont, which did not duplicate the continuation if there is
but a single alternative. This is quite right in the case of the call
in rebuildCase, but quite wrong in mkDupableCont.
The bug manifest as follows. In the expression
f (case ... of { ..several alts.. })
(when f is strict), we should transform to
f (...transformed arg...)
The application of f should not be pushed down (see notes with the
ArgOf case of mkDupableCont. But that was not happening in an example
like this (see how the call to f is pushed inwards).
f (a `div` abs (b::Int))
--->
case b_afT of wild_aHa { GHC.Base.I# x_aHc ->
let {
$j_sIe :: GHC.Prim.Int# -> GHC.Base.Int
[]
$j_sIe =
\ (ds1_aHr [Nothing OneShot] :: GHC.Prim.Int#) ->
Foo7.f
(case ds1_aHr of ds2_aHq {
__DEFAULT ->
case a_afS of wild1_aHM { GHC.Base.I# x_aHO ->
GHC.Base.I# (GHC.Base.divInt# x_aHO ds2_aHq)
};
0 -> GHC.Err.divZeroError @ GHC.Base.Int
})
} in
case GHC.Prim.>=# x_aHc 0 of wild1_aHe [Dead Nothing] {
GHC.Base.False ->
let {
ds1_aHr :: GHC.Prim.Int#
[]
ds1_aHr = GHC.Prim.negateInt# x_aHc
} in $j_sIe ds1_aHr;
GHC.Base.True -> $j_sIe x_aHc
}
}
simonpj@microsoft.com [Thu, 18 May 2006 16:34:48 +0000 (16:34 +0000)]
Make simplifier report which phase it is doing in -ddump output
simonpj@microsoft.com [Thu, 18 May 2006 16:34:25 +0000 (16:34 +0000)]
Comments only
Simon Marlow [Thu, 18 May 2006 13:15:06 +0000 (13:15 +0000)]
take parsec out of $(GhcBootLibs)
simonpj@microsoft.com [Thu, 18 May 2006 11:32:12 +0000 (11:32 +0000)]
Improve documentation of INLINE pragmas
Simon Marlow [Thu, 18 May 2006 10:40:25 +0000 (10:40 +0000)]
a couple of additions
Simon Marlow [Thu, 18 May 2006 10:37:15 +0000 (10:37 +0000)]
#define _REENTRANT 1 (needed to get the right errno on some OSs)
Partial fix for hanging problems on Solaris and possibly *BSD.
A similar fix is also required to libraries/base/includes/HsBase.h.
Simon Marlow [Thu, 18 May 2006 10:28:58 +0000 (10:28 +0000)]
Declare this file to be POSIX
This is simpler than using _POSIX_THREAD_SEMANTICS on Solaris to get
the right version of ctime_r().
Simon Marlow [Thu, 18 May 2006 07:44:15 +0000 (07:44 +0000)]
somewhere to keep track of release notes for 6.6
simonpj@microsoft.com [Wed, 17 May 2006 15:50:09 +0000 (15:50 +0000)]
Newtype data constructors get a compulsory unfolding
With this change, newtype data constructors get a "compulsory" unfolding,
which means that they *must* be inlined, and no top-level definition of
the constructor is provided at all. Since these constructors are no-ops,
I'm not sure why this wasn't the case all along.
simonpj@microsoft.com [Wed, 17 May 2006 15:49:36 +0000 (15:49 +0000)]
White space only
simonpj@microsoft.com [Wed, 17 May 2006 15:47:25 +0000 (15:47 +0000)]
Retain InlinePragInfo on wrappers
For some reason, when doing the worker/wrapper split, we transferred the
InlinePragInfo from the original function, but expunging it from the wrapper.
This meant, for example, that a NOINLINE function would have its wrapper
inlined, which isn't sensible.
For a change, fixing a bug involves only deleting code!
simonpj@microsoft.com [Wed, 17 May 2006 15:47:10 +0000 (15:47 +0000)]
Spelling correction
simonpj@microsoft.com [Wed, 17 May 2006 15:44:49 +0000 (15:44 +0000)]
Retain INLINE pragma information during indirection-shorting
During indirection-shorting, we were dropping the InlinePragInfo,
although were were carefully retaining strictness info etc.
I think this is a long-standing bug.
simonpj@microsoft.com [Wed, 17 May 2006 15:43:49 +0000 (15:43 +0000)]
Improve pretty-printing
simonpj@microsoft.com [Wed, 17 May 2006 15:43:04 +0000 (15:43 +0000)]
Comments only
simonpj@microsoft.com [Wed, 17 May 2006 15:42:04 +0000 (15:42 +0000)]
Improve pretty-printing slightly
Duncan Coutts [Tue, 16 May 2006 09:04:30 +0000 (09:04 +0000)]
Let GHCi work with with Sparc32+/V8+ .o files
Currently the GHCi linker looks exclusively for V7 ABI .o files.
You can generate V8+ ABI .o files using flags to gcc such as:
-optc-mcpu=ultrasparc -opta-mcpu=ultrasparc
Note that this allows gcc to generate hardware integer division and
hardware floating point instructions rather than using software emulation.
All recent sparc hardware is V8+ or later. Perhaps we should check for the
cpu generation in configure and use the later ABI if possible.
Tested briefly on a SunBlade 100 (TI UltraSparc IIe) sparc-unknown-linux
Simon Marlow [Mon, 15 May 2006 09:00:31 +0000 (09:00 +0000)]
match up more closely with compiler/main/DynFlags.hs:machdepCCOpts
In particular, add -fno-builtin to x86 and x86_64, which was missing.
Simon Marlow [Wed, 10 May 2006 12:46:21 +0000 (12:46 +0000)]
set $(GhcVersion) and $(GhcPatchLevel) correctly when $(UseStage1)==YES
Simon Marlow [Wed, 10 May 2006 12:15:24 +0000 (12:15 +0000)]
.raw_s and .s live in $(odir), not the source dir
Simon Marlow [Wed, 10 May 2006 12:00:00 +0000 (12:00 +0000)]
additions from Reilly Hayes
Simon Marlow [Wed, 10 May 2006 11:52:36 +0000 (11:52 +0000)]
some tweaks to the HC bootstrapping instructions
Lemmih [Wed, 10 May 2006 07:27:22 +0000 (07:27 +0000)]
Ignore unboxed values in breakpoints.
Lemmih [Tue, 9 May 2006 22:34:55 +0000 (22:34 +0000)]
Don't read ~/.ghci on breakpoints.
Simon Marlow [Tue, 9 May 2006 08:31:24 +0000 (08:31 +0000)]
make it possible to define an alias for :quit
simonpj@microsoft.com [Mon, 8 May 2006 14:29:46 +0000 (14:29 +0000)]
Do not put wired-in things in interface files
There is no need for wired-in things to go into interface files; the compiler
knows about them anyway. Worse, it turns ou that if they are in an interface
file, they may get read in with not-quite-right type info (e.g. GHC.Err.error),
and the not-quite-right thing gets into the type envt. Than it gets used
instead of the wired in thing.
Best all round never to put them into interface files. This is the way
it used to be, but it looks as if it rotted away some time ago.
(I noticed this when fixing unsafePerformIO stuff, becuase 'lazy' was getting
an unfolding when it shouldn't.)
simonpj@microsoft.com [Mon, 8 May 2006 14:28:34 +0000 (14:28 +0000)]
Remove NOINLINE strictness hack
The stricteness analyser used to have a HACK which ensured that NOINLNE things
were not strictness-analysed. The reason was unsafePerformIO. Left to itself,
the strictness analyser would discover this strictness for unsafePerformIO:
unsafePerformIO: C(U(AV))
But then consider this sub-expression
unsafePerformIO (\s -> let r = f x in
case writeIORef v r s of (# s1, _ #) ->
(# s1, r #)
The strictness analyser will now find that r is sure to be eval'd,
and may then hoist it out. This makes tests/lib/should_run/memo002
deadlock.
Solving this by making all NOINLINE things have no strictness info is overkill.
In particular, it's overkill for runST, which is perfectly respectable.
Consider
f x = runST (return x)
This should be strict in x.
So the new plan is to define unsafePerformIO using the 'lazy' combinator:
unsafePerformIO (IO m) = lazy (case m realWorld# of (# _, r #) -> r)
Remember, 'lazy' is a wired-in identity-function Id, of type a->a, which is
magically NON-STRICT, and is inlined after strictness analysis. So
unsafePerformIO will look non-strict, and that's what we want.
Now we don't need the hack in the strictness analyser.
simonpj@microsoft.com [Mon, 8 May 2006 14:18:04 +0000 (14:18 +0000)]
Trim imports