ghc-hetmet.git
17 years agoAdd a new section "Getting the Source" to both HACKING and README. But what about...
shae@ScannedInAvian.com [Thu, 20 Jul 2006 15:29:29 +0000 (15:29 +0000)]
Add a new section "Getting the Source" to both HACKING and README. But what about win32 users?

17 years agosavingOldConfig: add Exception.block for extra paranoia
Simon Marlow [Tue, 1 Aug 2006 13:10:27 +0000 (13:10 +0000)]
savingOldConfig: add Exception.block for extra paranoia

17 years agoRefactor ghc-pkg
Ian Lynagh [Sat, 29 Jul 2006 19:29:46 +0000 (19:29 +0000)]
Refactor ghc-pkg
This patch fixes a couple of issues with the
    Be lazier in user config creation, and don't fail on missing configs.
patch. It puts the createDirectoryIfMissing back in and removes assumptions
that the package.conf file already exists.

17 years agoNo functionality changes
Ian Lynagh [Sun, 30 Jul 2006 10:52:56 +0000 (10:52 +0000)]
No functionality changes
Consistently used spaces rather than tabs.
Removed trailing whitespace.
Wrapped comments to fit in a standard terminal.

17 years agoAdd notes about unsafeCoerce
simonpj@microsoft.com [Mon, 31 Jul 2006 08:09:22 +0000 (08:09 +0000)]
Add notes about unsafeCoerce

17 years ago.hi-boot-5 is obsolete; the earliest GHC we support uses .hi-boot-6
Simon Marlow [Fri, 28 Jul 2006 14:08:09 +0000 (14:08 +0000)]
.hi-boot-5 is obsolete; the earliest GHC we support uses .hi-boot-6

17 years agoupdate to match .lhs-boot
Simon Marlow [Fri, 28 Jul 2006 14:06:07 +0000 (14:06 +0000)]
update to match .lhs-boot

17 years agoget ReadP from the right place.
Simon Marlow [Fri, 28 Jul 2006 14:04:44 +0000 (14:04 +0000)]
get ReadP from the right place.

17 years agoImprove error message for deriving
simonpj@microsoft.com [Thu, 27 Jul 2006 16:08:32 +0000 (16:08 +0000)]
Improve error message for deriving

17 years agoLazy patterns are like wild-cards for overlap warnings
simonpj@microsoft.com [Thu, 27 Jul 2006 15:50:09 +0000 (15:50 +0000)]
Lazy patterns are like wild-cards for overlap warnings

MERGE TO STABLE

Fixes Trac #827
Test is should_compiler/ds058

17 years agofix some problems with wired-in packages
Simon Marlow [Thu, 27 Jul 2006 15:38:02 +0000 (15:38 +0000)]
fix some problems with wired-in packages

17 years agooops, remove old packages when updating
Simon Marlow [Thu, 27 Jul 2006 15:06:50 +0000 (15:06 +0000)]
oops, remove old packages when updating

17 years agofix symbols for GHC.PrimopWrappers
Simon Marlow [Thu, 27 Jul 2006 13:47:55 +0000 (13:47 +0000)]
fix symbols for GHC.PrimopWrappers

17 years agoa couple more symbols need package names
Simon Marlow [Thu, 27 Jul 2006 10:21:29 +0000 (10:21 +0000)]
a couple more symbols need package names

17 years agoAdd missing import
simonpj@microsoft.com [Thu, 27 Jul 2006 08:56:05 +0000 (08:56 +0000)]
Add missing import

17 years agoMake -fcontext-stack into a dynamic flag
simonpj@microsoft.com [Thu, 27 Jul 2006 08:04:22 +0000 (08:04 +0000)]
Make -fcontext-stack into a dynamic flag

  This allows you to put -fcontext-stack into an options pragma,
  as requested by Trac #829

  While I was at it, I added OptIntPrefix to the forms allowed
  in CmdLineParser.

