| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Except for CgUtils.fixStgRegisters that is used in the NCG and LLVM
backends, and should probably be moved somewhere else.
|
|
|
|
|
|
| |
I've switched to passing DynFlags rather than Platform, as (a) it's
simpler to not have to extract targetPlatform in so many places, and
(b) it may be useful to have DynFlags around in future.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I observed that the [CmmStatics] within CmmData uses the list in a very stylised way.
The first item in the list is almost invariably a CmmDataLabel. Many parts of the
compiler pattern match on this list and fail if this is not true.
This patch makes the invariant explicit by introducing a structured type CmmStatics
that holds the label and the list of remaining [CmmStatic].
There is one wrinkle: the x86 backend sometimes wants to output an alignment directive just
before the label. However, this can be easily fixed up by parameterising the native codegen
over the type of CmmStatics (though the GenCmmTop parameterisation) and using a pair
(Alignment, CmmStatics) there instead.
As a result, I think we will be able to remove CmmAlign and CmmDataLabel from the CmmStatic
data type, thus nuking a lot of code and failing pattern matches. This change will come as part
of my next patch.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously the code generator generated small code fragments labelled
with __stginit_M for each module M, and these performed whatever
initialisation was necessary for that module and recursively invoked
the initialisation functions for imported modules. This appraoch had
drawbacks:
- FFI users had to call hs_add_root() to ensure the correct
initialisation routines were called. This is a non-standard,
and ugly, API.
- unless we were using -split-objs, the __stginit dependencies would
entail linking the whole transitive closure of modules imported,
whether they were actually used or not. In an extreme case (#4387,
#4417), a module from GHC might be imported for use in Template
Haskell or an annotation, and that would force the whole of GHC to
be needlessly linked into the final executable.
So now instead we do our initialisation with C functions marked with
__attribute__((constructor)), which are automatically invoked at
program startup time (or DSO load-time). The C initialisers are
emitted into the stub.c file. This means that every time we compile
with -prof or -hpc, we now get a stub file, but thanks to #3687 that
is now invisible to the user.
There are some refactorings in the RTS (particularly for HPC) to
handle the fact that initialisers now get run earlier than they did
before.
The __stginit symbols are still generated, and the hs_add_root()
function still exists (but does nothing), for backwards compatibility.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changes the new code generator to make use of the Hoopl package
for dataflow analysis. Hoopl is a new boot package, and is maintained
in a separate upstream git repository (as usual, GHC has its own
lagging darcs mirror in http://darcs.haskell.org/packages/hoopl).
During this merge I squashed recent history into one patch. I tried
to rebase, but the history had some internal conflicts of its own
which made rebase extremely confusing, so I gave up. The history I
squashed was:
- Update new codegen to work with latest Hoopl
- Add some notes on new code gen to cmm-notes
- Enable Hoopl lag package.
- Add SPJ note to cmm-notes
- Improve GC calls on new code generator.
Work in this branch was done by:
- Milan Straka <fox@ucw.cz>
- John Dias <dias@cs.tufts.edu>
- David Terei <davidterei@gmail.com>
Edward Z. Yang <ezyang@mit.edu> merged in further changes from GHC HEAD
and fixed a few bugs.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We used to generated things like:
extern StgWordArray (newCAF) __attribute__((aligned (8)));
((void (*)(void *))(W_)&newCAF)((void *)R1.w);
(which is to say, pretend that newCAF is some data, then cast it to a
function and call it).
This goes wrong on at least IA64, where:
A function pointer on the ia64 does not point to the first byte of
code. Intsead, it points to a structure that describes the function.
The first quadword in the structure is the address of the first byte
of code
so we end up dereferencing function pointers one time too many, and
segfaulting.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This merge does not turn on the new codegen (which only compiles
a select few programs at this point),
but it does introduce some changes to the old code generator.
The high bits:
1. The Rep Swamp patch is finally here.
The highlight is that the representation of types at the
machine level has changed.
Consequently, this patch contains updates across several back ends.
2. The new Stg -> Cmm path is here, although it appears to have a
fair number of bugs lurking.
3. Many improvements along the CmmCPSZ path, including:
o stack layout
o some code for infotables, half of which is right and half wrong
o proc-point splitting
|
|
|
|
|
|
| |
C-- no longer has 'hints'; to guide parameter passing, it
has 'kinds'. Renamed type constructor, data constructor, and record
fields accordingly
|
|
|
|
|
|
|
| |
This allows the instance of UserOfLocalRegs to be within Haskell98, and IMHO
makes the code a little cleaner generally.
This is one small (though tedious) step towards making GHC's code more
portable...
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The hs_hpc_module() prototype in RtsExternal.h didn't match its usage:
we were passing StgWord-sized parameters but the prototype used C
ints. I think it accidentally worked because we only ever passed
constants that got promoted. The constants unfortunately were
sometimes negative, which caused the C compiler to emit warnings.
I suspect PprC.pprHexVal may be wrong to emit negative constants in
the generated C, but I'm not completely sure. Anyway, it's easy to
fix this in CgHpc, which is what I've done.
|
|
|
|
| |
Fixes building with -Werror (i.e. validate) and GHC < 6.6
|
| |
|
|
|
|
|
|
|
| |
Older GHCs can't parse OPTIONS_GHC.
This also changes the URL referenced for the -w options from
WorkingConventions#Warnings to CodingStyle#Warnings for the compiler
modules.
|
| |
|
| |
|
|
|
|
|
|
| |
This patch should have no effect; it's mainly comments, layout,
plus this contructor name change.
|
|
|
|
|
|
|
|
| |
Defaulting makes compilation of multiple modules more complicated (re: #1405)
Although it was all locally within functions, not because of the module
monomorphism-restriction... but it's better to be clear what's meant, anyway.
I changed some that were defaulting to Integer, to explicit Int, where Int
seemed appropriate rather than Integer.
|
|
|
|
|
|
|
|
|
|
| |
Now, if a single module *anywhere* on the module tree is built with
-fhpc, the binary will enable reading/writing of <bin>.tix.
Previously, you needed to compile Main to allow coverage to operate.
This changes the file format for .hi files; you will need to recompile every library.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We store .mix files in
.hpc/<package>/<the.module.name>.mix
The package main the empty package (aka other naming passes),
so Main just is stored in
.hpc/Main.tix
This change in backwards compatable.
|
| |
|
| |
|
|
|
|
|
|
| |
This version should compile but is still incomplete as it introduces
potential bugs at the places marked 'TODO FIXME NOW'.
It is being recorded to help keep track of changes.
|
| |
|
|
|
|
|
|
|
|
|
| |
- .tix files are now a list of MixModule, which contain a hash of the contents of the .mix file.
- .mix files now have (the same) hash number.
This changes allow different binaries that use the same module compiled in the same way
to share coverage information.
|
|
|
|
|
|
|
| |
- Added HPCRIX support for passing tracer filename.
- Added thread tracing support.
- Cleaned up use of HsFFI.h
|
| |
|
| |
|
|
This large checkin is the new ghc version of Haskell
Program Coverage, an expression-level coverage tool for Haskell.
Parts:
- Hpc.[ch] - small runtime support for Hpc; reading/writing *.tix files.
- Coverage.lhs - Annotates the HsSyn with coverage tickboxes.
- New Note's in Core,
- TickBox -- ticked on entry to sub-expression
- BinaryTickBox -- ticked on exit to sub-expression, depending
-- on the boolean result.
- New Stg level TickBox (no BinaryTickBoxes, though)
You can run the coverage tool with -fhpc at compile time.
Main must be compiled with -fhpc.
|