| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 :-(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes a problem with the recent clean up in the parsing of type
declarations. The cleaned up version was correct by H98 (I think), but
unfortunately won't compile the Prelude anymore.
I made the definition a little bit more liberal as follows:
- In `tycl_hdr' allow `gtycon' instead of just `tycon' for the defined type
constructor. This allows beyond H98 special syntax like "[]" etc as well as
tycon ops in parenthesis. Moreover, it allows qualified names, but the
renamer flags the latter as errors.
- Allow `gtycon' instead of only `qtycon' for the class name in definitions of
the form `Eq a => T a' to avoid a whole list of s/r conflicts. (I have *not*
checked that the renamer flags misuse, but I would expect that it does.)
ToDo: I think, the renamer should raise an error for all these additional
forms *unless* -fglasgow-exts is given.
In PrelBase, I needed to replace the infix notation by prefix notation in the
definition of `:+:' and `:*:'.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
*******************************
* Merging from ghc-ndp-branch *
*******************************
This commit merges the current state of the "parallel array extension" and
includes the following:
* (Almost) completed Milestone 1:
- The option `-fparr' activates the H98 extension for parallel arrays.
- These changes have a high likelihood of conflicting (in the CVS sense)
with other changes to GHC and are the reason for merging now.
- ToDo: There are still some (less often used) functions not implemented in
`PrelPArr' and a mechanism is needed to automatically import
`PrelPArr' iff `-fparr' is given. Documentation that should go into
the Commentary is currently in `ghc/compiler/ndpFlatten/TODO'.
* Partial Milestone 2:
- The option `-fflatten' activates the flattening transformation and `-ndp'
selects the "ndp" way (where all libraries have to be compiled with
flattening). The way option `-ndp' automagically turns on `-fparr' and
`-fflatten'.
- Almost all changes are in the new directory `ndpFlatten' and shouldn't
affect the rest of the compiler. The only exception are the options and
the points in `HscMain' where the flattening phase is called when
`-fflatten' is given.
- This isn't usable yet, but already implements function lifting,
vectorisation, and a new analysis that determines which parts of a module
have to undergo the flattening transformation. Missing are data structure
and function specialisation, the unboxed array library (including fusion
rules), and lots of testing.
I have just run the regression tests on the thing without any problems. So,
it seems, as if we haven't broken anything crucial.
|
|
|
|
| |
[non-code-change] complaint --> compliant
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
---------
Main.main
---------
A bunch of related fixes concerning 'main'
* Arrange that 'main' doesn't need to be defined in module Main;
it can be imported.
* The typechecker now injects a binding
Main.$main = PrelTopHandler.runMain main
So the runtime system now calls Main.$main, not PrelMain.main.
With z-encoding, this look like
Main_zdmain_closure
* The function
PrelTopHandler.runMain :: IO a -> IO ()
wraps the programmer's 'main' in an exception-cacthing wrapper.
* PrelMain.hs and Main.hi-boot are both removed from lib/std, along
with multiple lines of special case handling in lib/std/Makefile.
This is a worthwhile cleanup.
* Since we now pick up whatever 'main' is in scope, the ranamer gets
in on the act (RnRnv.checkMain). There is a little more info to
get from the renamer to the typechecker, so I've defined a new type
Rename.RnResult (c.f. TcModule.TcResult)
* With GHCi, it's now a warning, not an error, to omit the binding
of main (RnEnv.checkMain)
* It would be easy to add a flag "-main-is foo"; the place to use
that information is in RnEnv.checkMain.
-------
On the way I made a new type,
type HscTypes.FixityEnv = NameEnv Fixity
and used it in various places I'd tripped over
|
|
|
|
|
| |
Conformed the FFI libraries to meet the FFI Addendum 1.0 specification (except
hs_init() and friends).
|
|
|
|
|
| |
Move showHex, showOct, showBin and showIntAtBase from NumExts to
Numeric as per recent changes to Haskell 98.
|
|
|
|
|
|
| |
Don't use :: rules for building HSstd.o, they cause it to be rebuilt
every time. According to the GNU make manual, :: rules are vary
rarely actually useful, and I'm sure we use them too much.
|
|
|
|
| |
Minor cleanups.
|
|
|
|
| |
Add instance Eq Exception (and hence instance Eq IOError).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
------------
Rule phasing
------------
This commit adds a little more control to when rules are enabled.
{-# RULES
"foo" [2] forall ...
"baz" [~2] forall ...
#-}
Rule "foo" is active in phase 2 and later. The new thing is that the
"~2" means that Rule "baz" is active in phase 3 and earlier.
(Remember tha phases decrease towards zero.)
All the machinery was there to implement this, it just needed the syntax.
Why do this? Peter Gammie (at UNSW) found that rules weren't firing
because of bindings of the form
M.f = f
f = ....
where the rules where on the M.f binding. It turned out that an old
hack (which have for some time elicited the harmless "shortMeOut" debug
warnings) prevented this trivial construction from being correctly
simplified. The hack in turn derived from a trick in the way the
foldr/build rule was implemented....and that hack is no longer necessary
now we can switch rules *off* as well as *on*.
There are consequential changes in the Prelude foldr/build RULE stuff.
It's a clean-up.... Instead of strange definitions like
map = mapList
which we had before, we have an ordinary recursive defn of map, together
with rules to convert first to foldr/build form, and then (if nothing
happens) back again.
There's a fairly long comment about the general plan of attack in
PrelBase, near the defn of map.
|
|
|
|
|
|
|
| |
Never close std file descriptors. This works around a "problem" in
GHCi: if the program reaches EOF on stdin, it might close it, which in
turn causes the interactive shell to fall over with a "bad file
descriptor" error when it tries to read from stdin.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
| |
add HSstd{1,2}.o to INSTALL_LIBS (mingw only)
|
|
|
|
|
|
| |
Convert PrelPosix from a .hsc file into a
.hs file (that gets its configuration-time info
via config.h).
|
|
|
|
|
| |
Ho-hum, readdir() and readdir_r() with GNU libc doesn't
flag the end of the directory stream the same way. Cope.
|
|
|
|
| |
fix pathconf() usage
|
|
|
|
| |
prel_readdir: tidied
|
|
|
|
|
| |
getDirectoryContents: use the re-entrant readdir_r() to get at directory
entries, if available.
|
|
|
|
| |
prel_sizeof_{termios,sigset_t}: sync up proto and impl
|
|
|
|
| |
struct sigset_t -> sigset_t
|
|
|
|
| |
heal
|
|
|
|
| |
debugging-by-nightly-build-reports; give poke_c_flag a correct FI decl
|
|
|
|
|
|
|
|
|
|
| |
Get rid of uses of #const, #peek, #poke and #ptr from PrelPosix.hsc
(this leaves just uses of #type in PrelPosix) - provide constant and
accessor wrappers via PrelIOUtils.c instead.
Who knows, we might just be able to bootstrap via .hc files again..?
Only compiled & tested under Win32.
|
|
|
|
|
| |
Added & exported low-level memcpy() wrappers - possible to offset both
src and dest.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- removed PrelPosix.c_read, PrelPosix.c_write
- added Ptr and RawBuffer versions of PrelHandle.write_off,
and PrelHandle.read_off and exported them, i.e., PrelHandle
now exports:
read_off_ba :: FD -> Bool -> RawBuffer -> Int -> CInt -> IO CInt
read_off :: FD -> Bool -> Ptr CChar -> Int -> CInt -> IO CInt
write_off_ba :: CInt -> Bool -> RawBuffer -> Int -> CInt -> IO CInt
write_off :: CInt -> Bool -> Ptr CChar -> Int -> CInt -> IO CInt
- make hPutChar (win)socket friendly.
|
|
|
|
|
|
|
|
|
| |
Move some small inline-in-C functions out of PrelPosix.hsc and into
the supporting cbits sources, where they belong.
Following this change, can you now compile the entire Prelude on
x86-linux with the native code generator, and get something which
actually works properly.
|
|
|
|
|
|
|
|
|
|
| |
Now that we can derive arbitrary classes for newtypes, use this to
derive all the classes we need for the types in PrelCTypes and
PrelCTypesISO, instead of the previous hack of explicitly coercing the
methods.
This should improve the quality of code using these types too; the
coercions were surely getting in the way of optimisations before.
|
|
|
|
| |
Fix various bugs in the implementation of subIntC and mulMayOflo.
|
|
|
|
|
|
|
|
| |
Allow opening char & block devices with openFile. Opening a char
device gets you a stream, and a block device a file (these are
heuristics since we can't really tell without trying to lseek() on the
device whether it supports seeking or not, but the defaults are at
least safe).
|
|
|
|
| |
slightly clearer fix for previous bogon, and re-indent the function
|
|
|
|
| |
Fix ifdefery bracketing bug on Win32
|
|
|
|
| |
Add a rule for foldr k z [x]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
shiftR# --> shiftRL#
|
|
|
|
|
|
|
| |
Add shifty wrappers:
shiftL#, shiftR# :: Word# -> Int# -> Word#
iShiftL#, iShiftRA#, iShiftRL# :: Int# -> Int# -> Int#
|
|
|
|
| |
Swap order of test; see comments in code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change the story on shifting primops: SllOp, SrlOp, ISllOp, ISraOp, ISrlOp.
In the old primop story, these were implemented by C macros which
checked that the shift amount did not exceed the word size, and if so
returns a suitable value (0 or -1). This gives consistent, defined
behaviour for any shift amount. However, these checks were not
implemented on the NCG route, an inconsistency.
New story: these primops do NOT check their args; they just do the shift.
Shift values >= word size give undefined results. To reflect this, their
Haskell names have been prefixed with 'unchecked'.
The checks are now done on the Bits instances in the Prelude. This means
all code generation routes are consistently checked, and hopefully the
simplifier will remove the checks for literal shift amounts.
I have tried to fix up the implementation for 64-bit platforms too, but
not having one to hand, I don't know if it will work as-is.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--------------------------------------------
Translate out PrimOps at the AbstractC level
--------------------------------------------
This is the first in what might be a series of changes intended
to make GHC less dependent on its C back end. The main change is
to translate PrimOps into vanilla abstract C inside the compiler,
rather than having to duplicate that work in each code generation
route. The main changes are:
* A new type, MachOp, in compiler/absCSyn/MachOp.hs. A MachOp
is a primitive operation which we can reasonably expect the
native code generators to implement. The set is quite small
and unlikely to change much, if at all.
* Translations from PrimOps to MachOps, at the end of
absCSyn/AbsCUtils. This should perhaps be moved to a different
module, but it is hard to see how to do this without creating
a circular dep between it and AbsCUtils.
* The x86 insn selector has been updated to track these changes. The
sparc insn selector remains to be done.
As a result of this, it is possible to compile much more code via the
NCG than before. Almost all the Prelude can be compiled with it.
Currently it does not know how to do 64-bit code generation. Once
this is fixed, the entire Prelude should be compilable that way.
I also took the opportunity to clean up the NCG infrastructure.
The old Stix data type has been split into StixStmt (statements)
and StixExpr (now denoting values only). This removes a class
of impossible constructions and clarifies the NCG.
Still to do, in no particular order:
* String and literal lifting, currently done in the NCG at the top
of nativeGen/MachCode, should be done in the AbstractC flattener,
for the benefit of all targets.
* Further cleaning up of Stix assignments.
* Remove word-size dependency from Abstract C. (should be easy).
* Translate out MagicIds in the AbsC -> Stix translation, not
in the Stix constant folder. (!)
Testsuite failures caused by this:
* memo001 - fails (segfaults) for some unknown reason now.
* arith003 - wrong answer in gcdInt boundary cases.
* arith011 - wrong answer for shifts >= word size.
* cg044 - wrong answer for some FP boundary cases.
These should be fixed, but I don't think they are mission-critical for
anyone.
|
|
|
|
| |
unbreak inputReady().
|
|
|
|
| |
added closing bracket at end of file
|
|
|
|
| |
Use the message queue friendly MsgWaitForMultipleObjects()
|
|
|
|
| |
Support IO.hWaitForInput on Win32 platforms (on file and socket handles).
|
|
|
|
|
|
|
| |
Hmmm, we probably should install HsStd.h, too. PackageSrc.hs mentions
it, and "make boot" in ghc/utils/hsc2hs fails without it. Perhaps this
should be fixed differently, but I can't figure out how to do this
correctly...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
------------------------------
Add linear implicit parameters
------------------------------
Linear implicit parameters are an idea developed by Koen Claessen,
Mark Shields, and Simon PJ, last week. They address the long-standing
problem that monads seem over-kill for certain sorts of problem, notably:
* distributing a supply of unique names
* distributing a suppply of random numbers
* distributing an oracle (as in QuickCheck)
Linear implicit parameters are just like ordinary implicit parameters,
except that they are "linear" -- that is, they cannot be copied, and
must be explicitly "split" instead. Linear implicit parameters are
written '%x' instead of '?x'. (The '/' in the '%' suggests the
split!)
For example:
data NameSupply = ...
splitNS :: NameSupply -> (NameSupply, NameSupply)
newName :: NameSupply -> Name
instance PrelSplit.Splittable NameSupply where
split = splitNS
f :: (%ns :: NameSupply) => Env -> Expr -> Expr
f env (Lam x e) = Lam x' (f env e)
where
x' = newName %ns
env' = extend env x x'
...more equations for f...
Notice that the implicit parameter %ns is consumed
once by the call to newName
once by the recursive call to f
So the translation done by the type checker makes
the parameter explicit:
f :: NameSupply -> Env -> Expr -> Expr
f ns env (Lam x e) = Lam x' (f ns1 env e)
where
(ns1,ns2) = splitNS ns
x' = newName ns2
env = extend env x x'
Notice the call to 'split' introduced by the type checker.
How did it know to use 'splitNS'? Because what it really did
was to introduce a call to the overloaded function 'split',
ndefined by
class Splittable a where
split :: a -> (a,a)
The instance for Splittable NameSupply tells GHC how to implement
split for name supplies. But we can simply write
g x = (x, %ns, %ns)
and GHC will infer
g :: (Splittable a, %ns :: a) => b -> (b,a,a)
The Splittable class is built into GHC. It's defined in PrelSplit,
and exported by GlaExts.
Other points:
* '?x' and '%x' are entirely distinct implicit parameters: you
can use them together and they won't intefere with each other.
* You can bind linear implicit parameters in 'with' clauses.
* You cannot have implicit parameters (whether linear or not)
in the context of a class or instance declaration.
Warnings
~~~~~~~~
The monomorphism restriction is even more important than usual.
Consider the example above:
f :: (%ns :: NameSupply) => Env -> Expr -> Expr
f env (Lam x e) = Lam x' (f env e)
where
x' = newName %ns
env' = extend env x x'
If we replaced the two occurrences of x' by (newName %ns), which is
usually a harmless thing to do, we get:
f :: (%ns :: NameSupply) => Env -> Expr -> Expr
f env (Lam x e) = Lam (newName %ns) (f env e)
where
env' = extend env x (newName %ns)
But now the name supply is consumed in *three* places
(the two calls to newName,and the recursive call to f), so
the result is utterly different. Urk! We don't even have
the beta rule.
Well, this is an experimental change. With implicit
parameters we have already lost beta reduction anyway, and
(as John Launchbury puts it) we can't sensibly reason about
Haskell programs without knowing their typing.
Of course, none of this is throughly tested, either.
|
|
|
|
| |
GC unused imports
|
|
|
|
| |
removed ToDo comment + braino
|
|
|
|
| |
make it work on non-mingw platforms
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make the IO implementation work with WinSock once again.
When creating sockets with WinSock, you don't get back
a file descriptor, but a SOCKET (which just so happens
to map to the same type as a 'normal' file descriptor).
This SOCKET value cannot be used with the CRT ops
read(), write(), close(), but you have to use the
socket-specific operations (recv(), send(), and closesocket(),
respectively) instead.
To keep track of this distinction between file and
socket file descriptors, the following changes were
made:
* a Handle__ has got a new field, haIsStream, which is True
for sockets / streams.
(this field is essentially unused in non-Win32 settings,
but I decided not to conditionalise its presence).
* PrelHandle.openFd now takes an extra (Maybe FDType) argument,
which lets you force what type of FD we're converting into
a Handle (this is crucial for WinSock SOCKETs, since we don't
want to attempt fstat()ing them).
Fixes breakage that was introduced with May 2001 (or earlier)
rewrite of the IO layer. This commit build upon recent IO changes
to HEAD, so merging it to STABLE will require importing those
changes too (I'll let others be the judge whether this should
be done or not).
|
|
|
|
|
| |
win32 only - provide closeFd, which closes a file descriptor, be it of
file or socket ilk.
|