| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
add an INCLUDE pragma, as a compiler-independent alternative to
-#include.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rationalise the BUILD,HOST,TARGET defines.
Recall that:
- build is the platform we're building on
- host is the platform we're running on
- target is the platform we're generating code for
The change is that now we take these definitions as applying from the
point of view of the particular source code being built, rather than
the point of view of the whole build tree.
For example, in RTS and library code, we were previously testing the
TARGET platform. But under the new rule, the platform on which this
code is going to run is the HOST platform. TARGET only makes sense in
the compiler sources.
In practical terms, this means that the values of BUILD, HOST & TARGET
may vary depending on which part of the build tree we are in.
Actual changes:
- new file: includes/ghcplatform.h contains platform defines for
the RTS and library code.
- new file: includes/ghcautoconf.h contains the autoconf settings
only (HAVE_BLAH). This is so that we can get hold of these
settings independently of the platform defines when necessary
(eg. in GHC).
- ghcconfig.h now #includes both ghcplatform.h and ghcautoconf.h.
- MachRegs.h, which is included into both the compiler and the RTS,
now has to cope with the fact that it might need to test either
_TARGET_ or _HOST_ depending on the context.
- the compiler's Makefile now generates
stage{1,2,3}/ghc_boot_platform.h
which contains platform defines for the compiler. These differ
depending on the stage, of course: in stage2, the HOST is the
TARGET of stage1. This was wrong before.
- The compiler doesn't get platform info from Config.hs any more.
Previously it did (sometimes), but unless we want to generate
a new Config.hs for each stage we can't do this.
- GHC now helpfully defines *_{BUILD,HOST}_{OS,ARCH} automatically
in CPP'd Haskell source.
- ghcplatform.h defines *_TARGET_* for backwards compatibility
(ghcplatform.h is included by ghcconfig.h, which is included by
config.h, so code which still #includes config.h will get the TARGET
settings as before).
- The Users's Guide is updated to mention *_HOST_* rather than
*_TARGET_*.
- coding-style.html in the commentary now contains a section on
platform defines. There are further doc updates to come.
Thanks to Wolfgang Thaller for pointing me in the right direction.
|
|
|
|
| |
ignore OPTIONS_anything_else when looking for OPTIONS_GHC/OPTIONS pragmas.
|
|
|
|
| |
Make GHC accept OPTIONS_GHC. OPTIONS is also accepted, for now.
|
|
|
|
|
| |
fix for parsing OPTIONS pragmas: OPTIONS should be followed by a
non-identifier character.
|
|
|
|
|
| |
getOptionsFromSource: fix a bug which caused a file containing just an
OPTIONS pragma to have the pragma ignored.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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!
|
|
|
|
| |
Tiny perf improvement
|
|
|
|
| |
Add an export list; GC dead code.
|
|
|
|
| |
Better error message for ghc --show-iface, with no file supplied
|
|
|
|
|
| |
Use Util.maybePrefixMatch instead of DriverUtil.my_prefix_match, and
remove the latter.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Grrr, started off making a small bugfix and ended up doing a major
cleanup operartion.
Anyway, the problem was that -odir wasn't putting the object files in
the right place when the module in question has a hierarchical name.
This was due to the object filename being generated in two different
places: once by the compilation pipeline machinery, and again in the
Finder. It now works properly when --make is used; I haven't managed
to fix it for one-shot compilations though (some replumbing is
needed).
While I was here, I cleaned up the compilation pipeline machinery
somewhat. The previous scheme of generating a data structure
representing the phases that need to be executed before actually
executing them was wrong because the structure of the pipeline can
change while it is being executed (eg. if we see {-# OPTIONS -fasm #-}
during the CPP phase). There were various hacks to deal with this,
but it turned out to be quite messy.
So the new story is that each compilation phase returns the name of
the next phase to execute, and also figures out which file to put its
output in. This unfortunately means that the knowledge about what
phases are done in what order is now spread throughout the module, but
there are fewer hacks at the higher levels, and overall it seems to be
an improvement.
|
|
|
|
| |
Make it compile again with 5.04.x
|
|
|
|
| |
Fix compilation breakage with GHC 4.08.x.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Finder overhaul.
The finder had got pretty complicated; this commit is mainly a
cleanup, with one new feature:
- the finder has a cache (again). The cache may be flushed by
calling flushFinderCache, which actually only flushes home modules
from the cache, because package modules are assumed not to move.
This change is apropos of some other changes which will result in
the finder being called more often, so we think a cache is going
to be worthwhile.
Also a couple of bugs were fixed:
- the field ml_hi_file in a ModLocation is now *always* the name
of the .hi file. If you need a .hi-boot file, you have to make
it up by changing the suffix of ml_hi_file. (DriverMkDepend and
RnHiFiles do this). This was the cause of a bug, but I can't
remember the details.
- The -odir flag now works in a more reasonable way: hierarchical
modules get put in subdirectories of the -odir directory. eg.
if your module is A.B.C, and -odir D is specified, then the object
will be D/A/B/C.o; previously it would have been D/C.o.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--------------------------------------
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.
|
|
|
|
|
|
|
|
|
|
|
| |
Catch the use of non-existent output directories &
report this back to the user. By not doing this, we relied
on external tools (such as the linker or assembler) to give
good feedback about this error condition -- this wasn't
the case (cf. GAS on mingw/cygwin.)
To insert more sanity checks of the effective options
(to the batch compiler), use Main.checkOptions
|
|
|
|
| |
Escape space characters in filenames in the Makefile generated from ghc -M.
|
|
|
|
|
|
| |
Don't use RegexString to parse OPTIONS pragmas, instead do the
matching by hand, thereby removing a dependency on RegexString (and
hence Regex).
|
|
|
|
|
| |
Strip whitespace from the beginning of the line when looking for
OPTIONS pragmas.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Robustified handling of paths, allowing both / and \ to be recognised
as path separators under Win32 -- ghc-5.02-win32 has a bug where
it will barf when invoked as follows:
c:\dot\net> ghc -c c:\dot\net\foo.hs -odir c:\dot\net\output
i.e., a DOS-style input filename together with the use of -odir. (5.02
constructs an illegal path for the -o argument to the assembler).
Branch mergers: go wild
|
|
|
|
| |
add newline to "WARNING: error while reading directory" message.
|
|
|
|
| |
Handle leading underscores for PrelMain undefineds
|
|
|
|
| |
Close file after reading OPTIONS pragma
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
----------------------
Installation packaging
----------------------
GHC runs various system programs like
cp, touch
gcc, as, ld etc
On Windows we plan to deliver these programs along with GHC,
so we have to be careful about where to find them.
This commit isolates all these dependencies in a single module
main/SysTools.lhs
Most of the #ifdefery for mingw has moved into this module.
There's some documentation in SysTools.lhs
Along the way I did lots of other cleanups. In particular
* There is no more 'globbing' needed when calling runSomething
* All file removal goes via the standard Directory.removeFile
* TmpFiles.hs has gone; absorbed into SysTools
* Some DynFlag stuff has moved from DriverFlags to CmdLineOpts
Still to do:
** I'm a bit concerned that calling removeFile one at a time
when deleting masses of split-object files is going to be
rather slow
** GHC now expects to find split,mangle,unlit in
libdir/extra-bin
instead of just
libdir
So something needs to change in the Unix installation scripts
** The "ineffective C preprocessor" is a perversion and should die
|
|
|
|
| |
Don't panic on ExitException.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Misc minor changes to integrate GHC a little bit better on Win32 platforms.
Specifically, the commit does the following (assuming you've configured
fptools/ with the option --enable-minimal-unix-deps on a mingw platform):
* when GHC uses System.system, it expects an MSDOS command processor to
interpret the command. This implies that 'normal' UNIX shell utils will
no longer be used, but substituted with MSDOS equivalents.
* the GHC backend relies on gcc and perl to handle .s/.hc/.o/.a files. GHC
will now assume that these all live in one 'tool directory', making it
easier to bundle these backend tools with GHC.
The upshot of these changes is that it is now possible for the user not to
have to install cygwin prior to installing GHC (as the upcoming ghc-win32
binary release will prove).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add
DriverPhases.haskellish_src_suffix :: String -> Bool
DriverPhases.haskellish_src_file :: String -> Bool
which return True for suffixes of Haskell source files only. The
existing haskellish_suffix and haskellish_file return True also for
.raw_s and .hc files.
We use these instead of haskellish_file in Main.main when deciding
whether to preprocess a file.
Fixes: compilation of .raw_s files, and potential bugs with
compilation of .hc files.
|
|
|
|
|
| |
Don't fail during dependency generation if one of the search paths
doesn't exist.
|
|
|
|
| |
rearrange slightly to make this compile again.
|
|
|
|
| |
Import v_TmpDir.
|
|
|
|
| |
Use TMPDIR, not /tmp.
|
|
|
|
| |
Allow multiple OPTIONS pragmas for GreenCard's benefit.
|
|
|
|
|
| |
Clean up the error handling a bit; the exception type is moved to
Panic, and a new exception for panics has been added.
|
|
|
|
|
|
| |
Treat an unhandled exception in the same way as a panic (i.e. the
`impossible' happened), to make it clear that these really are
compiler bugs.
|
|
|
|
| |
Remove circular dependencies created by kludgedSystem.
|
|
|
|
| |
Use kludgedSystem instead of system to work sanely (AFATIP) on Windows.
|
|
|
|
|
|
| |
Allow the root of the module tree to have a filename which is
different from its module name. The argument to cmLoadModule is now a
filename.
|
|
|
|
| |
fix bogus implementation of splitFilename3 (!!!)
|
|
|
|
|
|
|
| |
Cleanup sweep.
Includes code to get -H working again, #ifdefed out for the time being
since it needs support in the RTS.
|
|
|
|
|
|
|
| |
Facilitate handling the situation where name of module /= name of file.
This is handled in CompManager.summarise, which can inspect the source
to see what the _real_ module name is, and act accordingly.
All a bit messy -- needs a rethink.
|
|
|
|
| |
Current state of the interactive system; can load packages (in theory).
|
|
|
|
|
| |
cleanups; print the full version number of the building compiler
(inc. the patchlevel) in verbose mode.
|
|
|
|
| |
Half-way through versioning so it will compile, sans interpreter, with 4.08.1
|
|
|
|
|
| |
Compile everything up to Main. The Really Entertaining News (tm) is that
there are still modules beyond Main to fix up :-)
|
|
|
|
| |
all compiles now; not quite hooked up to hscMain yet though.
|