17 years agoDeal correctly with infix type constructors in GADT decls
simonpj@microsoft.com [Wed, 26 Jul 2006 22:53:04 +0000 (22:53 +0000)]
Deal correctly with infix type constructors in GADT decls

17 years agoImprove pretty printing of ConDecl
simonpj@microsoft.com [Wed, 26 Jul 2006 22:52:23 +0000 (22:52 +0000)]
Improve pretty printing of ConDecl

17 years agofix parse error (merge-o, I think)
Simon Marlow [Wed, 26 Jul 2006 10:35:26 +0000 (10:35 +0000)]
fix parse error (merge-o, I think)

17 years agofix DEBUG build
Simon Marlow [Wed, 26 Jul 2006 10:34:33 +0000 (10:34 +0000)]
fix DEBUG build

17 years agomissed one symbol that needs a package name
Simon Marlow [Wed, 26 Jul 2006 08:58:44 +0000 (08:58 +0000)]
missed one symbol that needs a package name

17 years agochange wired-in Haskell symbols to include the package name
Simon Marlow [Wed, 26 Jul 2006 08:46:59 +0000 (08:46 +0000)]
change wired-in Haskell symbols to include the package name

17 years agoUnbox the Unique stored in a Name
Simon Marlow [Tue, 25 Jul 2006 14:17:47 +0000 (14:17 +0000)]
Unbox the Unique stored in a Name
I measured that this makes the comiler allocate a bit more, but it
might also make it faster and reduce residency.  The extra allocation
is probably just because we're not inlining enough somewhere, so I
think this change is a step in the right direction.

17 years agooptimisations to newUnique
Simon Marlow [Tue, 25 Jul 2006 14:08:16 +0000 (14:08 +0000)]
optimisations to newUnique

It turned out that newUnique was wasting one node of the splittable
uniq supply per invocation: it took the current supply, split it, used
the unique from one half and stored the other half in the monad.  In
other words, the unique in the supply stored in the monad was never
used.

This optimisation fixes that and adds a bit of strictness, which
together lead to small reduction in allocations by the compiler, and
possibly an improvement in residency (hard to tell for sure when GCs
move around).

17 years agotiny bit of extra strictness
Simon Marlow [Tue, 25 Jul 2006 13:12:01 +0000 (13:12 +0000)]
tiny bit of extra strictness

17 years agoMake a SplitUniqSupply contain an Int# rather than an Int
Simon Marlow [Tue, 25 Jul 2006 12:02:52 +0000 (12:02 +0000)]
Make a SplitUniqSupply contain an Int# rather than an Int
The I# constructor is always removed when we make a unique later
anyway, so this just saves a bit of time and allocation.

17 years agoUse -package-name rather than -ignore-package
Simon Marlow [Tue, 25 Jul 2006 13:09:13 +0000 (13:09 +0000)]
Use -package-name rather than -ignore-package

17 years agoRemove most of the conflict checking and auto-hiding
Simon Marlow [Tue, 25 Jul 2006 13:08:50 +0000 (13:08 +0000)]
Remove most of the conflict checking and auto-hiding
Now that the module restriction has been lifted, the auto-hiding is
mostly not required.  GHC itself automatically hides old versions of a
package.

17 years agoGeneralise Package Support
Simon Marlow [Tue, 25 Jul 2006 13:01:54 +0000 (13:01 +0000)]
Generalise Package Support

This patch pushes through one fundamental change: a module is now
identified by the pair of its package and module name, whereas
previously it was identified by its module name alone.  This means
that now a program can contain multiple modules with the same name, as
long as they belong to different packages.

This is a language change - the Haskell report says nothing about
packages, but it is now necessary to understand packages in order to
understand GHC's module system.  For example, a type T from module M
in package P is different from a type T from module M in package Q.
Previously this wasn't an issue because there could only be a single
module M in the program.

The "module restriction" on combining packages has therefore been
lifted, and a program can contain multiple versions of the same
package.

Note that none of the proposed syntax changes have yet been
implemented, but the architecture is geared towards supporting import
declarations qualified by package name, and that is probably the next
step.

