Simon Marlow [Thu, 29 Jun 2006 12:00:29 +0000 (12:00 +0000)]
small optimisation: eliminate more register-to-register moves
Simon Marlow [Thu, 29 Jun 2006 11:59:49 +0000 (11:59 +0000)]
new syntax: "prim %OP (args)" for using CallishMachOps in .cmm
Simon Marlow [Thu, 29 Jun 2006 11:58:37 +0000 (11:58 +0000)]
add MO_WriteBarrier to CallishMachOps
This will let us express write barriers in C--
Simon Marlow [Thu, 29 Jun 2006 08:29:02 +0000 (08:29 +0000)]
Use -fno-strict-aliasing for *all* C files in the runtime
as a precautionary measure. It is definitely required for GC.c,
but it may well become necessary for other files in the future due to
our (mis-)use of the C "type system".
Simon Marlow [Fri, 23 Jun 2006 15:26:26 +0000 (15:26 +0000)]
the unlifted kind
Simon Marlow [Tue, 20 Jun 2006 15:19:01 +0000 (15:19 +0000)]
fix a lint-o
Simon Marlow [Tue, 20 Jun 2006 15:17:58 +0000 (15:17 +0000)]
fix sloppy conditionals
Simon Marlow [Tue, 20 Jun 2006 15:10:39 +0000 (15:10 +0000)]
fix sloppy conditionals
Simon Marlow [Tue, 20 Jun 2006 15:06:18 +0000 (15:06 +0000)]
fix a few sloppy conditionals caught by new test in CmmLint
Simon Marlow [Tue, 20 Jun 2006 15:05:20 +0000 (15:05 +0000)]
flattenCgStmts: fix a case of empty code blocks being generated
Simon Marlow [Tue, 20 Jun 2006 14:12:19 +0000 (14:12 +0000)]
improve a panic message
Simon Marlow [Tue, 20 Jun 2006 14:12:04 +0000 (14:12 +0000)]
check that the argument to CmmCondBranch is really a conditional
Simon Marlow [Tue, 20 Jun 2006 14:01:06 +0000 (14:01 +0000)]
Generate a new unique for each label
simonpj@microsoft.com [Thu, 29 Jun 2006 10:53:21 +0000 (10:53 +0000)]
Remove long-redundant FieldLabel.lhs
simonpj@microsoft.com [Tue, 27 Jun 2006 16:15:20 +0000 (16:15 +0000)]
Add comments to SpecConstr
Simon Marlow [Tue, 27 Jun 2006 12:39:51 +0000 (12:39 +0000)]
fix up slop-overwriting for THUNK_SELECTORS in DEBUG mode
simonpj@microsoft.com [Tue, 27 Jun 2006 09:47:42 +0000 (09:47 +0000)]
Make SpecConstr work better for nested functions
In SpecConstr.scBind, we should pass the optimised body (body') to
specialise, not the un-optimised one. In this way we'll benefit from
specialising any nested functions inside body.
Discovered by Roman.
simonpj@microsoft.com [Mon, 26 Jun 2006 20:17:09 +0000 (20:17 +0000)]
More SpecConstr tuning
For some reason, SpecConstr wasn't taking account of let-bound constructors:
let v = Just 4
in ...(f v)...
Now it does. An easy fix fortunately.
simonpj@microsoft.com [Mon, 26 Jun 2006 10:00:34 +0000 (10:00 +0000)]
Improve consistency checking for derived instances
This patch arranges that derived instances use the same instance-decl
checking code as user-defined instances. That gives greater consistency
in error messages.
Furthermore, the error description if this consistency check fails is now
much more explicit. For example, drvfail003 now says
Variable occurs more often in a constraint than in the instance head
in the constraint: Show (v (v a))
(Use -fallow-undecidable-instances to permit this)
In the derived instance
instance (Show (v (v a))) => Show (Square_ v w a)
simonpj@microsoft.com [Mon, 26 Jun 2006 09:59:52 +0000 (09:59 +0000)]
Slight improvement in TH error reporting
simonpj@microsoft.com [Wed, 14 Jun 2006 11:48:13 +0000 (11:48 +0000)]
Improve location info when typechecking interface fiels
davve@dtek.chalmers.se [Sun, 25 Jun 2006 16:08:26 +0000 (16:08 +0000)]
Fix a bug in the pretty printing of class declarations
simonpj@microsoft.com [Sat, 24 Jun 2006 16:04:21 +0000 (16:04 +0000)]
Improve RULE matching a bit more
Consider this example (provided by Roman)
foo :: Int -> Maybe Int -> Int
foo 0 (Just n) = n
foo m (Just n) = foo (m-n) (Just n)
SpecConstr sees this fragment:
case w_smT of wild_Xf [Just A] {
Data.Maybe.Nothing -> lvl_smf;
Data.Maybe.Just n_acT [Just S(L)] ->
case n_acT of wild1_ams [Just A] { GHC.Base.I# y_amr [Just L] ->
$wfoo_smW (GHC.Prim.-# ds_Xmb y_amr) wild_Xf
}};
and correctly generates the rule
RULES: "SC:$wfoo1" [0] __forall {y_amr [Just L] :: GHC.Prim.Int#
sc_snn :: GHC.Prim.Int#}
$wfoo_smW sc_snn (Data.Maybe.Just @ GHC.Base.Int (GHC.Base.I# y_amr))
= $s$wfoo_sno y_amr sc_snn ;]
BUT we must ensure that this rule matches in the original function!
Note that the call to $wfoo is
$wfoo_smW (GHC.Prim.-# ds_Xmb y_amr) wild_Xf
During matching we expand wild_Xf to (Just n_acT). But then we must also
expand n_acT to (I# y_amr). And we can only do that if we look up n_acT
in the in-scope set, because in wild_Xf's unfolding it won't have an unfolding
at all.
Happily, fixing the bug is easy: add a call to 'lookupRnInScope' in the
(Var v2) case of 'match'.
Simon Marlow [Fri, 23 Jun 2006 11:33:03 +0000 (11:33 +0000)]
--enable-src-tree-haddock and friends are no longer required
Happy, Alex and Haddock are built separately using Cabal now.
Simon Marlow [Fri, 23 Jun 2006 09:20:44 +0000 (09:20 +0000)]
fix a couple of bugs in markSparkQueue (#799)
sof@galois.com [Thu, 22 Jun 2006 20:27:34 +0000 (20:27 +0000)]
pull in STABLE(!) tweaks
Simon Marlow [Thu, 22 Jun 2006 13:17:00 +0000 (13:17 +0000)]
fix for when path to GHC contains spaces, from #695
simonpj@microsoft.com [Wed, 21 Jun 2006 22:39:40 +0000 (22:39 +0000)]
Comment only
simonpj@microsoft.com [Wed, 21 Jun 2006 22:36:37 +0000 (22:36 +0000)]
Transfer INLINE to specialised functions
When the Specialise pass generates a specialised copy of a function,
it should transfer the INLINE information to the specialised function.
Otherwise, whether or not the INLNE happens can depend on whether
specialisation happens, which seems wrong. See Note [Inline specialisation]
in Specialise.lhs
Here's the example Roman reported
primWriteMU :: UAE e => MUArr e s -> Int -> e -> ST s ()
{-# INLINE primWriteMU #-}
primWriteMU = writeMBU . unMUAPrim
------
The problem is that primWriteMU doesn't get inlined *sometimes*, which
results in code like
case Data.Array.Parallel.Unlifted.Flat.UArr.$sprimWriteMU
@ s11_X1nJ
marr_s25s
(GHC.Base.I# sc_s27F)
GHC.Base.False
new_s_a1Db
of wild3_a1Dd { (# new_s1_X1F9, r_a1Dc #) -> ...
Note the fact that we have a call to the *specialised* $sprimWriteMU.
simonpj@microsoft.com [Wed, 21 Jun 2006 20:58:55 +0000 (20:58 +0000)]
Arity and eta-expansion tuning
Roman found that
loop :: STRef s a -> Int -> ST s Int
loop ref n = case n of
0 -> return n
n -> loop ref (n-1)
wasn't eta-expanding nicely, despite the 'state hack'
(see Id.isStateHackType). The reason was two-fold:
a) a bug in CoreUtils.arityType (the Var case)
b) the arity of a recursive function was not being
exposed in its RHS (see commments with
SimplEnv.addLetIdInfo
The commit fixes both.
Simon Marlow [Wed, 21 Jun 2006 11:25:23 +0000 (11:25 +0000)]
documentation for TH w/ profiling
Simon Marlow [Wed, 21 Jun 2006 11:04:36 +0000 (11:04 +0000)]
Allow Template Haskell to be used with -prof
In order for this to work, you need to build the program first in the
normal way (without -prof), and then again with -prof and a suitable
-osuf (eg. -osuf p_o). The compiler will pick up the object files
from the normal way for running TH expressions, when it sees -prof
together with -osuf. If you omit the -osuf, you get an error message:
TH_genEx.hs:12:2:
Dynamic linking required, but this is a non-standard build (eg. prof).
You need to build the program twice: once the normal way, and then
in the desired way using -osuf to set the object file suffix.
If you use -osuf, but haven't built the program the normal way first,
then you see:
TH_genEx.hs:12:2:
cannot find normal object file `TH_genExLib.o'
while linking an interpreted expression
Documentation to follow.
Fixes: #651
Simon Marlow [Tue, 20 Jun 2006 08:34:10 +0000 (08:34 +0000)]
add decl for stg_block_throwto_ret
Simon Marlow [Fri, 16 Jun 2006 14:07:50 +0000 (14:07 +0000)]
comment out a non-true assertion
Simon Marlow [Fri, 16 Jun 2006 14:06:52 +0000 (14:06 +0000)]
make compilation a little less noisy
Simon Marlow [Fri, 16 Jun 2006 14:06:33 +0000 (14:06 +0000)]
allow the max number of workers to scale with +RTS -N
Simon Marlow [Fri, 16 Jun 2006 13:56:21 +0000 (13:56 +0000)]
fix one-character error in stack check
Simon Marlow [Fri, 16 Jun 2006 11:19:37 +0000 (11:19 +0000)]
add STM support to the new throwTo mechanism
Simon Marlow [Fri, 16 Jun 2006 11:02:58 +0000 (11:02 +0000)]
remove duplicate way names (-debug -debug didn't work)
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