| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Most of the other users of the fptools build system have migrated to
Cabal, and with the move to darcs we can now flatten the source tree
without losing history, so here goes.
The main change is that the ghc/ subdir is gone, and most of what it
contained is now at the top level. The build system now makes no
pretense at being multi-project, it is just the GHC build system.
No doubt this will break many things, and there will be a period of
instability while we fix the dependencies. A straightforward build
should work, but I haven't yet fixed binary/source distributions.
Changes to the Building Guide will follow, too.
|
|
|
|
|
|
|
|
| |
I've removed -fno-code from Main to make it work
equally well with --make and -c.
I've also allowed it not to write hi files unless
-fwrite-iface is given.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
I've removed -fno-code from Main to make it work
equally well with --make and -c.
I've also allowed it not to write hi files unless
-fwrite-iface is given.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add -stubdir option to control location of generated stub files. Also
do some clean up while I'm here - remove hscStubCOut/hscStubHOut from
DynFlags, and add
mkStubPaths :: DynFlags -> Module -> ModLocation -> (FilePath,FilePath)
to Finder. (this seemed better than caching the stub paths in every
ModLocation, because they are rarely needed and only present in home
modules, and are easily calculated from other available information).
-stubdir behaves in exactly the same way as -odir and -hidir.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Two changes from Krasimir Angelov, which were required for Visual
Haskell:
- messaging cleanup throughout the compiler. DynFlags has a new
field:
log_action :: Severity -> SrcSpan -> PprStyle -> Message -> IO ()
this action is invoked for every message generated by the
compiler. This means a client of the GHC API can direct messages to
any destination, or collect them up in an IORef for later
perusal.
This replaces previous hacks to redirect messages in the GHC API
(hence some changes to function types in GHC.hs).
- The JustTypecheck mode of GHC now does what it says. It doesn't
run any of the compiler passes beyond the typechecker for each module,
but does generate the ModIface in order that further modules can be
typechecked.
And one change from me:
- implement the LANGUAGE pragma, finally
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
WARNING: this is a big commit. You might want
to wait a few days before updating, in case I've
broken something.
However, if any of the changes are what you wanted,
please check it out and test!
This commit does three main things:
1. A re-organisation of the way that GHC handles bindings in HsSyn.
This has been a bit of a mess for quite a while. The key new
types are
-- Bindings for a let or where clause
data HsLocalBinds id
= HsValBinds (HsValBinds id)
| HsIPBinds (HsIPBinds id)
| EmptyLocalBinds
-- Value bindings (not implicit parameters)
data HsValBinds id
= ValBindsIn -- Before typechecking
(LHsBinds id) [LSig id] -- Not dependency analysed
-- Recursive by default
| ValBindsOut -- After typechecking
[(RecFlag, LHsBinds id)]-- Dependency analysed
2. Implement Mark Jones's idea of increasing polymoprhism
by using type signatures to cut the strongly-connected components
of a recursive group. As a consequence, GHC no longer insists
on the contexts of the type signatures of a recursive group
being identical.
This drove a significant change: the renamer no longer does dependency
analysis. Instead, it attaches a free-variable set to each binding,
so that the type checker can do the dep anal. Reason: the typechecker
needs to do *two* analyses:
one to find the true mutually-recursive groups
(which we need so we can build the right CoreSyn)
one to find the groups in which to typecheck, taking
account of type signatures
3. Implement non-ground SPECIALISE pragmas, as promised, and as
requested by Remi and Ross. Certainly, this should fix the
current problem with GHC, namely that if you have
g :: Eq a => a -> b -> b
then you can now specialise thus
SPECIALISE g :: Int -> b -> b
(This didn't use to work.)
However, it goes further than that. For example:
f :: (Eq a, Ix b) => a -> b -> b
then you can make a partial specialisation
SPECIALISE f :: (Eq a) => a -> Int -> Int
In principle, you can specialise f to *any* type that is
"less polymorphic" (in the sense of subsumption) than f's
actual type. Such as
SPECIALISE f :: Eq a => [a] -> Int -> Int
But I haven't tested that.
I implemented this by doing the specialisation in the typechecker
and desugarer, rather than leaving around the strange SpecPragmaIds,
for the specialiser to find. Indeed, SpecPragmaIds have vanished
altogether (hooray).
Pragmas in general are handled more tidily. There's a new
data type HsBinds.Prag, which lives in an AbsBinds, and carries
pragma info from the typechecker to the desugarer.
Smaller things
- The loop in the renamer goes via RnExpr, instead of RnSource.
(That makes it more like the type checker.)
- I fixed the thing that was causing 'check_tc' warnings to be
emitted.
|
|
|
|
|
|
|
|
|
| |
Re-plumb the connections between TidyPgm and the various
code generators. There's a new type, CgGuts, to mediate this,
which has the happy effect that ModGuts can die earlier.
The non-O route still isn't quite right, because default methods
are being lost. I'm working on it.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Complete the transition of -split-objs into a dynamic flag (looks like I
half-finished it in the last commit).
Also: complete the transition of -tmpdir into a dynamic flag, which
involves some rearrangement of code from SysTools into DynFlags.
Someday, initSysTools should move wholesale into initDynFlags, because
most of the state that it initialises is now part of the DynFlags
structure, and the rest could be moved in easily.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Flags cleanup.
Basically the purpose of this commit is to move more of the compiler's
global state into DynFlags, which is moving in the direction we need
to go for the GHC API which can have multiple active sessions
supported by a single GHC instance.
Before:
$ grep 'global_var' */*hs | wc -l
78
After:
$ grep 'global_var' */*hs | wc -l
27
Well, it's an improvement. Most of what's left won't really affect
our ability to host multiple sessions.
Lots of static flags have become dynamic flags (yay!). Notably lots
of flags that we used to think of as "driver" flags, like -I and -L,
are now dynamic. The most notable static flags left behind are the
"way" flags, eg. -prof. It would be nice to fix this, but it isn't
urgent.
On the way, lots of cleanup has happened. Everything related to
static and dynamic flags lives in StaticFlags and DynFlags
respectively, and they share a common command-line parser library in
CmdLineParser. The flags related to modes (--makde, --interactive
etc.) are now private to the front end: in fact private to Main
itself, for now.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-----------------------------------------
Fix a long-standing indirection-zapping bug
-----------------------------------------
Merge to STABLE
Up to now we zap indirections as part of the occurence analyser.
But this is bogus. The indirection zapper does the following:
x_local = <expression>
...bindings...
x_exported = x_local
where x_exported is exported, and x_local is not, then we
replace it with this:
x_exported = <expression>
x_local = x_exported
...bindings...
But this is plain wrong if x_exported has a RULE that mentions
something (f, say) in ...bindings.., because 'f' will then die.
After hacking a few solutions, I've eventually simply made the indirection
zapping into a separate pass (which is cleaner anyway), which wraps the
entire program back into a single Rec if the bad thing can happen.
On the way I've made indirection-zapping work in Recs too, which wasn't the
case before.
* Move the zapper from OccurAnal into SimplCore
* Tidy up the printing of pragmas (PprCore and friends)
* Add a new function Rules.addRules
* Merge rules in the indirection zapper (previously one set was discarded)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--------------------------------------------
Replace hi-boot files with hs-boot files
--------------------------------------------
This major commit completely re-organises the way that recursive modules
are dealt with.
* It should have NO EFFECT if you do not use recursive modules
* It is a BREAKING CHANGE if you do
====== Warning: .hi-file format has changed, so if you are
====== updating into an existing HEAD build, you'll
====== need to make clean and re-make
The details: [documentation still to be done]
* Recursive loops are now broken with Foo.hs-boot (or Foo.lhs-boot),
not Foo.hi-boot
* An hs-boot files is a proper source file. It is compiled just like
a regular Haskell source file:
ghc Foo.hs generates Foo.hi, Foo.o
ghc Foo.hs-boot generates Foo.hi-boot, Foo.o-boot
* hs-boot files are precisely a subset of Haskell. In particular:
- they have the same import, export, and scoping rules
- errors (such as kind errors) in hs-boot files are checked
You do *not* need to mention the "original" name of something in
an hs-boot file, any more than you do in any other Haskell module.
* The Foo.hi-boot file generated by compiling Foo.hs-boot is a machine-
generated interface file, in precisely the same format as Foo.hi
* When compiling Foo.hs, its exports are checked for compatibility with
Foo.hi-boot (previously generated by compiling Foo.hs-boot)
* The dependency analyser (ghc -M) knows about Foo.hs-boot files, and
generates appropriate dependencies. For regular source files it
generates
Foo.o : Foo.hs
Foo.o : Baz.hi -- Foo.hs imports Baz
Foo.o : Bog.hi-boot -- Foo.hs source-imports Bog
For a hs-boot file it generates similar dependencies
Bog.o-boot : Bog.hs-boot
Bog.o-boot : Nib.hi -- Bog.hs-boto imports Nib
* ghc -M is also enhanced to use the compilation manager dependency
chasing, so that
ghc -M Main
will usually do the job. No need to enumerate all the source files.
* The -c flag is no longer a "compiler mode". It simply means "omit the
link step", and synonymous with -no-link.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
------------------------
Reorganisation of hi-boot files
------------------------
The main point of this commit is to arrange that in the Compilation
Manager's dependendency graph, hi-boot files are proper nodes. This
is important to make sure that we compile everything in the right
order. It's a step towards hs-boot files.
* The fundamental change is that CompManager.ModSummary has a new
field, ms_boot :: IsBootInterface
I also tided up CompManager a bit. No change to the Basic Plan.
ModSummary is now exported abstractly from CompManager (was concrete)
* Hi-boot files now have import declarations. The idea is they are
compulsory, so that the dependency analyser can find them
* I changed an invariant: the Compilation Manager used to ensure that
hscMain was given a HomePackageTable only for the modules 'below' the
one being compiled. This was really only important for instances and
rules, and it was a bit inconvenient. So I moved the filter to the
compiler itself: see HscTypes.hptInstances and hptRules.
* Module Packages.hs now defines
data PackageIdH
= HomePackage -- The "home" package is the package
-- curently being compiled
| ExtPackage PackageId -- An "external" package is any other package
It was just a Maybe type before, so this makes it a bit clearer.
* I tried to add a bit better location info to the IfM monad, so that
errors in interfaces come with a slightly more helpful error message.
See the if_loc field in TcRnTypes --- and follow-on consequences
* Changed Either to Maybes.MaybeErr in a couple of places (more perspicuous)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Further integration with the new package story. GHC now supports
pretty much everything in the package proposal.
- GHC now works in terms of PackageIds (<pkg>-<version>) rather than
just package names. You can still specify package names without
versions on the command line, as long as the name is unambiguous.
- GHC understands hidden/exposed modules in a package, and will refuse
to import a hidden module. Also, the hidden/eposed status of packages
is taken into account.
- I had to remove the old package syntax from ghc-pkg, backwards
compatibility isn't really practical.
- All the package.conf.in files have been rewritten in the new syntax,
and contain a complete list of modules in the package. I've set all
the versions to 1.0 for now - please check your package(s) and fix the
version number & other info appropriately.
- New options:
-hide-package P sets the expose flag on package P to False
-ignore-package P unregisters P for this compilation
For comparison, -package P sets the expose flag on package P
to True, and also causes P to be linked in eagerly.
-package-name is no longer officially supported. Unofficially, it's
a synonym for -ignore-package, which has more or less the same effect
as -package-name used to.
Note that a package may be hidden and yet still be linked into
the program, by virtue of being a dependency of some other package.
To completely remove a package from the compiler's internal database,
use -ignore-package.
The compiler will complain if any two packages in the
transitive closure of exposed packages contain the same
module.
You *must* use -ignore-package P when compiling modules for
package P, if package P (or an older version of P) is already
registered. The compiler will helpfully complain if you don't.
The fptools build system does this.
- Note: the Cabal library won't work yet. It still thinks GHC uses
the old package config syntax.
Internal changes/cleanups:
- The ModuleName type has gone away. Modules are now just (a
newtype of) FastStrings, and don't contain any package information.
All the package-related knowledge is in DynFlags, which is passed
down to where it is needed.
- DynFlags manipulation has been cleaned up somewhat: there are no
global variables holding DynFlags any more, instead the DynFlags
are passed around properly.
- There are a few less global variables in GHC. Lots more are
scheduled for removal.
- -i is now a dynamic flag, as are all the package-related flags (but
using them in {-# OPTIONS #-} is Officially Not Recommended).
- make -j now appears to work under fptools/libraries/. Probably
wouldn't take much to get it working for a whole build.
|
|
|
|
| |
Compiler changes for the new package.conf format.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Improved #include path handling:
* Don't use '-I-', it breaks a lot of system headers, e.g.
#include <GL/glut.h>
fails (when using freeglut), because /usr/include/GL/glut.h contains
#include "freeglut_std.h"
but /usr/include/GL/freeglut_std.h will not be found. It is a bit
debatable if the header is broken and should use
#include "GL/freeglut_std.h"
instead. Anyway, a grep through the SuSE 9.1 system headers shows that
there seems to be no real common practice, so let's play safe and don't
use '-I-'.
* Don't use '-I .', #include stub headers "locally" instead, e.g. use
#include "Concurrent_stub.h"
instead of
#include "Control/Concurrent_stub.h"
Note that "Control" is still in the #include path, because the *.hc file
is normally in /tmp and the stub header is in the directory where *.hs
is. We could remove this path element, too, if the stub header would be
copied to the directory of the *.hc file during compilation. SimonM?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
------------------------------------
Add Generalised Algebraic Data Types
------------------------------------
This rather big commit adds support for GADTs. For example,
data Term a where
Lit :: Int -> Term Int
App :: Term (a->b) -> Term a -> Term b
If :: Term Bool -> Term a -> Term a
..etc..
eval :: Term a -> a
eval (Lit i) = i
eval (App a b) = eval a (eval b)
eval (If p q r) | eval p = eval q
| otherwise = eval r
Lots and lots of of related changes throughout the compiler to make
this fit nicely.
One important change, only loosely related to GADTs, is that skolem
constants in the typechecker are genuinely immutable and constant, so
we often get better error messages from the type checker. See
TcType.TcTyVarDetails.
There's a new module types/Unify.lhs, which has purely-functional
unification and matching for Type. This is used both in the typechecker
(for type refinement of GADTs) and in Core Lint (also for type refinement).
|
|
|
|
| |
Merge backend-hacking-branch onto HEAD. Yay!
|
|
|
|
| |
Oops. Should import Directory instead of System.Directory.
|
|
|
|
|
|
| |
Changed outputForeignStubs to check whether stub files from a previous
compilation still exist (in the case where no new stubs exist). This is
necessary to compile External Core programs that require these stubs.
|
|
|
|
| |
Remove duplicate #includes arising from foreign import decls
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A round of space-leak fixing.
- re-instate zapping of the PersistentCompilerState at various
points during the compilation cycle in HscMain. This affects
one-shot compilation only, since in this mode the information
collected in the PCS is not required after creating the final
interface file.
- Unravel the recursive dependency between MkIface and
CoreTidy/CoreToStg. Previously the CafInfo for each binding was
calculated by CoreToStg, and fed back into the IdInfo of the Ids
generated by CoreTidy (an earlier pass). MkIface then took this
IdInfo and the bindings from CoreTidy to generate the interface;
but it couldn't do this until *after* CoreToStg, because the CafInfo
hadn't been calculated yet. The result was that the CoreTidy
output lived until after CoreToStg, and at the same time as the
CorePrep and STG syntax, which is wasted space, not to mention
the complexity and general ugliness in HscMain.
So now we calculate CafInfo directly in CoreTidy. The downside is
that we have to predict what CorePrep is going to do to the
bindings so we can tell what will turn into a CAF later, but it's
no worse than before (it turned out that we were doing this
prediction before in CoreToStg anyhow).
- The typechecker lazilly typechecks unfoldings. It turns out that
this is a good idea from a performance perspective, but it also
means that it must hang on to all the information it needs to
do the typechecking. Previously this meant holding on to the
whole of the typechecker's environment, which includes all sorts
of stuff which isn't necessary to typecheck unfoldings. By paring
down the environment captured by the lazy unfoldings, we can
save quite a bit of space in the phases after typechecking.
|
|
|
|
| |
Eliminate brain-dead outputC pattern-match failure
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add the #includes from the rts package to the stub .c file.
Prior to rev. 1.42, we used to add all the #includes from all enabled
packages, together with any -#include options from the command-line.
But since this is auto-generated code and we know exactly which
#includes are required, this was overkill.
In rev. 1.42, all #includes except RtsAPI.h were removed from the stub
.c file. This was incorrect, because the stub file refers to some
entities defined in other RTS header files (the StgStablePtr type, and
deRefStablePtr() for example).
This change adds the header files from the rts package to the stub .c
file, fixing some recent test breakages.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
"Auto" packages.
The big change here is that it is no longer necessary to explicitly
say '-package X' on the command line if X is a package containing
hierarchical Haskell modules. All packages marked "auto" contribute
to the import path, so their modules are always available. At link
time, the compiler knows which packages are actually used by the
program, and it links in only those libraries needed.
There's one exception: one-shot linking. If you link a program using
ghc -o prog A.o B.o ...
then you need to explicitly add -package flags for each package
required (except base & haskell98) because the compiler has no
information about the package dependencies in this case.
Package configs have a new field: auto, which is either True or False.
Non-auto packages must be mentioned on the command-line as usual.
Non-auto packages are still required for:
- non-hierarchical libraries (to avoid polluting the module namespace)
- packages with no Haskell content
- if you want more than one version of a package, or packages
providing overlapping functionality where the user must decide
which one to use.
Doc changes to follow...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--------------------------------------
Make Template Haskell into the HEAD
--------------------------------------
This massive commit transfers to the HEAD all the stuff that
Simon and Tim have been doing on Template Haskell. The
meta-haskell-branch is no more!
WARNING: make sure that you
* Update your links if you are using link trees.
Some modules have been added, some have gone away.
* Do 'make clean' in all library trees.
The interface file format has changed, and you can
get strange panics (sadly) if GHC tries to read old interface files:
e.g. ghc-5.05: panic! (the `impossible' happened, GHC version 5.05):
Binary.get(TyClDecl): ForeignType
* You need to recompile the rts too; Linker.c has changed
However the libraries are almost unaltered; just a tiny change in
Base, and to the exports in Prelude.
NOTE: so far as TH itself is concerned, expression splices work
fine, but declaration splices are not complete.
---------------
The main change
---------------
The main structural change: renaming and typechecking have to be
interleaved, because we can't rename stuff after a declaration splice
until after we've typechecked the stuff before (and the splice
itself).
* Combine the renamer and typecheker monads into one
(TcRnMonad, TcRnTypes)
These two replace TcMonad and RnMonad
* Give them a single 'driver' (TcRnDriver). This driver
replaces TcModule.lhs and Rename.lhs
* The haskell-src library package has a module
Language/Haskell/THSyntax
which defines the Haskell data type seen by the TH programmer.
* New modules:
hsSyn/Convert.hs converts THSyntax -> HsSyn
deSugar/DsMeta.hs converts HsSyn -> THSyntax
* New module typecheck/TcSplice type-checks Template Haskell splices.
-------------
Linking stuff
-------------
* ByteCodeLink has been split into
ByteCodeLink (which links)
ByteCodeAsm (which assembles)
* New module ghci/ObjLink is the object-code linker.
* compMan/CmLink is removed entirely (was out of place)
Ditto CmTypes (which was tiny)
* Linker.c initialises the linker when it is first used (no need to call
initLinker any more). Template Haskell makes it harder to know when
and whether to initialise the linker.
-------------------------------------
Gathering the LIE in the type checker
-------------------------------------
* Instead of explicitly gathering constraints in the LIE
tcExpr :: RenamedExpr -> TcM (TypecheckedExpr, LIE)
we now dump the constraints into a mutable varabiable carried
by the monad, so we get
tcExpr :: RenamedExpr -> TcM TypecheckedExpr
Much less clutter in the code, and more efficient too.
(Originally suggested by Mark Shields.)
-----------------
Remove "SysNames"
-----------------
Because the renamer and the type checker were entirely separate,
we had to carry some rather tiresome implicit binders (or "SysNames")
along inside some of the HsDecl data structures. They were both
tiresome and fragile.
Now that the typechecker and renamer are more intimately coupled,
we can eliminate SysNames (well, mostly... default methods still
carry something similar).
-------------
Clean up HsPat
-------------
One big clean up is this: instead of having two HsPat types (InPat and
OutPat), they are now combined into one. This is more consistent with
the way that HsExpr etc is handled; there are some 'Out' constructors
for the type checker output.
So:
HsPat.InPat --> HsPat.Pat
HsPat.OutPat --> HsPat.Pat
No 'pat' type parameter in HsExpr, HsBinds, etc
Constructor patterns are nicer now: they use
HsPat.HsConDetails
for the three cases of constructor patterns:
prefix, infix, and record-bindings
The *same* data type HsConDetails is used in the type
declaration of the data type (HsDecls.TyData)
Lots of associated clean-up operations here and there. Less code.
Everything is wonderful.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Housekeeping:
- The main goal is to remove dependencies on hslibs for a
bootstrapped compiler, leaving only a requirement that the
packages base, haskell98 and readline are built in stage 1 in
order to bootstrap. We're almost there: Posix is still required
for signal handling, but all other dependencies on hslibs are now
gone.
Uses of Addr and ByteArray/MutableByteArray array are all gone
from the compiler. PrimPacked defines the Ptr type for GHC 4.08
(which didn't have it), and it defines simple BA and MBA types to
replace uses of ByteArray and MutableByteArray respectively.
- Clean up import lists. HsVersions.h now defines macros for some
modules which have moved between GHC versions. eg. one now
imports 'GLAEXTS' to get at unboxed types and primops in the
compiler.
Many import lists have been sorted as per the recommendations in
the new style guidelines in the commentary.
I've built the compiler with GHC 4.08.2, 5.00.2, 5.02.3, 5.04 and
itself, and everything still works here. Doubtless I've got something
wrong, though.
|
|
|
|
| |
An I/O error while opening/writing the output file is *not* a panic.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make foreign export dynamic work in GHCi. Main changes:
* Allow literal labels to propagate through the bytecode generator
and eventually be linked by the runtime linker.
* Minor mods to driver plumbing so that GHCi produces the relevant
*_stub.[ch] files, compiles them with gcc, and loads the resulting .o's
* Dereference the stable pointer in the generated C stub, rather
than passing it to a Haskell-world helper. This seems simpler and
removes the need to have a H-world helper, which in turn means the
stub .o doesn't refer to any H-world entities. This is important
because our linker can't deal with mutual recursion between
BCOs and loaded objects.
Still ToDo:
* Make it thread/GC safe. (Sigbjorn?)
* Get rid of the bits of code in DsForeign which generate the
Haskell helper. I had a go but it wasn't obvious how to do it,
so have deferred.
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Make compilation of javaGen conditional on $(GhcWithJavaGen) in the
same way as the ILX and native backends.
|
|
|
|
| |
Add C++ extern "C" wrappers to generated stubs.
|
|
|
|
| |
Append final newline to _stub.{c,h} output
|
|
|
|
| |
Various changes for ILX backend and type-passing compilers, code reviewed by SimonPJ
|
|
|
|
|
| |
better "#define IN_STG_CODE 0" before including the standard HC header
in a foreign export dynamic stub, because this isn't really HC code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Simplify the foreign-export stub processing.
- DynFlags now has fields for the stub.h and stub.c filenames, for
consistency with the normal hsc output file name.
- codeOutput puts the stubs into these files rather than dreaming
up new temporary names for them
- now we don't have to move the stubs into the right place in
DriverPipeline.
- we do however have to inject the correct #includes into the stub.c
file when it is generated: I'm now injecting the same includes as
the .hc file gets plus "RtsAPI.h", which is probably more correct
than the hacky hardcoded "Stg.h" we had before.
|
|
|
|
| |
don't forget to inject a #include for the stub.h file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Changes to support bootstrapping the compiler from .hc files. It's
not quite working yet, but it's not far off.
- the biggest change is that any injected #includes are now placed in
the .hc file at generation time, rather than compilation time. I
can't see any reason not to do this - it makes it clear by looking at
the .hc file which files are being #included, it means one less
temporary file at compilation time, and it means the .hc file is more
standalone.
- all the gruesomeness is in mk/bootstrap.mk, which handles building
.hc files without a ghc driver.
|
|
|
|
| |
Remove debug print
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
----------------
Nuke ClassContext
----------------
This commit tidies up a long-standing inconsistency in GHC.
The context of a class or instance decl used to be restricted
to predicates of the form
C t1 .. tn
with
type ClassContext = [(Class,[Type])]
but everywhere else in the compiler we used
type ThetaType = [PredType]
where PredType can be any sort of constraint (= predicate).
The inconsistency actually led to a crash, when compiling
class (?x::Int) => C a where {}
I've tidied all this up by nuking ClassContext altogether, and using
PredType throughout. Lots of modified files, but all in
more-or-less trivial ways.
I've also added a check that the context of a class or instance
decl doesn't include a non-inheritable predicate like (?x::Int).
Other things
* rename constructor 'Class' from type TypeRep.Pred to 'ClassP'
(makes it easier to grep for)
* rename constructor HsPClass => HsClassP
HsPIParam => HsIParam
|
|
|
|
| |
Fix overenthusiatic import GCing, I presume.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
----------------
First cut at ILX
----------------
This commit puts the ILX .NET code generator into the head.
It's entirely untested, mind you.
Some changes to the Module/Package strutures, mainly of a
naming variety. In particular:
Package ===> PackageConfig
|
|
|
|
|
|
| |
Add ILX support (all #ifdefed on ILX for now) and tidied up some
indentation. We now support --mk-dll, so remove the comment about adding
that.
|
|
|
|
| |
_scc_'s for the NCG
|
|
|
|
| |
Unused imports and suchlike
|
|
|
|
| |
Return the correct file name for .stub_[ch] files.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1. Outputable.PprStyle now carries a bit more information
In particular, the printing style tells whether to print
a name in unqualified form. This used to be embedded in
a Name, but since Names now outlive a single compilation unit,
that's no longer appropriate.
So now the print-unqualified predicate is passed in the printing
style, not embedded in the Name.
2. I tidied up HscMain a little. Many of the showPass messages
have migraged into the repective pass drivers
|
|
|
|
|
|
| |
This commit completes the merge of compiler part
of the HEAD with the before-ghci-branch to
before-ghci-branch-merged.
|
|
|
|
| |
More small changes
|