It is now necessary to specify the package name when compiling a
package, using the -package-name flag (which has been un-deprecated).
Fortunately Cabal still uses -package-name.

Certain packages are "wired in".  Currently the wired-in packages are:
base, haskell98, template-haskell and rts, and are always referred to
by these versionless names.  Other packages are referred to with full
package IDs (eg. "network-1.0").  This is because the compiler needs
to refer to entities in the wired-in packages, and we didn't want to
bake the version of these packages into the comiler.  It's conceivable
that someone might want to upgrade the base package independently of
GHC.

Internal changes:

  - There are two module-related types:

        ModuleName      just a FastString, the name of a module
        Module          a pair of a PackageId and ModuleName

    A mapping from ModuleName can be a UniqFM, but a mapping from Module
    must be a FiniteMap (we provide it as ModuleEnv).

  - The "HomeModules" type that was passed around the compiler is now
    gone, replaced in most cases by the current package name which is
    contained in DynFlags.  We can tell whether a Module comes from the
    current package by comparing its package name against the current
    package.

  - While I was here, I changed PrintUnqual to be a little more useful:
    it now returns the ModuleName that the identifier should be qualified
    with according to the current scope, rather than its original
    module.  Also, PrintUnqual tells whether to qualify module names with
    package names (currently unused).

Docs to follow.

17 years agocomment formatting
Simon Marlow [Tue, 25 Jul 2006 11:05:19 +0000 (11:05 +0000)]
comment formatting

17 years agounused import
Simon Marlow [Thu, 6 Jul 2006 14:13:49 +0000 (14:13 +0000)]
unused import

17 years agounused import
Simon Marlow [Thu, 6 Jul 2006 14:12:05 +0000 (14:12 +0000)]
unused import

17 years agoremove more Addr bits
Simon Marlow [Tue, 4 Jul 2006 15:12:17 +0000 (15:12 +0000)]
remove more Addr bits

17 years agounused import
Simon Marlow [Tue, 4 Jul 2006 14:13:19 +0000 (14:13 +0000)]
unused import

17 years agoadd default cases
Simon Marlow [Tue, 4 Jul 2006 13:54:44 +0000 (13:54 +0000)]
add default cases

17 years agoredundant import
Simon Marlow [Tue, 4 Jul 2006 13:54:35 +0000 (13:54 +0000)]
redundant import

17 years agounused imports
Simon Marlow [Tue, 4 Jul 2006 13:51:17 +0000 (13:51 +0000)]
unused imports

17 years agounused import
Simon Marlow [Tue, 4 Jul 2006 13:45:57 +0000 (13:45 +0000)]
unused import

17 years agoremove unused bits, mostly to do with the Addr type
Simon Marlow [Tue, 4 Jul 2006 12:49:12 +0000 (12:49 +0000)]
remove unused bits, mostly to do with the Addr type

17 years agoIn interface files, store FastStrings rather than OccNames where possible
Simon Marlow [Mon, 24 Jul 2006 15:48:26 +0000 (15:48 +0000)]
In interface files, store FastStrings rather than OccNames where possible
In all cases the namespace is known from the context, so this saves 1
byte per variable binding/occurrence (a few percent per iface file).

17 years agoAdd -fmono-pat-binds, and make it the default
simonpj@microsoft.com [Sat, 22 Jul 2006 10:22:45 +0000 (10:22 +0000)]
Add -fmono-pat-binds, and make it the default

In Haskell 98, pattern bindings are generalised.  Thus in
(f,g) = (\x->x, \y->y)
both f and g will get polymorphic types.  I have become convinced
that generalisation for pattern-bound variables is just a bridge
toof far. It is (I claim) almost never needed, and it adds significant
complication.  (All the more so if we add bang patterns.)

So the flag -fmono-pat-binds switches off generalisation for pattern
bindings.  (A single variable is treated as a degnerate funtction
binding.)

Furthremore, as an experiment, I'm making it the default.  I want
to see how many progarms fail with monomorphic pattern bindings.

