| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
| |
Fix a type and a bug for PowerPC.
|
|
|
|
| |
make it compile again (x86)
|
|
|
|
|
|
|
|
|
|
|
| |
The Native Code Generator for PowerPC.
Still to be done:
*) Proper support of Floats and Doubles
currently it seems to work, but it's just guesswork.
*) Some missing operations, only needed for -O, AFAICT.
*) Mach-O dynamic linker stub generation.
(can't import foreign functions from dynamic libraries,
and it might fail for big programs)
|
|
|
|
| |
Native code gen primpops (courtesy Julian)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--------------------------------------
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.
|
|
|
|
|
|
|
| |
Finally separate the compiler from hslibs.
Mainly import wibbles, and use the new POSIX library when
bootstrapping.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PrimRep Cleanup
- Remove all PrimReps which were just different flavours of
PtrRep. Now, everything which is a pointer to a closure of
some kind is always a PtrRep.
- Three of the deleted PrimReps, namely ArrayRep, ByteArrayRep,
and ForeignObj rep, had a subtle reason for their existence:
the abstract C pretty-printer(!) used them to decide whether
to apply a shim to an outgoing C-call argument: a ByteArrayRep
argument would be adjusted to point past the object header,
for example.
I've changed this to happen in a much more reasonable and
obvious way: there are now explict macros in AbsCSyn to do the
adjustment, and the code generator makes calls to these as
necessary. Slightly less hackery is necessary in the NCG as
a result.
|
|
|
|
| |
Sparc NCG fix from Sven Panne: 8-byte align the stack ptr when doing a ccall.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Teach code gen about some extra no-ops
|
|
|
|
| |
ptext => ftext
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
FastString cleanup, stage 1.
The FastString type is no longer a mixture of hashed strings and
literal strings, it contains hashed strings only with O(1) comparison
(except for UnicodeStr, but that will also go away in due course). To
create a literal instance of FastString, use FSLIT("..").
By far the most common use of the old literal version of FastString
was in the pattern
ptext SLIT("...")
this combination still works, although it doesn't go via FastString
any more. The next stage will be to remove the need to use this
special combination at all, using a RULE.
To convert a FastString into an SDoc, now use 'ftext' instead of
'ptext'.
I've also removed all the FAST_STRING related macros from HsVersions.h
except for SLIT and FSLIT, just use the relevant functions from
FastString instead.
|
|
|
|
| |
Friday afternoon pet peeve removal: define (Util.notNull :: [a] -> Bool) and use it
|
|
|
|
| |
Import wibbles
|
|
|
|
| |
Back out previous fix, it was wrong.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Remove the interface file parser, and move .hi-boot parsing into the
main parser. The syntax of .hi-boot files is now greatly improved in
terms of readability; here's an example:
module M where
data T
f :: T -> GHC.Base.Int
note that
(a) layout can be used
(b) there's no explcit export list; everything declared
is implicitly exported
(c) Z-encoding of names is no longer required
(d) Any identifier not declared in the current module must
still be quailified with the module which originally
defined it (eg. GHC.Base.Int above).
We'd like to relax (d), but that will come later.
|
|
|
|
| |
Cope with VoidRep fields in a static constructor.
|
|
|
|
|
|
|
|
| |
Fix a bug in the native code generator's handling of floating-point
arguments to ccalls: it wasn't correctly promoting float arguments to
doubles. Amazingly this has gone undetected for quite a while.
Fixes bug #523996.
|
|
|
|
|
|
|
|
|
|
|
|
| |
New call attribute on foreign imports, threadsafe.
It indicates that a foreign import can(*) safely be called
concurrently with the continued evaluation of other Haskell
threads, i.e., when the foreign call is made by a Haskell
thread, it won't hinder the progress of other threads.
(*) - if the platform and RTS supports it, it _will be_
invoked concurrently.
|
|
|
|
| |
Import wibbles
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 :-(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Clean up the AbsC -> AbsC translation of array operations.
* MachOps MO_ReadOSBI and MO_WriteOSBI, which previously did
array indexing, are gone. We translate now just to plain
memory references and explicit address computations. This
has the happy side effect that all MachOps now return exactly
one result (previously it was 0 or 1), cleaning up various
bits of code.
As a result the Abstract C structure now contains an unneccessary
restriction, which is that the result of a MachOp can only be
assigned to a temporary. This made sense when MachOps had variable
numbers of results (0, 1 or 2, originally), but is no longer needed.
MachOps applied to args could now be allowed to appear as
arbitrary nodes in expression trees, but so far they are not.
* Get rid of CAddrMode constructor CMem, since it is a special case of
CVal with a RegRelative of CIndex.
AbstractC is inconsistent and non-orthogonal. The StixStmt + StixExpr
combination expresses a large part of what AbstractC does in a cleaner
and simpler way, IMO.
|
|
|
|
| |
Also implement MO_32U_to_8U for sparc. sigh.
|
|
|
|
| |
Implement missing MachOp, MO_8U_to_32U, for sparc. (duh!)
|
|
|
|
| |
Fix debug build.
|
|
|
|
| |
Fix syntax error in printing indirect calls in sparc assembly.
|
|
|
|
|
|
| |
x86 only: remove special ccall support for calling PerformGC_wrapper
using dodgy-looking calling convention. PerformGC_wrapper was last
seen alive in GHC 3.X, AFAIK.
|
|
|
|
| |
sparc NCG fixes for f-i-dynamic.
|
|
|
|
|
| |
Teach the NCG how to do f-i-dynamic. Nothing unexpected.
sparc-side now needs fixing.
|
|
|
|
|
|
|
|
|
|
| |
merge from stable branch:
1.46.4.3 +14 -7 fptools/ghc/compiler/nativeGen/AsmCodeGen.lhs
1.47.4.3 +2 -0 fptools/ghc/compiler/nativeGen/MachMisc.lhs
Treat literal appearances of BaseReg in Stix trees uniformly.
This is now taken to mean the &MainCapability.r, regardless of
whether BaseReg is in a register (x86) or synthesised (sparc).
|
|
|
|
|
|
|
|
|
| |
merge from the stable branch:
1.70.4.2 fptools/ghc/compiler/nativeGen/StixPrim.lhs
1.5.10.3 fptools/ghc/includes/mkNativeHdr.c
Track recent changes to HpLim assignment in load_thread_state.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- Implement a small GC optimisation: when a static constructor has
been determined to have no (indirect) CAF references, we set its
static link field to a non-zero value (currently 1). This prevents
the garbage collector from traversing this closure and transitively
everything it points to, and thus should speed up GC a little.
- Omit the static link field from static constructors which have no
pointer fields (i.e. they are CONSTR_NOCAF_STATIC).
- Add the padding words and the static link field for a static
constructor at (AbsC) code generation time, rather than in the back
ends. This eliminates some duplication between PprAbsC and
AbsCStixGen.
|
|
|
|
| |
No need for #ifdef around shift primop now.
|
|
|
|
| |
derive Eq Cond so that an assertion in MachCode works.
|
|
|
|
| |
wibble
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Generate floating-point comparisons on x86 which deal with NaNs in what
I assume is an IEEE854 compliant fashion. For
== >= > <= <
if either arg is a NaN, produce False, and for
/=
if either arg is a NaN, produce True.
This is the behaviour that gcc has, by default.
Requires some ultramagical x86 code frags to be emitted. A big comment
in PprMach explains how it works.
|
|
|
|
| |
nano-comment-wibble
|
|
|
|
| |
Correctly handle signed vs unsigned integer division on x86.
|
|
|
|
| |
Fix various bugs in the implementation of subIntC and mulMayOflo.
|
|
|
|
|
|
|
|
|
| |
Redo translation of array indexing primops in order to insert 8 <-> 32
bit casts when dealing with Char arrays. Also facilitate future removal
of CMem and MO_{Read,Write}OSBI.
In the process, notice and fix a large bogon in x86/sparc implementation
of signed and unsigned integer widening.
|
|
|
|
|
|
|
|
|
| |
Sparc NCG changes to track recent mulIntC# changes. The Prelude
can now finally be compiled with the sparc NCG.
Also (incidentally) emit sparc integer multiply insns directly
rather than calling a helper routine. Most sparcs should implement
them by now :)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Get rid of multiple-result MachOps (MO_NatS_AddC, MO_NatS_SubC,
MO_NatS_MulC) which implement {add,sub,mul}IntC#. Supporting gunk
in the NCG disappears as a result.
Instead:
* {add,sub}IntC# are translated out during abstract C simplification,
turning into the xor-xor-invert-and-shift sequence previously defined
in PrimOps.h.
* mulIntC# is more difficult to get rid of portably. Instead we have
a new single-result PrimOp, mulIntMayOflo, with corresponding MachOp
MO_NatS_MulMayOflo. This tells you whether a W x W -> W signed
multiply might overflow, where W is the word size. When W=32, is
implemented by computing a 2W-long result. When W=64, we use the
previous approximation.
PrelNum.lhs' implementation of timesInteger changes slightly, to use
the new PrimOp.
|
|
|
|
| |
shift wibble
|
|
|
|
| |
Sparc NCG fixes for 16 bit loads/stores.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make the sparc native code generator work again after recent
primop hackery.
* Track the change from PrimOp to MachOp at the Stix level.
* Teach the sparc insn selector how to generate 64-bit code.
* Fix various bogons in sparc {Int,Double,Float} <-> {Int,Double,Float}
conversions which only happened to generate correct code by
accident, so far.
* Synthesise BaseReg from &MainCapability.r on archs which do not
have BaseReg in a regiser (eg sparc :)
At the moment {add,sub,mul}Int# are not implemented. To be fixed.
|
|
|
|
| |
shiftery #ifdefs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add just enough infrastructure to the NCG that it can deal with simple 64-bit
code on 32-bit platforms. Main changes are:
* Addition of a simple 64-bit instruction selection fn iselExpr64 to MachCode.
This generates code for a 64-bit value and places the results into two
virtual registers, related thusly:
* Add a new type VRegUnique, which is used to label Stix virtual registers.
This type used to be a plain Unique, but that forces the assumption that
each Abstract-C level C temporary corresponds to exactly one Stix virtual
register, which is untrue when the C temporary is 64-bit sized on a
32-bit machine. In the new scheme, the Unique for the C temporary can
turn into two related VRegUniques, related by having the same embedded
unique.
* Made a start on 'target metrics' by adding ncg_target_is_32bits to the
end of Stix.lhs.
* Cleaned up numerous other gruesomenesses in the NCG which never came
to light before now. Got rid of MachMisc.sizeOf, which doesn't make
sense in a 64-bit setting, and replaced it by calls to
PrimRep.getPrimRepArrayElemSize, which, as far as I'm concerned, is the
definitive answer to the questio `How Big Is This PrimRep Really?'
Result: on x86-linux, at least, you can now compile the Entire Prelude
with -fasm! At this stage I cannot claim that the resulting code is
correct, but it's a start.
|
|
|
|
| |
Make it compile -DDEBUG.
|
|
|
|
|
|
|
| |
Add constructor CBytesPerWord to (the wildly-misnamed) CAddrMode, and
use this in various places to remove word size dependencies in the
C -> C simplification pass. Tart up the Stix constant folder a bit
so as to be able to fold out the shift/mask literal expressions.
|