summaryrefslogtreecommitdiff
path: root/compiler/ghci
Commit message (Collapse)AuthorAgeFilesLines
* Support code generation for unboxed-tuple function argumentsunboxed-tuple-arguments2Max Bolingbroke2012-05-153-55/+99
| | | | | | | | | | | This is done by a 'unarisation' pre-pass at the STG level which translates away all (live) binders binding something of unboxed tuple type. This has the following knock-on effects: * The subkind hierarchy is vastly simplified (no UbxTupleKind or ArgKind) * Various relaxed type checks in typechecker, 'foreign import prim' etc * All case binders may be live at the Core level
* Handle cases with no alternatives in GHCiSimon Marlow2012-05-111-0/+3
| | | | Fixes cgrun045(ghci) amongst others
* Fix Win64 build now that hsc2hs knows what platform we're onIan Lynagh2012-05-011-2/+2
|
* More fixes to kind polymorphism, fixes Trac #6035, #6036Simon Peyton Jones2012-04-251-2/+2
| | | | | | | | | | | | | | | | | * Significant refactoring in tcFamPats and tcConDecl * It seems that we have to allow KindVars (not just TcKindVars during kind unification. See Note [Unifying kind variables] in TcUnify. * Be consistent about zonkQuantifiedTyVars * Split the TcType->TcType zonker (in TcMType) from the TcType->Type zonker (in TcHsSyn) The clever parameterisation was doing my head in, and it's only a small function * Remove some dead code (tcTyVarBndrsGen)
* Fix operand expansion function.Paolo Capriotti2012-04-161-57/+48
|
* Implemented word-sized addressing of pointers and literals.Paolo Capriotti2012-04-162-34/+29
|
* Bytecode assembler refactoring.Paolo Capriotti2012-04-162-331/+278
| | | | | | | | | Use a free monad to specify the assembling procedure, so that it can be run multiple times without producing side effects. This paves the way for a more general implementation of variable-sized instructions, since we need to dry-run the bytecode assembler to determine the size of the operands for some instructions.
* Export State monad transformer from ByteCodeItbls.Paolo Capriotti2012-04-161-6/+15
|
* Support large SLIDE instructions.Paolo Capriotti2012-04-161-44/+66
| | | | | | | | | | | | | The bytecode generator used to keep track of the stack depth with a 16-bit counter, which could overflow for very large BCOs, resulting in incorrect bytecode. This commit switches to a word-sized counter, and eagerly panics whenever an operand is too big, instead of truncating the result. This allows us to work around the 16-bit limitation in the case of SLIDE instructions, since we can simply factor it into multiple SLIDEs with smaller arguments.
* Whitespace fixes in ghci/Linker.lhsIan Lynagh2012-03-201-328/+321
|
* Fix whitespace in ghci/ObjLink.lhsIan Lynagh2012-03-201-24/+17
|
* Fix validate with tables-next-to-code offIan Lynagh2012-02-271-0/+7
|
* Implement "value" imports with the CAPIIan Lynagh2012-02-261-1/+3
| | | | | | This allows us to import values (i.e. non-functions) with the CAPI. This means we can access values even if (on some or all platforms) they are simple #defines.
* Implememt -fdefer-type-errors (Trac #5624)Simon Peyton Jones2012-01-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements the idea of deferring (most) type errors to runtime, instead emitting only a warning at compile time. The basic idea is very simple: * The on-the-fly unifier in TcUnify never fails; instead if it gets stuck it emits a constraint. * The constraint solver tries to solve the constraints (and is entirely unchanged, hooray). * The remaining, unsolved constraints (if any) are passed to TcErrors.reportUnsolved. With -fdefer-type-errors, instead of emitting an error message, TcErrors emits a warning, AND emits a binding for the constraint witness, binding it to (error "the error message"), via the new form of evidence TcEvidence.EvDelayedError. So, when the program is run, when (and only when) that witness is needed, the program will crash with the exact same error message that would have been given at compile time. Simple really. But, needless to say, the exercise forced me into some major refactoring. * TcErrors is almost entirely rewritten * EvVarX and WantedEvVar have gone away entirely * ErrUtils is changed a bit: * New Severity field in ErrMsg * Renamed the type Message to MsgDoc (this change touches a lot of files trivially) * One minor change is that in the constraint solver we try NOT to combine insoluble constraints, like Int~Bool, else all such type errors get combined together and result in only one error message! * I moved some definitions from TcSMonad to TcRnTypes, where they seem to belong more
* Make the RTS linker API use wide-char pathnames on Windows (#5697)Simon Marlow2012-01-091-27/+11
| | | | | I haven't been able to test whether this works or not due to #5754, but at least it doesn't appear to break anything.
* Be explicit about what we import from Data.MonoidJohan Tibell2012-01-071-1/+1
|
* Merge branch 'master' of http://darcs.haskell.org/ghcSimon Peyton Jones2011-11-241-18/+16
|\ | | | | | | | | Conflicts: compiler/ghci/ByteCodeItbls.lhs
| * fix warnings (validate was failing on i386)Simon Marlow2011-11-241-3/+7
| |
* | Fix build on WindowsSimon Peyton Jones2011-11-231-13/+18
|/
* Fix compilation error in unreg modeDavid Terei2011-11-221-1/+1
|
* Fix warnings in ByteCodeItblsDavid Terei2011-11-221-56/+50
|
* Tabs -> Spaces + cleaningDavid Terei2011-11-221-14/+0
|
* Update for a mutable localeEncodingMax Bolingbroke2011-11-181-2/+13
|
* New kind-polymorphic coreJose Pedro Magalhaes2011-11-111-1/+2
| | | | | | | | | This big patch implements a kind-polymorphic core for GHC. The current implementation focuses on making sure that all kind-monomorphic programs still work in the new core; it is not yet guaranteed that kind-polymorphic programs (using the new -XPolyKinds flag) will work. For more information, see http://haskell.org/haskellwiki/GHC/Kinds
* Use -fwarn-tabs when validatingIan Lynagh2011-11-047-0/+49
| | | | | We only use it for "compiler" sources, i.e. not for libraries. Many modules have a -fno-warn-tabs kludge for now.
* disable a debugging trace, and a little refactoringSimon Marlow2011-11-041-4/+2
|
* Fix gratuitous code duplication in the byte code generatorSimon Marlow2011-11-021-16/+34
| | | | | | | | For a case expression with a default, we were re-emitting the code for the default branch each time it was referenced, which in a case with many branches could be many times, leading to an O(n^2) blowup. This shows up in ghcirun003, which now runs much faster than before.
* Get label calculations right when we have long (>16 bits) offsetsSimon Marlow2011-11-021-35/+68
| | | | | | This shows up as a segfault in GHCi when there is a very large BCO. I've constructed a test case that crashes with 7.2.1, which I'll put in the testsuite as ghcirun004.
* Improve pretty-printing of BCOs (-ddump-bcos)Simon Marlow2011-11-021-9/+36
|
* Overhaul of infrastructure for profiling, coverage (HPC) and breakpointsSimon Marlow2011-11-021-84/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | User visible changes ==================== Profilng -------- Flags renamed (the old ones are still accepted for now): OLD NEW --------- ------------ -auto-all -fprof-auto -auto -fprof-exported -caf-all -fprof-cafs New flags: -fprof-auto Annotates all bindings (not just top-level ones) with SCCs -fprof-top Annotates just top-level bindings with SCCs -fprof-exported Annotates just exported bindings with SCCs -fprof-no-count-entries Do not maintain entry counts when profiling (can make profiled code go faster; useful with heap profiling where entry counts are not used) Cost-centre stacks have a new semantics, which should in most cases result in more useful and intuitive profiles. If you find this not to be the case, please let me know. This is the area where I have been experimenting most, and the current solution is probably not the final version, however it does address all the outstanding bugs and seems to be better than GHC 7.2. Stack traces ------------ +RTS -xc now gives more information. If the exception originates from a CAF (as is common, because GHC tends to lift exceptions out to the top-level), then the RTS walks up the stack and reports the stack in the enclosing update frame(s). Result: +RTS -xc is much more useful now - but you still have to compile for profiling to get it. I've played around a little with adding 'head []' to GHC itself, and +RTS -xc does pinpoint the problem quite accurately. I plan to add more facilities for stack tracing (e.g. in GHCi) in the future. Coverage (HPC) -------------- * derived instances are now coloured yellow if they weren't used * likewise record field names * entry counts are more accurate (hpc --fun-entry-count) * tab width is now correct (markup was previously off in source with tabs) Internal changes ================ In Core, the Note constructor has been replaced by Tick (Tickish b) (Expr b) which is used to represent all the kinds of source annotation we support: profiling SCCs, HPC ticks, and GHCi breakpoints. Depending on the properties of the Tickish, different transformations apply to Tick. See CoreUtils.mkTick for details. Tickets ======= This commit closes the following tickets, test cases to follow: - Close #2552: not a bug, but the behaviour is now more intuitive (test is T2552) - Close #680 (test is T680) - Close #1531 (test is result001) - Close #949 (test is T949) - Close #2466: test case has bitrotted (doesn't compile against current version of vector-space package)
* fix the object suffix when using TH with profiling (#5554)Simon Marlow2011-10-181-22/+27
|
* Handle HValues slightly nicerIan Lynagh2011-10-031-10/+9
| | | | | | We now have addrToAny# rather than addrToHValue#, and both addrToAny# and mkApUpd0# return "Any" rather than "a". This makes it a little easier to see what's going on, and fixes a warning in ByteCodeLink.
* Fix warnings in ghci/ByteCodeLink.lhsIan Lynagh2011-09-271-19/+10
|
* Whitespace only in ghci/ByteCodeLink.lhsIan Lynagh2011-09-271-68/+68
|
* Make a new type synonym CoreProgram = [CoreBind]Simon Peyton Jones2011-09-231-1/+1
| | | | | | | | | | | and comment its invariants in Note [CoreProgram] in CoreSyn I'm not totally convinced that CoreProgram is the right name (perhaps CoreTopBinds might better), but it is useful to have a clue that you are looking at the top-level bindings. This is only a matter of a type synonym change; no deep refactoring here.
* fix bug in :show bindings when a variable is bound to an exceptionSimon Marlow2011-09-211-2/+8
|
* Add support for all top-level declarations to GHCiSimon Marlow2011-09-213-21/+67
| | | | | | | | | | | | | | | | This is work mostly done by Daniel Winograd-Cort during his internship at MSR Cambridge, with some further refactoring by me. This commit adds support to GHCi for most top-level declarations that can be used in Haskell source files. Class, data, newtype, type, instance are all supported, as are Type Family-related declarations. The current set of declarations are shown by :show bindings. As with variable bindings, entities bound by newer declarations shadow earlier ones. Tests are in testsuite/tests/ghci/scripts/ghci039--ghci054. Documentation to follow.
* Improve the handling of Integer literalsIan Lynagh2011-09-171-1/+1
| | | | | | | | | LitInteger now carries around the id of mkInteger, which it uses to construct the core to build Integer literals. This way we don't have to build in info about lots of Ids. We also no longer have any special-casing for integer-simple, so there is less code involved.
* change how Integer's are handled in CoreIan Lynagh2011-09-131-0/+4
| | | | | | We now treat them as literals until CorePrep, when we finally convert them into the real Core representation. This makes it a lot simpler to implement built-in rules on them.
* Implement -XConstraintKindMax Bolingbroke2011-09-061-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Basically as documented in http://hackage.haskell.org/trac/ghc/wiki/KindFact, this patch adds a new kind Constraint such that: Show :: * -> Constraint (?x::Int) :: Constraint (Int ~ a) :: Constraint And you can write *any* type with kind Constraint to the left of (=>): even if that type is a type synonym, type variable, indexed type or so on. The following (somewhat related) changes are also made: 1. We now box equality evidence. This is required because we want to give (Int ~ a) the *lifted* kind Constraint 2. For similar reasons, implicit parameters can now only be of a lifted kind. (?x::Int#) => ty is now ruled out 3. Implicit parameter constraints are now allowed in superclasses and instance contexts (this just falls out as OK with the new constraint solver) Internally the following major changes were made: 1. There is now no PredTy in the Type data type. Instead GHC checks the kind of a type to figure out if it is a predicate 2. There is now no AClass TyThing: we represent classes as TyThings just as a ATyCon (classes had TyCons anyway) 3. What used to be (~) is now pretty-printed as (~#). The box constructor EqBox :: (a ~# b) -> (a ~ b) 4. The type LCoercion is used internally in the constraint solver and type checker to represent coercions with free variables of type (a ~ b) rather than (a ~# b)
* refactoring and fixing the stage 2 compilationSimon Marlow2011-08-254-1/+4
|
* Formatting fixesDavid Terei2011-08-242-5/+5
|
* fix some #ifdefs that were making compilation with 7.2.1 fail - theSimon Marlow2011-08-141-6/+0
| | | | safified array package is not in 7.2.1
* Add Type.tyConAppTyCon_maybe and tyConAppArgs_maybe, and use themSimon Peyton Jones2011-08-031-3/+3
| | | | | | These turn out to be a useful special case of splitTyConApp_maybe. A refactoring only; no change in behaviour
* Followup to #5289 changes: fix searching for dynamic libraries and useSimon Marlow2011-08-032-5/+18
| | | | | | of the RTS addDLL() API on Windows. When searching for DLLs we should include the .dll extension, but addDLL() takes a filename without the extension.
* Fix #5289 (loading libstdc++.so in GHCi), and also fix some otherSimon Marlow2011-08-033-170/+188
| | | | | | | | | | | | | linking scenarios. We weren't searching for .a archives to satisfy -lfoo options on the GHCi command line, for example. I've tidied up the code in this module so that dealing with -l options on the command line is consistent with the handling of extra-libraries for packages. While I was here I moved some stuff out of Linker.hs that didn't seem to belong here: dataConInfoPtrToName (now in new module DebuggerUtils) and lessUnsafeCoerce (now in DynamicLoading, next to its only use)
* Fix import DEPRECATE failures for castSTUArraySimon Peyton Jones2011-08-021-0/+7
|
* Remove some antiquated C constructsIan Lynagh2011-08-011-2/+2
| | | | | | | | Fixes validate on amd64/Linux with: SRC_CC_OPTS += -Wmissing-parameter-type SRC_CC_OPTS += -Wold-style-declaration SRC_CC_OPTS += -Wold-style-definition
* Add CoreMonad.reinitializeGlobals so plugins can work around linker issuesMax Bolingbroke2011-07-291-14/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a plugin is loaded, it currently gets linked against a *newly loaded* copy of the GHC package. This would not be a problem, except that the new copy has its own mutable state that is not shared with that state that has already been initialized by the original GHC package. This leads to loaded plugins calling GHC code which pokes the static flags, and then dying with a panic because the static flags *it* sees are uninitialized. There are two possible solutions: 1. Export the symbols from the GHC executable from the GHC library and link against this existing copy rather than a new copy of the GHC library 2. Carefully ensure that the global state in the two copies of the GHC library matches I tried 1. and it *almost* works (and speeds up plugin load times!) except on Windows. On Windows the GHC library tends to export more than 65536 symbols (see #5292) which overflows the limit of what we can export from the EXE and causes breakage. (Note that if the GHC exeecutable was dynamically linked this wouldn't be a problem, because we could share the GHC library it links to.) We are going to try 2. instead. Unfortunately, this means that every plugin will have to say `reinitializeGlobals` before it does anything, but never mind. I've threaded the cr_globals through CoreM rather than giving them as an argument to the plugin function so that we can turn this function into (return ()) without breaking any plugins when we eventually get 1. working.
* fix warningSimon Marlow2011-07-201-1/+0
|