You can recover the standard behaviour with -fno-mono-pa-binds.

17 years agoFix RULES lossage
simonpj@microsoft.com [Sat, 22 Jul 2006 10:17:56 +0000 (10:17 +0000)]
Fix RULES lossage

Don Stewart and Duncan Coutts encountered the following situation.
f = <rhs>
{-# RULES f ... #-}
where f is not exported, but appears in the inlinings of other
functions that are exported.  Then what happened was that the desugarer
produced this:
M.f = f
f = <rhs>
where the rules get attached to the M.f. But since M.f's RHS is trivial
(just f) it was unconditionally inlinined at all its call sites,
thereby losing the RULES attached to it.

This *is* a fragile aspect of rules. However this fix solves the
problem by instead generating
f = M.f
M.f = <rhs>

A pretty small chanage to the desugarer does the job.  It still feels
a little fragile, bt it's certainly more robust than before.

17 years agoFix broken regex
Simon Marlow [Fri, 21 Jul 2006 11:11:44 +0000 (11:11 +0000)]
Fix broken regex
Don't know how I managed to use this before... maybe a different regex
library.

17 years agofix bug in sample code
Simon Marlow [Fri, 21 Jul 2006 08:32:00 +0000 (08:32 +0000)]
fix bug in sample code

17 years agofix eran error message by reordering a couple of tests
simonmar@microsoft.com [Wed, 19 Jul 2006 11:16:38 +0000 (11:16 +0000)]
fix eran error message by reordering a couple of tests

17 years agoUse a recursive error handler in case the exception causes more exceptions.
Lemmih [Mon, 17 Jul 2006 23:25:53 +0000 (23:25 +0000)]
Use a recursive error handler in case the exception causes more exceptions.

17 years agoCheck for overlap-flag differences in hi files
simonpj@microsoft.com [Fri, 14 Jul 2006 16:38:43 +0000 (16:38 +0000)]
Check for overlap-flag differences in hi files

MERGE TO STABLE

I'd forgotten to compare the per-instance overlap flag when
comparing interface files, and that meant that consequential
recompilations weren't being triggered when the only change
was to add -fallow-overlapping-instances

Fixes Trac bug #824

17 years agoAdd a clarification about overlapping instances in the manual
simonpj@microsoft.com [Fri, 14 Jul 2006 14:32:20 +0000 (14:32 +0000)]
Add a clarification about overlapping instances in the manual

17 years agoComments and import trimming
simonpj@microsoft.com [Wed, 12 Jul 2006 15:33:06 +0000 (15:33 +0000)]
Comments and import trimming

17 years agoExperimental flag -fdicts-cheap
simonpj@microsoft.com [Wed, 12 Jul 2006 15:32:04 +0000 (15:32 +0000)]
Experimental flag -fdicts-cheap

This experimental flag, -fdicts-cheap, makes a let-binding that bind a
value of dictionary type look cheap.  That in turn leads to more
eta expansion.  Instead of
f = /\a. \(d1:Ord a). let d2:Ord [a] = dfOrd a d1 in
                 \(x:a). <stuff>
which has arity 1, you get
f = /\a. \(d1:Ord a). \(x:a).
         let d2:Ord [a] = dfOrd a d1 in <stuff>
Now f has arity 2.

This can cretainly waste dictionary-construction work, if f is
partially applied to its dictionary argument.  However it has knock-on
effects.  Because f has arity 2, we won't float (f Int d) out of
\x. h (f Int d)
Floating f out of this lambda makes it impossible for an h/f fusion
rule to fire; and this unexpected loss of RULE application was the
immediate reason for implementing this flag. (Roman Leshchinskiy came
across this when working on array fusion.)

I've implemented the change only in CoreUtils.arityType, which
only affects eta expansion.  I thought of putting the change in
exprIsCheap, which is a more systematic place (the former calls
the latter) but

a) I wanted this under flag control, and the flags
are not readily available to all callers of exprIsCheap

b) I'm not 100% convinced that this change is a good
idea, so it's reasonable to do the narrowest change
that solves the immediate problem.

