| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
| |
Exception => Control.Exception
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
Fix braino in previous commit
MERGE TO STABLE
|
|
|
|
|
|
|
|
|
| |
- If the same module is defined in multiple "root" source files, then
complain. Before, the compiler would silently ignore one of them.
- Remove some unuseed imports
MERGE TO STABLE
|
|
|
|
|
|
|
|
|
|
|
| |
Fix a bug in the cleaning up of temporary files: we were wrongly
cleaning the temporary pre-processed source files for stable modules,
with the result that the compiler would panic the next time they were
required.
Reported ages ago by: Hal Duame.
MERGE TO STABLE
|
|
|
|
|
|
|
|
|
|
| |
Back off from including the interface file version in the module init
label - we might not recompile modules which depend on the current
one, even if its version changes. Thanks to Sigbjorn for pointing
this out.
We still include the way, however, so we'll still catch cases of
linking modules compiled in different ways.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implement a primitive failsafe mechanism for protecting against
linking inconsistent object files. The idea is that if object files
which were compiled in the wrong order (non-dependency order) or
compiled in different ways (eg. profiled vs. non-profiled) are linked
together, a link error will result.
This is achieved by adding the module version and the way to the
module init label. For example, previously the init label for a
module Foo was named
__stginit_Foo
now it is named
__stginit_Foo_<version>_<way>
where <version> is the module version of Foo (same as the version in
the interface file), and <way> is the current way (or empty).
We also have to have a way to refer to the old plain init label, for
using as the argument to shutdownHaskell() in a program using foreign
exports. So the old label now points to a jump instruction which
transfers control to the new init code.
|
|
|
|
| |
summarise{File}: filter out GHC.Prim from import lists
|
|
|
|
|
|
|
|
|
|
|
| |
downsweep.getSummary: keep track of the module a particular ModuleName
stems from, so that we can emit a better error message should the
module be out of scope - e.g.,
sna$ ghc --make -iutil Foo.hs
ghc.exe: chasing modules from: Foo.hs
ghc.exe: can't find module `Xyzz' (while processing "util/Bar.hs")
sna$
|
|
|
|
| |
mapM ~> mapM_
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- When converting ModuleNames to Modules for use in the the module
initialisation code, look them up in the IfaceTable(s) instead of
calling findModule again. They are guaranteed to be in either
the HomeIfaceTable or the PackageIfaceTable after the renamer,
so this saves some trips to the filesystem. Also, move this
code earlier in the compilation cycle to avoid holding on to the
renamed syntax for too long (not sure if this makes a difference or
not, but it definitely looked space-leakish before).
- remove Util.unJust, it is a duplicate of Maybes.expectJust
|
|
|
|
| |
Friday afternoon pet peeve removal: define (Util.notNull :: [a] -> Bool) and use it
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sigh, recompilation checking in --make mdoe has been badly broken for
well, probably ever.
The problem is that in GHCi mode there's a restriction on the use of
object files, namely that an object file may only depend on other
up-to-date object files in order to be up-to-date itself, because we
don't have support for linking object code to interpreted code.
Unfortunately we were applying this restriction to --make compilations
too, with the result that far too much recompilation was happening.
MERGE TO STABLE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
------------------------
Change
GlobalName --> ExternalName
LocalName -> InternalName
------------------------
For a long time there's been terminological confusion between
GlobalName vs LocalName (property of a Name)
GlobalId vs LocalId (property of an Id)
I've now changed the terminology for Name to be
ExternalName vs InternalName
I've also added quite a bit of documentation in the Commentary.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Switch over to the new hierarchical libraries
---------------------------------------------
This commit reorganises our libraries to use the new hierarchical
module namespace extension.
The basic story is this:
- fptools/libraries contains the new hierarchical libraries.
Everything in here is "clean", i.e. most deprecated stuff has
been removed.
- fptools/libraries/base is the new base package
(replacing "std") and contains roughly what was previously
in std, lang, and concurrent, minus deprecated stuff.
Things that are *not allowed* in libraries/base include:
Addr, ForeignObj, ByteArray, MutableByteArray,
_casm_, _ccall_, ``'', PrimIO
For ByteArrays and MutableByteArrays we use UArray and
STUArray/IOUArray respectively now.
Modules previously called PrelFoo are now under
fptools/libraries/GHC. eg. PrelBase is now GHC.Base.
- fptools/libraries/haskell98 provides the Haskell 98 std.
libraries (Char, IO, Numeric etc.) as a package. This
package is enabled by default.
- fptools/libraries/network is a rearranged version of
the existing net package (the old package net is still
available; see below).
- Other packages will migrate to fptools/libraries in
due course.
NB. you need to checkout fptools/libraries as well as
fptools/hslibs now. The nightly build scripts will need to be
tweaked.
- fptools/hslibs still contains (almost) the same stuff as before.
Where libraries have moved into the new hierarchy, the hslibs
version contains a "stub" that just re-exports the new version.
The idea is that code will gradually migrate from fptools/hslibs
into fptools/libraries as it gets cleaned up, and in a version or
two we can remove the old packages altogether.
- I've taken the opportunity to make some changes to the build
system, ripping out the old hslibs Makefile stuff from
mk/target.mk; the new package building Makefile code is in
mk/package.mk (auto-included from mk/target.mk).
The main improvement is that packages now register themselves at
make boot time using ghc-pkg, and the monolithic package.conf
in ghc/driver is gone.
I've updated the standard packages but haven't tested win32,
graphics, xlib, object-io, or OpenGL yet. The Makefiles in
these packages may need some further tweaks, and they'll need
pkg.conf.in files added.
- Unfortunately all this rearrangement meant I had to bump the
interface-file version and create a bunch of .hi-boot-6 files :-(
|
|
|
|
|
|
|
|
|
|
|
|
| |
In GHCi, if we are currently using a compiled version of a module and
the user compiles a new version of the module, allow the new version
to be linked in during a :reload. (as suggested by Koen Claessen).
We can't go all the way and allow a newly compiled module to replace
an existing interpreted version, because the version numbers in the
interface file will be out-of-sync with our internal copy of the
interface. To link in a newly compiled version of an interpreted
module, you still have to do :load.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add support for Hugs's :browse (or :b) command. There are two forms:
- :b M (interpreted modules only) shows everything
defined in M - the types of top-level functions,
and definitions of classes and datatypes.
- :b *M shows everything exported from module M.
Available for both compiled and interpreted modules.
The user interface is subject to change, but for now it is consistent
with the new semantics of the :module command.
The implementation is a little tricky, since for a package module we
have to be sure to slurp in all the required declarations first.
|
|
|
|
| |
make it compile when GHCI aint
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Implement an alternative :module syntax so we can play around with it.
- Implement ':show bindings' and ':show modules'
- Fix a bug whereby doing :info on a local binding would cause a panic
(this needs to be merged to STABLE - the change is part of the patch
to HscMain).
- Some cleanups in InteractiveUI.hs
|
|
|
|
|
|
|
|
|
|
| |
Revert to running command-line statements in the context of the
current thread, so that ^C exceptions get delivered to the right
place.
Now that a deadlock generates an exception this is not so bad, but it
would be nice to do it the "right" way so I've left the old code in a
comment for now.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Deadlock is now an exception instead of a return status from
rts_evalIO().
The current behaviour is as follows, and can be changed if necessary:
in the event of a deadlock, the top main thread is taken from the main
thread queue, and if it is blocked on an MVar or an Exception (for
throwTo), then it receives a Deadlock exception. If it is blocked on
a BLACKHOLE, we instead send it the NonTermination exception. Note
that only the main thread gets the exception: it is the responsibility
of the main thread to unblock other threads if necessary.
There's a slight difference in the SMP build: *all* the main threads
get an exception, because clearly none of them may make progress
(compared to the non-SMP situation, where all but the top main thread
are usually blocked).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
First cut at enhancing the facilities for manipulating the scope in
GHCi. The scope now consists of
1. the full top-level scope of zero or more interpreted modules
2. the exports from zero or more modules
3. the temporary bindings
The sets 1 & 2 are manipulated using an extended :m command: eg :m +A
will add module A to either set 1 or two depending on whether A is
interpreted, and :m -A will remove it. The user interface may change,
pending feedback from the punters on the mailing list.
'Prelude' is automatically added to the scope if set 1 is empty and
set 2 doesn't already contain it.
We now cache the GlobalRdrEnv for the current scope between
evaluations in the InteractiveContext, and also the current
PrintUnqualified setting (which also depends on the scope).
Cvs: ----------------------------------------------------------------------
|
|
|
|
|
| |
Some driver cleanups; in particular -fno-code should work in a more
reasonable way (it is now a "mode flag" like -C, -c, --make etc.).
|
|
|
|
| |
oops, unb??rk the export list in the non-GHCI case.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- change the mi_globals field of ModIface to be (Maybe GlobalRdrEnv)
from GlobalRdrEnv. The idea is that modules which we have
compiled from source will have a complete GlobalRdrEnv in this field
containing their top-level environments, whereas modules which we
have loaded from object files (package modules and pre-compiled home
modules) will have Nothing and we'll create a fake GlobalRdrEnv on
demand from the export list.
Previously we used to create the fake env all the time, but this way
highlights the fact that we don't really have a proper GlobalRdrEnv
for these modules (something we'd like to address at some point).
- rename CompManager.cmLoadModule to cmLoadModules and make it take
a DynFlags argument to be consistent with the rest of the
CompManager interface.
- split cmLoadModule into two parts: cmDepAnal which takes a list of
filenames and returns a ModuleGraph, and cmLoadModules which takes
the ModuleGraph and does the rest. This lets the consumer know
whether the dependency analysis step fails before unloading any
existing modules - i.e. if you :reload and a module is missing, you
don't lose the modules that are already loaded (bug reported by
MIchael Weber some time ago).
|
|
|
|
|
|
|
| |
-Wall cleanup:
- move some imports inside #ifdef GHCI
- remove some unused bindings
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Pet peeve removal / code tidyup, replaced various sub-optimal
uses of 'length' with something a bit better, i.e., replaced
the following patterns
* length as `cmpOp` length bs
* length as `cmpOp` val -- incl. uses where val == 1 and val == 0
* {take,drop,splitAt} (length as) bs
* length [ () | pat <- as ]
with uses of misc Util functions.
I'd be surprised if there's a noticeable reduction in running
times as a result of these changes, but every little bit helps.
[ The changes have been tested wrt testsuite/ - I'm seeing a couple
of unexpected breakages coming from CorePrep, but I'm currently
assuming that these are due to other recent changes. ]
- compMan/CompManager.lhs: restored 4.08 compilability + some code
cleanup.
None of these changes are HEADworthy.
|
|
|
|
|
|
|
|
|
|
| |
Run statements typed at the prompt by calling into the RTS to create a
new main thread. This acts as a (not-quite-sealed) sandbox, which
lets us detect deadlock without causing GHCi itself to quit.
Prelude> Concurrent.newEmptyMVar >>= Concurrent.takeMVar
Deadlocked.
Prelude>
|
|
|
|
|
|
| |
Clean tmp files between compilations, rather than all at the end.
This reduces the /tmp clutter if GHC dies messily (current values of
"messily" include segmentation fault and, sadly, heap overflow).
|
|
|
|
| |
emptyPLS: warning removal
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Accept The Truth and disallow loading any home modules which don't
have a source file.
The reason is that the compilation manager can't figure out
dependencies unless it has the source file to browse through -
previously there was a half-hearted attempt to let you get away with
just an object + interface file, but it didn't work in general.
Better just to disallow it altogether.
Note that this applies to --make too.
|
|
|
|
|
|
| |
- have SysTools.FileOption take a prefix that is not to be transformed
(this is to accommodate MS-style cmd-line options of the kind: "/out=foo.obj")
- have users of Finder.mkHomeModuleLocn catch up with recent change to its type.
|
|
|
|
| |
Include fixity info in the output from :info.
|
|
|
|
| |
Compile `cmInfoThing' only for GHCI
|
|
|
|
| |
Implement the :info command for GHCi.
|
|
|
|
|
| |
The compilation manager now continues gracefully (by unloading all the
modules) if the link step fails.
|
|
|
|
|
|
| |
Make dependency generation work a little bit better
(stage1 goes through OK; yet to do a stage2, but
thought I'd commit before I hit the sack).
|
|
|
|
|
| |
oops, only import Exception.block when compiling GHCi (and we know
we're bootstrapping)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Signification cleanup & rewrite of CmLink.
Fixes at least one bug: the PersistentLinkerState could sometimes get
out of step with the RTS's idea of which modules were loaded, leading
to an unloadObj failure when we try to unload the same module twice.
This could happen if a ^C exception is received in the middle of a
:load.
Fixed by keeping the part of the linker's state that must match up
with the RTS's internal state entirely private to CmLink, stored in a
global variable. The operations in CmLink which manipulate this state
are now wrapped by Exception.block, and so are safe from ^C
exceptions.
|
|
|
|
| |
import of hscThing needs to be conditional on GHCi status.
|
|
|
|
|
|
|
|
|
|
|
| |
Add support for Hugs's :info command. Doesn't work yet, but shouldn't
interfere with anything else. Some of the files touched are just to correct
out-of-date comments.
Highlights are:
hscThing: like hscStmt, but just gets info about a single identifier
cmInfoThing: exposes hscThing's functionality to the outside world
|
|
|
|
|
|
|
|
|
| |
ppFilesFromSummaries: to cope with recent driver changes,
only report a file as being preprocessed if it differs from
the source file(name).
Fixes awfully bad breakage when using --make (source files
were being deleted).
|
|
|
|
|
|
|
|
|
| |
Change a '>' to '>=' when comparing the modification times of object &
source files, to match make's behaviour and eliminate some unnecessary
recompiles.
This introduces some potential unsafety, but it was felt that the
benefits in terms of unsurprising behaviour were worth it.
|
|
|
|
|
|
| |
Allow multiple targets to be specified on the command line for ghc
--make and GHCi. Also implement :a command in GHCi (untested and
undocumented so far).
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some tidying up
* Remove CmStaticInfo
- GhciMode moves to HscTypes
- The package stuff moves to new module main/Packages.lhs
[put any package-related stuff in the new module]
* Add Outputable.docToSDoc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
----------------------
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 force a module's {-# SOURCE #-} imports to have object linkables
in order for the current module's object linkable to be considered
valid (fixes some unnecessary recompilation with recursive modules).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
First part of support for hierarchical module names:
- the Finder now searches all possible paths when looking for
a source file or .hi file. I've removed the caching because
now we have to search in subdirectories of each path option,
and it was dubious whether the cache was actually helping.
- the compilation manager now outputs a warning if it can't find
the source for a given module, only the .hi file. Previously
this caused a cryptic error message when we attempted to call
getModificationTime on the non-existent source file.
|
|
|
|
|
|
|
| |
Calculate the correct set of modules to link in the case of upsweep
partial failure.
MERGE INTO 5.00.2
|