summaryrefslogtreecommitdiff
path: root/ghc/compiler/main
Commit message (Collapse)AuthorAgeFilesLines
...
* [project @ 2004-10-03 16:28:02 by panne]panne2004-10-034-13/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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?
* [project @ 2004-10-01 13:42:04 by simonpj]simonpj2004-10-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | ------------------------------------ Simplify the treatment of newtypes Complete hi-boot file consistency checking ------------------------------------ In the representation of types, newtypes used to have a special constructor all to themselves, very like TyConApp, called NewTcApp. The trouble is that means we have to *know* when a newtype is a newtype, and in an hi-boot context we may not -- the data type might be declared as data T in the hi-boot file, but as newtype T = ... in the source file. In GHCi, which accumulates stuff from multiple compiles, this makes a difference. So I've nuked NewTcApp. Newtypes are represented using TyConApps again. This turned out to reduce the total amount of code, and simplify the Type data type, which is all to the good. This commit also fixes a few things in the hi-boot consistency checking stuff.
* [project @ 2004-10-01 10:08:49 by simonpj]simonpj2004-10-011-2/+5
| | | | | | | | | | | | | ----------------------------------- Do simple checking on hi-boot files ----------------------------------- This commit arranges that, when compiling A.hs, we compare the types we infer with those in A.hi-boot, if the latter exists. (Or, more accurately, if anything A.hs imports in turn imports A.hi-boot, directly or indirectly.) This has been on the to-do list forever.
* [project @ 2004-09-30 10:35:15 by simonpj]simonpj2004-09-309-12/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ------------------------------------ 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).
* [project @ 2004-09-30 10:31:58 by simonmar]simonmar2004-09-301-0/+8
| | | | | | Add -I- after the include paths when running gcc. This prevents accidental shadowing of system includes by putting a file called eg. stdint.h in the current directory.
* [project @ 2004-09-27 11:35:59 by simonmar]simonmar2004-09-271-1/+1
| | | | export errMsgContext
* [project @ 2004-09-16 01:39:24 by mthomas]mthomas2004-09-161-0/+4
| | | | On Windows default to main.exe instead of a.out.
* [project @ 2004-09-08 08:55:55 by simonmar]simonmar2004-09-081-4/+4
| | | | Fix newline wibbles in new message API
* [project @ 2004-09-08 08:47:54 by simonmar]simonmar2004-09-081-10/+24
| | | | | Minor updates required by VS: return the typechecker's abstract syntax tree from hscBufferFrontEnd.
* [project @ 2004-09-01 14:14:29 by simonmar]simonmar2004-09-012-22/+66
| | | | | | | | Minore package GHC fixes, and a couple of changes for Visual Studio. Messages from the compiler should now go through a new API in ErrUtils, so that they can be redirected by the GHC client if necessary. (currently not all messages go through this interface, but some of them do).
* [project @ 2004-09-01 09:43:25 by simonmar]simonmar2004-09-011-3/+12
| | | | | | | Catch exit(127) result from raw system, and report that we couldn't execute the program. This is a semi-hack; all exec() errors get reported as exit(127) by rawSystem, but if we treat it just like a program that does exit(127) then the user sees no output.
* [project @ 2004-08-26 15:44:50 by simonpj]simonpj2004-08-261-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | ------------------------------- Print built-in sytax right ------------------------------- Built-in syntax, like (:) and [], is not "in scope" via the GlobalRdrEnv in the usual way. When we print it out, we should also print it in unqualified form, even though it's not in the environment. I've finally bitten the (not very big) bullet, and added to Name the information about whether or not a name is one of these built-in ones. That entailed changing the calls to mkWiredInName, but those are exactly the places where you have to decide whether it's built-in or not, which is fine. Built-in syntax => It's a syntactic form, not "in scope" (e.g. []) Wired-in thing => The thing (Id, TyCon) is fully known to the compiler, not read from an interface file. E.g. Bool, True, Int, Float, and many others All built-in syntax is for wired-in things.
* [project @ 2004-08-25 17:49:22 by sof]sof2004-08-251-4/+4
| | | | wibble
* [project @ 2004-08-17 15:23:47 by simonpj]simonpj2004-08-171-3/+6
| | | | | | | | | | | | | | | | ------------------------------- Use merge-sort not quicksort Nuke quicksort altogether ------------------------------- Quicksort has O(n**2) behaviour worst case, and this occasionally bites. In particular, when compiling large files consisting only of static data, we get loads of top-level delarations -- and that led to more than half the total compile time being spent in the strongly connected component analysis for the occurrence analyser. Switching to merge sort completely solved the problem. I've nuked quicksort altogether to make sure this does not happen again.
* [project @ 2004-08-16 11:19:24 by simonmar]simonmar2004-08-161-0/+5
| | | | | | | | | | Define <arch>_TARGET_ARCH and <os>_TARGET_OS by default when CPP'ing. This avoids the main reason for needing to #include config.h into Haskell source, so most files that previously just #include "config.h" can now #if __GLASGOW_HASKELL__ < 603 #include "config.h" #endif
* [project @ 2004-08-16 09:53:47 by simonpj]simonpj2004-08-162-65/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ------------------------------- Add instance information to :i Get rid of the DeclPool ------------------------------- 1. Add instance information to :info command. GHCi now prints out which instances a type or class belongs to, when you use :i 2. Tidy up printing of unqualified names in user output. Previously Outputable.PrintUnqualified was type PrintUnqualified = Name -> Bool but it's now type PrintUnqualified = ModuleName -> OccName -> Bool This turns out to be tidier even for Names, and it's now also usable when printing IfaceSyn stuff in GHCi, eliminating a grevious hack. 3. On the way to doing this, Simon M had the great idea that we could get rid of the DeclPool holding pen, which held declarations read from interface files but not yet type-checked. We do this by eagerly populating the TypeEnv with thunks what, when poked, do the type checking. This is just a logical continuation of lazy import mechanism we've now had for some while. The InstPool and RulePool still exist, but I plan to get rid of them in the same way. The new scheme does mean that more rules get sucked in than before, because previously the TypeEnv was used to mean "this thing was needed" and hence to control which rules were sucked in. But now the TypeEnv is populated more eagerly => more rules get sucked in. However this problem will go away when I get rid of the Inst and Rule pools. I should have kept these changes separate, but I didn't. Change (1) affects mainly TcRnDriver, HscMain, CompMan, InteractiveUI whereas change (3) is more wide ranging.
* [project @ 2004-08-13 13:04:50 by simonmar]simonmar2004-08-1312-178/+157
| | | | Merge backend-hacking-branch onto HEAD. Yay!
* [project @ 2004-08-12 13:11:35 by simonmar]simonmar2004-08-121-1/+1
| | | | wibble
* [project @ 2004-08-12 13:10:35 by simonmar]simonmar2004-08-122-5/+3
| | | | avoid string gaps
* [project @ 2004-08-12 11:19:39 by simonmar]simonmar2004-08-121-6/+10
| | | | | | Take the timestamp of an interpreted linkable from the timestamp of the source file. This works better when the local clock is out of sync with the filesystem, and it's just as accurate.
* [project @ 2004-07-21 10:07:29 by simonpj]simonpj2004-07-211-2/+2
| | | | Add location information to :i command
* [project @ 2004-06-24 09:41:11 by simonmar]simonmar2004-06-241-5/+21
| | | | | | | | | Correction to the construction of .hi filenames in dependency generation. Fixes sourceforge bug #978543 Merge to STABLE
* [project @ 2004-06-24 09:35:13 by simonmar]simonmar2004-06-241-2/+2
| | | | Tiny perf improvement
* [project @ 2004-06-20 17:58:46 by panne]panne2004-06-201-2/+2
| | | | Renamed Opt_WarnMisc to Opt_WarnDodgyImports
* [project @ 2004-05-19 08:46:21 by simonpj]simonpj2004-05-191-4/+22
| | | | Improve error reporting for static flags
* [project @ 2004-05-09 14:38:13 by panne]panne2004-05-091-1/+1
| | | | Documentation typos
* [project @ 2004-05-06 12:26:13 by simonpj]simonpj2004-05-061-1/+1
| | | | Use IfaceDeprecs synonym
* [project @ 2004-05-06 08:44:52 by simonmar]simonmar2004-05-061-58/+1
| | | | | | | Move the definition of rawSystem into a separate file which we #include in the places it is needed. This is slightly better than copying the code, since we now need it in three places (ghc/utils/runghc is the 3rd).
* [project @ 2004-04-30 15:51:10 by simonmar]simonmar2004-04-301-2/+2
| | | | wibble
* [project @ 2004-04-30 09:46:58 by simonmar]simonmar2004-04-301-1/+2
| | | | | | DoEval is a compilation manager mode too. MERGE TO STABLE
* [project @ 2004-04-27 12:47:13 by simonpj]simonpj2004-04-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ---------------------------------------- 1. Make primOpIsCheap do something sensible 2. Make the state hack work better ---------------------------------------- 1. In March 2001, we changed primOpIsCheap to primOpIsCheap op = False thereby making *no* primops seem cheap. But this killed eta expansion on case (x ==# y) of True -> \s -> ... which is bad. In particular a loop like doLoop n = loop 0 where loop i | i == n = return () | otherwise = bar i >> loop (i+1) allocated a closure every time round because it didn't eta expand. The problem that made us set primOpIsCheap to False was let x = a +# b *# c in x +# x where we don't want to inline x. But primopIsCheap doesn't control that (it's exprIsDupable that does) so the problem doesn't occur even if primOpIsCheap sometimes says 'True'. I think that perhaps something changed since March 2001. 2. Consider this case x of True -> \(s:RealWorld) -> e False -> foo where foo has arity 1. If we are using the "state hack" we want to eta expand here. This commit fixes arityType in the Var case (for foo) to take account of foo's type. Also add -fno-state-hack to the static flags, to allow the state hack to be switched off.
* [project @ 2004-04-05 10:50:24 by simonpj]simonpj2004-04-051-29/+45
| | | | | Add :k(ind) command to ghci to find the kind of a type. This works very, very similarly to :t(ype)
* [project @ 2004-04-02 16:46:57 by simonpj]simonpj2004-04-021-1/+1
| | | | | | | | | | | | | | Extend the "newtype deriving" feature a little bit more (at the request of Wolfgang Jeltsch) Here's the example: class C a b instance C [a] Char newtype T = T Char deriving( C [a] ) Perfectly sensible, and no reason it should not work. Fixing this required me to generalise the abstract syntax of a 'deriving' item, hence the non-local effects.
* [project @ 2004-04-02 13:34:42 by simonpj]simonpj2004-04-021-1/+3
| | | | | | | | | | | | | | | Add a flag -fno-state-hack, which switches off the "state hack". It's claims that every function over realWorldStatePrimTy is a one-shot function. This is pretty true in practice, and makes a big difference. For example, consider a `thenST` \ r -> ...E... The early full laziness pass, if it doesn't know that r is one-shot will pull out E (let's say it doesn't mention r) to give let lvl = E in a `thenST` \ r -> ...lvl... When `thenST` gets inlined, we end up with let lvl = E in \s -> case a s of (r, s') -> ...lvl... and we don't re-inline E.
* [project @ 2004-03-24 10:50:34 by simonmar]simonmar2004-03-242-2/+6
| | | | -i on its own didn't delete the list of search paths as advertised.
* [project @ 2004-03-16 11:39:50 by simonmar]simonmar2004-03-161-66/+65
| | | | | | | | | | | | | | | Remove all known hacks in rawSystem: - no splitting of the program name using toArgs - no avoiding translate when the string already appears to be quoted - no avoiding translate for the command name We now keep separate program name & args for various SysTools programs: gcc, as, ld, mkdll. MERGE TO STABLE
* [project @ 2004-03-10 00:18:21 by wolfgang]wolfgang2004-03-101-3/+0
| | | | | | | Remove -static flag from non-darwin PowerPC builds (this was a relic from the long-dead AIX support) Merge to STABLE.
* [project @ 2004-03-05 15:09:37 by stolz]stolz2004-03-051-2/+2
| | | | Fix #ifdef'ed flags for FreeBSD.
* [project @ 2004-03-05 15:05:28 by simonmar]simonmar2004-03-051-0/+4
| | | | comments
* [project @ 2004-02-25 14:51:37 by simonpj]simonpj2004-02-252-10/+18
| | | | Add a -fno-full-laziness flag
* [project @ 2004-02-25 11:31:24 by simonmar]simonmar2004-02-251-6/+13
| | | | Combined build tags get '_' between them
* [project @ 2004-02-25 11:24:34 by simonmar]simonmar2004-02-251-1/+2
| | | | Add missing case to allowedWith
* [project @ 2004-02-24 17:33:32 by simonmar]simonmar2004-02-243-59/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Experimental support for RTS-only "ways" HEADS UP! This changes the way that the threaded RTS is used, and also the use of debugging RTSs: - We always build threaded and debugging variants of the RTS now. The --enable-threaded-rts configure option is ignored (and will be removed at some point). - New option: -debug enables the debugging RTS - New option: -threaded enables the threaded RTS. When the threaded RTS is stable enough, we might make it the default. The new options just cause a different variant of the RTS to be linked in, and they cause one or two extra options to be enabled too. The implementation is via the usual ways machinery in the compiler, except that these ways are labelled as RTS-only, and so don't require rebuilding all the libraries too. All of this means we can ship threaded and debugging RTSs with GHC, so that users don't need to fetch and build a GHC source tree to use them. I'd like to get this functionality into 6.2.1 if possible, so please test (I'm willing to stretch the definition of "interface change" to accomodate this, since having a threaded RTS available without having to build GHC will be a big win for the Visual Studio project).
* [project @ 2004-02-24 15:57:52 by simonpj]simonpj2004-02-241-0/+1
| | | | | | | | | | | | | --------------------------------------- Record dependency on Template Haskell package --------------------------------------- An unforseen consequence of making the Template Haskell package separate is that we need to record dependency on the package, even if no TH module is imported. So we carry round (another) mutable variable tcg_th_used in the tyepchecker monad, and zap it when $(...) and [| ... |] are used. I did a little tidy-up and documentation in ListSetOps too
* [project @ 2004-02-24 12:39:12 by simonmar]simonmar2004-02-241-9/+18
| | | | | | New version of translate for mingw32, which correctly (allegedly) reverses the command-line translation done by the standard C runtime on Windows.
* [project @ 2004-02-12 14:31:53 by simonpj]simonpj2004-02-121-1/+1
| | | | Make trace message more accurate
* [project @ 2004-02-02 10:07:37 by simonmar]simonmar2004-02-021-2/+2
| | | | Fix build
* [project @ 2004-01-28 10:04:25 by simonpj]simonpj2004-01-281-3/+11
| | | | | | | | | | | | | | | | --------------------------------------- Fix the WinME/98/95 double-backslash bug --------------------------------------- Merge to stable branch, at least once we are sure it's right Backslashes should not be escaped in command-line arguments for rawSystem, on Win32. This only actually causes failures on WinME/98/95, and we can't test that since we don't have it. But this fix seems right regardless. There are extensive new comments in libraries/base/System/Cmd.hs which describe the issues.
* [project @ 2004-01-27 14:41:22 by simonmar]simonmar2004-01-271-2/+2
| | | | error message sorting wibble
* [project @ 2004-01-27 09:16:27 by simonpj]simonpj2004-01-271-0/+6
| | | | Comments only