17 years agodocument that -fglasgow-exts is needed for RULES to work
Malcolm.Wallace@cs.york.ac.uk [Wed, 12 Jul 2006 09:39:07 +0000 (09:39 +0000)]
document that -fglasgow-exts is needed for RULES to work

17 years agodo a better job of ignoring unrecognised pragmas
Simon Marlow [Wed, 12 Jul 2006 08:35:50 +0000 (08:35 +0000)]
do a better job of ignoring unrecognised pragmas

17 years agoDon't z-encode module names in external-core output
Jan Rochel [Thu, 6 Jul 2006 13:11:09 +0000 (13:11 +0000)]
Don't z-encode module names in external-core output

17 years agore-add -fvia-C
Simon Marlow [Mon, 10 Jul 2006 08:15:22 +0000 (08:15 +0000)]
re-add -fvia-C
There are still some fixes required to get the threaded RTS compilable
with the NCG, and apparently there are problems on 32-bit archs too.

17 years agoBe lazier in user config creation, and don't fail on missing configs.
Ian Lynagh [Sat, 24 Jun 2006 23:08:00 +0000 (23:08 +0000)]
Be lazier in user config creation, and don't fail on missing configs.

17 years agoZ-Encode external-core output
Jan Rochel [Sun, 2 Jul 2006 21:44:38 +0000 (21:44 +0000)]
Z-Encode external-core output

HEAD doesn't z-encode external-core output (unlike 6.4). I suppose, that
this is unwanted behaviour. It probably results from this patch:

========================================================================
Fri Jan  6 17:30:19 CET 2006  simonmar
  * [project @ 2006-01-06 16:30:17 by simonmar]
  Add support for UTF-8 source files

[...]

Z-encoding has been moved right to the back end.  Previously we
used to Z-encode every identifier on the way in for simplicity,
and only decode when we needed to show something to the user.
Instead, we now keep every string in its UTF-8 encoding, and
Z-encode right before printing it out.

[...]
========================================================================

Greetings
Jan

17 years agoAdd %local-tag to external core output
Jan Rochel [Sun, 2 Jul 2006 20:45:59 +0000 (20:45 +0000)]
Add %local-tag to external core output

Hello, this is my first patch contributed to GHC. If there are any
inadequacies about it (maybe like this introductory disclaimer), please
let me know about it.

So, the need for this patch arose, while I was involved with processing
hcr files (external core output) and I noticed, that the output didn't
fully conform to the specification [1].
No %local-tags were used, which turned out to be a real nuisance as it
was not possible to determine which VDEFs can be erased in a further
optimization process and which ones are exported by the module.

Since the specification does not define the meaning of the %local-tag, I
assume, it makes sense, that it tags all functions, that are not
exported by the module.

The patch does not fully comply to the specification, as in my
implementation a local tag may appear before a VDEF but not before a
VDEFG.

[1] An External Representation for the GHC Core Language
    (DRAFT for GHC5.02), page 3, line 1

Greetings
Jan

17 years agoRemove bashisms from darcs-all
Alec Berryman [Mon, 3 Jul 2006 01:29:11 +0000 (01:29 +0000)]
Remove bashisms from darcs-all

darcs-all may now be run with any POSIX-compatible /bin/sh.

17 years agoFix for warning message (bug #812)
Duncan Coutts [Tue, 4 Jul 2006 16:34:13 +0000 (16:34 +0000)]
Fix for warning message (bug #812)
say "{-# SOURCE #-}" rather than "{- SOURCE -}" in warning message.
Fixes http://hackage.haskell.org/trac/ghc/ticket/812

17 years agoThe dict-bindings in an IPBinds need not be in dependency order
simonpj@microsoft.com [Mon, 3 Jul 2006 15:15:17 +0000 (15:15 +0000)]
The dict-bindings in an IPBinds need not be in dependency order

This appears to be a long-standing bug, discovered by BlueSpec
(ravi@bluespec.com), Trac bug #795

The problem was that in an IP binding group, the dict bindings
aren't necessarily in dependency order; and if they aren't
we get a core-lint error.

Test tc203 checks this case.  (Though whether it shows up at
all depends a bit on accidental factors of binding ordering.)

17 years agox86 needs -fno-unit-at-a-time too
Simon Marlow [Tue, 4 Jul 2006 08:33:08 +0000 (08:33 +0000)]
x86 needs -fno-unit-at-a-time too
Fixes #809

17 years agox86-64: fix a problem exposed by negative offsets in vector tables
Simon Marlow [Thu, 29 Jun 2006 14:06:08 +0000 (14:06 +0000)]
x86-64: fix a problem exposed by negative offsets in vector tables
static relative offsets (eg .long l1-l2) are restricted to 32 bits on
x86-64 due to lack of support in the linker.  The codegen, NCG and
runtime work around this, using 32-bit offsets instead of 64.
However, we were missing a workaround for vector tables, and it
happened to work by accident because the offsets were always positive
and resolved by the assembler.  The bug was exposed by using the NCG
to compile the RTS, where the offsets became negative, again by
accident.

17 years agoNo longer force -fvia-C for the RTS, it can now be compiled with the NCG
Simon Marlow [Thu, 29 Jun 2006 13:58:36 +0000 (13:58 +0000)]
No longer force -fvia-C for the RTS, it can now be compiled with the NCG

17 years agoReplace inline C functions with C-- macros in .cmm code
Simon Marlow [Thu, 29 Jun 2006 13:47:26 +0000 (13:47 +0000)]
Replace inline C functions with C-- macros in .cmm code
So that we can build the RTS with the NCG.

17 years agoremove conditionals from definition of StgRegTable
Simon Marlow [Thu, 29 Jun 2006 13:44:05 +0000 (13:44 +0000)]
remove conditionals from definition of StgRegTable
so that we can calculate deterministic offsets to some of the fields
of Capability.

17 years agompz_foo() functions are really called __gmpz_foo() in GMP
Simon Marlow [Thu, 29 Jun 2006 12:22:17 +0000 (12:22 +0000)]
mpz_foo() functions are really called __gmpz_foo() in GMP
gmp.h #defines mpz_foo to __gmpz_foo, so the real ABI is __gmpz_foo,
so that is what we must invoke in order to be portable here.
Similarly for mpn --> __gmpn.

17 years agouse the new "prim %write_barrier()" in .cmm instead of calls to wb()
Simon Marlow [Thu, 29 Jun 2006 12:05:26 +0000 (12:05 +0000)]
use the new "prim %write_barrier()" in .cmm instead of calls to wb()

17 years agofix some problems with the fixup block code
Simon Marlow [Thu, 29 Jun 2006 12:02:10 +0000 (12:02 +0000)]
fix some problems with the fixup block code
We weren't handling InBoth properly.  InBoth needs to be expanded to
appropriate InReg/InMem locations *before* building the interference
graph, otherwise an InBoth will not be seen to conflict with other
InReg/InMem locations.

17 years agosmall optimisation: eliminate more register-to-register moves
Simon Marlow [Thu, 29 Jun 2006 12:00:29 +0000 (12:00 +0000)]
small optimisation: eliminate more register-to-register moves

17 years agonew syntax: "prim %OP (args)" for using CallishMachOps in .cmm
Simon Marlow [Thu, 29 Jun 2006 11:59:49 +0000 (11:59 +0000)]
new syntax: "prim %OP (args)"  for using CallishMachOps in .cmm

17 years agoadd MO_WriteBarrier to CallishMachOps
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--

17 years agoUse -fno-strict-aliasing for *all* C files in the runtime
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".

17 years agothe unlifted kind
Simon Marlow [Fri, 23 Jun 2006 15:26:26 +0000 (15:26 +0000)]
the unlifted kind

17 years agofix a lint-o
Simon Marlow [Tue, 20 Jun 2006 15:19:01 +0000 (15:19 +0000)]
fix a lint-o

17 years agofix sloppy conditionals
Simon Marlow [Tue, 20 Jun 2006 15:17:58 +0000 (15:17 +0000)]
fix sloppy conditionals

17 years agofix sloppy conditionals
Simon Marlow [Tue, 20 Jun 2006 15:10:39 +0000 (15:10 +0000)]
fix sloppy conditionals

17 years agofix a few sloppy conditionals caught by new test in CmmLint
Simon Marlow [Tue, 20 Jun 2006 15:06:18 +0000 (15:06 +0000)]
fix a few sloppy conditionals caught by new test in CmmLint

17 years agoflattenCgStmts: fix a case of empty code blocks being generated
Simon Marlow [Tue, 20 Jun 2006 15:05:20 +0000 (15:05 +0000)]
flattenCgStmts: fix a case of empty code blocks being generated

17 years agoimprove a panic message
Simon Marlow [Tue, 20 Jun 2006 14:12:19 +0000 (14:12 +0000)]
improve a panic message

17 years agocheck that the argument to CmmCondBranch is really a conditional
Simon Marlow [Tue, 20 Jun 2006 14:12:04 +0000 (14:12 +0000)]
check that the argument to CmmCondBranch is really a conditional

17 years agoGenerate a new unique for each label
Simon Marlow [Tue, 20 Jun 2006 14:01:06 +0000 (14:01 +0000)]
Generate a new unique for each label

17 years agoRemove long-redundant FieldLabel.lhs
simonpj@microsoft.com [Thu, 29 Jun 2006 10:53:21 +0000 (10:53 +0000)]
Remove long-redundant FieldLabel.lhs

17 years agoAdd comments to SpecConstr
simonpj@microsoft.com [Tue, 27 Jun 2006 16:15:20 +0000 (16:15 +0000)]
Add comments to SpecConstr

17 years agofix up slop-overwriting for THUNK_SELECTORS in DEBUG mode
Simon Marlow [Tue, 27 Jun 2006 12:39:51 +0000 (12:39 +0000)]
fix up slop-overwriting for THUNK_SELECTORS in DEBUG mode

17 years agoMake SpecConstr work better for nested functions
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.

17 years agoMore SpecConstr tuning
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.

17 years agoImprove consistency checking for derived instances
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)

17 years agoSlight improvement in TH error reporting
simonpj@microsoft.com [Mon, 26 Jun 2006 09:59:52 +0000 (09:59 +0000)]
Slight improvement in TH error reporting

17 years agoImprove location info when typechecking interface fiels
simonpj@microsoft.com [Wed, 14 Jun 2006 11:48:13 +0000 (11:48 +0000)]
Improve location info when typechecking interface fiels

17 years agoFix a bug in the pretty printing of class declarations
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

17 years agoImprove RULE matching a bit more
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'.

17 years ago--enable-src-tree-haddock and friends are no longer required
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.

17 years agofix a couple of bugs in markSparkQueue (#799)
Simon Marlow [Fri, 23 Jun 2006 09:20:44 +0000 (09:20 +0000)]
fix a couple of bugs in markSparkQueue (#799)

17 years agopull in STABLE(!) tweaks
sof@galois.com [Thu, 22 Jun 2006 20:27:34 +0000 (20:27 +0000)]
pull in STABLE(!) tweaks

17 years agofix for when path to GHC contains spaces, from #695
Simon Marlow [Thu, 22 Jun 2006 13:17:00 +0000 (13:17 +0000)]
fix for when path to GHC contains spaces, from #695

17 years agoComment only
simonpj@microsoft.com [Wed, 21 Jun 2006 22:39:40 +0000 (22:39 +0000)]
Comment only

17 years agoTransfer INLINE to specialised functions
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.

17 years agoArity and eta-expansion tuning
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.

17 years agodocumentation for TH w/ profiling
Simon Marlow [Wed, 21 Jun 2006 11:25:23 +0000 (11:25 +0000)]
documentation for TH w/ profiling

17 years agoAllow Template Haskell to be used with -prof
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