summaryrefslogtreecommitdiff
path: root/libraries/ghci
Commit message (Collapse)AuthorAgeFilesLines
* ghc: Fix ghc's template-haskell boundBen Gamari2016-11-121-1/+1
|
* Add option to not retain CAFs to the linker APISimon Marlow2016-10-182-3/+24
|
* Implement deriving strategiesRyan Scott2016-09-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Allows users to explicitly request which approach to `deriving` to use via keywords, e.g., ``` newtype Foo = Foo Bar deriving Eq deriving stock Ord deriving newtype Show ``` Fixes #10598. Updates haddock submodule. Test Plan: ./validate Reviewers: hvr, kosmikus, goldfire, alanz, bgamari, simonpj, austin, erikd, simonmar Reviewed By: alanz, bgamari, simonpj Subscribers: thomie, mpickering, oerjan Differential Revision: https://phabricator.haskell.org/D2280 GHC Trac Issues: #10598
* Tag pointers in interpreted constructorsmniip2016-08-303-8/+25
| | | | | | | | | | | | | | | | | | | | | Instead of stg_interp_constr_entry there are now 7 functions (one for each value of the tag bits) that tag the constructor pointer before returning. This is consistent with compiled constructors' entry code, and expectations that compiled code places on compiled constructors. The iserv protocol is extended with an extra field that explains what pointer tag the constructor should use. Test Plan: Added tests for #12523 Reviewers: erikd, bgamari, hvr, austin, simonmar Reviewed By: simonmar Subscribers: osa1, thomie, rwbarton Differential Revision: https://phabricator.haskell.org/D2473 GHC Trac Issues: #12523
* UNPACK the size field of SizedSeqSimon Marlow2016-07-221-1/+1
|
* Add deepseq dependency and a few NFData instancesSimon Marlow2016-07-222-0/+9
| | | | | | | | | | | | | | | | | | | | I needed to rnf a data structure (CompiledByteCode) but we don't have any good deepseq infrastructure in the compiler yet. There are bits and pieces, but nothing consistent, so this is a start. We already had a dependency on deepseq indirectly via other packages (e.g. containers). Includes an update to the haddock submodule, to remove orphan NFData instances in there. Test Plan: validate Reviewers: austin, bgamari, erikd, hvr Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2418
* Have addModFinalizer expose the local type environment.Facundo Domínguez2016-07-062-26/+28
| | | | | | | | | | | | | | | | | | | | | | Summary: This annotates the splice point with 'HsSpliced ref e' where 'e' is the result of the splice. 'ref' is a reference that the typechecker will fill with the local type environment. The finalizer then reads the ref and uses the local type environment, which causes 'reify' to find local variables when run in the finalizer. Test Plan: ./validate Reviewers: simonpj, simonmar, bgamari, austin, goldfire Reviewed By: goldfire Subscribers: simonmar, thomie, mboes Differential Revision: https://phabricator.haskell.org/D2286 GHC Trac Issues: #11832
* Remote GHCi: comments onlySimon Marlow2016-06-245-4/+125
| | | | | | | | | | | | Summary: Add more Notes and signposts across the codebase to help navigation. Test Plan: validate Reviewers: goldfire, simonpj, austin, ezyang, hvr, bgamari, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2358
* Remote GHCi: separate out message typesSimon Marlow2016-06-242-77/+106
| | | | | | | | | | | | | | | | | Summary: From a suggestion by @goldfire: clean up the message types, so that rather than one Message type with all the messages, we have a separate THMessage type for messages sent back to GHC during TH execution. At the same time I also removed the QDone/QFailed/QException messages into their own type, and made the result type of RunTH more accurate. Test Plan: validate Reviewers: goldfire, ezyang, austin, niteria, bgamari, erikd Subscribers: thomie, goldfire Differential Revision: https://phabricator.haskell.org/D2356
* Remove 'deriving Typeable' statementsRyan Scott2016-05-241-1/+1
| | | | | | | | | | | | | | | | | Summary: Deriving `Typeable` has been a no-op since GHC 7.10, and now that we require 7.10+ to build GHC, we can remove all the redundant `deriving Typeable` statements in GHC. Test Plan: ./validate Reviewers: goldfire, austin, hvr, bgamari Reviewed By: austin, hvr, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2260
* Delete libraries/ghci/GNUmakefile [skip ci]Thomas Miedema2016-05-171-4/+0
| | | | | This file should not have been included in the repository, as it is generated by `./boot`.
* Add TH support for pattern synonyms (fixes #8761)Dominik Bollmann2016-05-121-0/+2
| | | | | | | | | | | | | | | | | | This commit adds Template Haskell support for pattern synonyms as requested by trac ticket #8761. Test Plan: ./validate Reviewers: thomie, jstolarek, osa1, RyanGlScott, mpickering, austin, goldfire, bgamari Reviewed By: goldfire, bgamari Subscribers: rdragon Differential Revision: https://phabricator.haskell.org/D1940 GHC Trac Issues: #8761
* Add TemplateHaskell support for Overlapping pragmasIavor S. Diatchki2016-04-171-0/+1
| | | | | | | | | | Reviewers: hvr, goldfire, austin, RyanGlScott, bgamari Reviewed By: RyanGlScott, bgamari Subscribers: RyanGlScott, thomie Differential Revision: https://phabricator.haskell.org/D2118
* template-haskell: define `MonadFail Q` instanceHerbert Valerio Riedel2016-03-081-0/+4
| | | | | | | | | | | | | | | | When `MonadFail`is available, this patch makes `MonadFail` a superclass of `Quasi`, and `Q` an instance of `MonadFail`. NB: Since f16ddcee0c64a92ab911a7841a8cf64e3ac671fd, we need to be able to compile `template-haskell` with stage0 compilers that don't provide a `MonadFail` class yet. Once we reach GHC 8.3 development we can drop the CPP conditionals again. Addresses #11661 Reviewed By: bgamari, goldfire Differential Revision: https://phabricator.haskell.org/D1982
* Fix a double-free bug in -fexternal-interpreterSimon Marlow2016-02-201-1/+0
| | | | | | | Originally I planned to make this reference manually managed, but it looks like at some point I gave it a finalizer on the GHC side, but forgot to remove the manual free here. The result is that ghc-iserv could crash in getStablePtr sometimes when using TH.
* Remote GHCi: parallelise BCO serializationSimon Marlow2016-02-022-3/+4
| | | | | | | | | | | | | | | | | | | Summary: Serialization of BCOs is slow, but we can parallelise it when using ghci -j<n>. It parallelises nicely, saving multiple seconds off the link time in a large example I have. Test Plan: * validate * `ghci -fexternal-interpreter` in `nofib/real/anna` Reviewers: niteria, bgamari, ezyang, austin, hvr, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1877 GHC Trac Issues: #11100
* Remote GHCi: batch the creation of stringsSimon Marlow2016-02-023-73/+90
| | | | | | | | | | | | | | | | | | Summary: This makes a big performance difference especially when loading a large number of modules and using parallel compilation (ghci -jN). Test Plan: * validate * `ghci -fexternal-interpreter` in `nofib/real/anna` Reviewers: niteria, bgamari, ezyang, austin, hvr, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1876 GHC Trac Issues: #11100
* Remote GHCi: Optimize the serialization/deserialization of byte codeSimon Marlow2016-02-021-10/+54
| | | | | | | | | | | | | | | | Summary: This cuts allocations by about a quarter. Test Plan: * validate * `ghci -fexternal-interpreter` in `nofib/real/anna` Reviewers: niteria, bgamari, ezyang, austin, hvr, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1875 GHC Trac Issues: #11100
* Remote GHCi: create cost centre stacks in batchesSimon Marlow2016-01-272-17/+18
| | | | | | Towards optimising the binary serialisation that -fexternal-interpreter does, this saves quite a bit of time when using -fexternal-interpreter with -prof.
* A little closer to supporting breakpoints with -fexternal-interpreterSimon Marlow2016-01-132-44/+66
| | | | | | | | | | | | | | Summary: Moves getIdValFromApStack to the server, and removes one use of wormhole. Test Plan: validate Reviewers: bgamari, niteria, austin, hvr, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1768 GHC Trac Issues: #11100
* fix typo causing compilation failure on SPARC (ArchSparc -> ArchSPARC)Karel Gardas2016-01-121-1/+1
|
* Fix Template Haskell's handling of infix GADT constructorsRyanGlScott2016-01-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the second (and hopefully last) fix needed to make TH handle GADTs properly (after D1465). This Diff addresses some issues with infix GADT constructors, specifically: * Before, you could not determine if a GADT constructor was declared infix because TH did not give you the ability to determine if there is a //user-specified// fixity declaration for that constructor. The return type of `reifyFixity` was changed to `Maybe Fixity` so that it yields `Just` the fixity is there is a fixity declaration, and `Nothing` otherwise (indicating it has `defaultFixity`). * `DsMeta`/`Convert` were changed so that infix GADT constructors are turned into `GadtC`, not `InfixC` (which should be reserved for Haskell98 datatype declarations). * Some minor fixes to the TH pretty-printer so that infix GADT constructors will be parenthesized in GADT signatures. Fixes #11345. Test Plan: ./validate Reviewers: goldfire, austin, bgamari, jstolarek Reviewed By: jstolarek Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1744 GHC Trac Issues: #11345
* Support for qRecover in TH with -fexternal-interpreterSimon Marlow2016-01-082-22/+31
| | | | | | | | | | | | | | Summary: This completes the support for TH with -fexternal-interpreter. Test Plan: validate Reviewers: bgamari, ezyang, austin, niteria, goldfire, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1748 GHC Trac Issues: #11100
* Enable stack traces with ghci -fexternal-interpreter -profSimon Marlow2016-01-0811-185/+354
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The main goal here is enable stack traces in GHCi. After this change, if you start GHCi like this: ghci -fexternal-interpreter -prof (which requires packages to be built for profiling, but not GHC itself) then the interpreter manages cost-centre stacks during execution and can produce a stack trace on request. Call locations are available for all interpreted code, and any compiled code that was built with the `-fprof-auto` familiy of flags. There are a couple of ways to get a stack trace: * `error`/`undefined` automatically get one attached * `Debug.Trace.traceStack` can be used anywhere, and prints the current stack Because the interpreter is running in a separate process, only the interpreted code is running in profiled mode and the compiler itself isn't slowed down by profiling. The GHCi debugger still doesn't work with -fexternal-interpreter, although this patch gets it a step closer. Most of the functionality of breakpoints is implemented, but the runtime value introspection is still not supported. Along the way I also did some refactoring and added type arguments to the various remote pointer types in `GHCi.RemotePtr`, so there's better type safety and documentation in the bridge code between GHC and ghc-iserv. Test Plan: validate Reviewers: bgamari, ezyang, austin, hvr, goldfire, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1747 GHC Trac Issues: #11047, #11100
* Add Cabal synopses and descriptionsBen Gamari2016-01-051-2/+4
| | | | | | | | | | | | | | | | Various people (myself included) have complained about the lack of useful descriptions for the various packages included in GHC's source tree. Fix this. Test Plan: Validate Reviewers: austin, thomie Reviewed By: thomie Subscribers: angerman, ezyang Differential Revision: https://phabricator.haskell.org/D1736
* Remove some redundant definitions/constraintsHerbert Valerio Riedel2015-12-311-1/+0
| | | | | | Starting with GHC 7.10 and base-4.8, `Monad` implies `Applicative`, which allows to simplify some definitions to exploit the superclass relationship. This a first refactoring to that end.
* fix ghci build on ArchUnknown targetsSergei Trofimovich2015-12-311-3/+20
| | | | | | | | | | | | | | | Observed failure on ia64 as: "inplace/bin/hsc2hs" \ ... \ --cflag=-Dia64_HOST_ARCH=1 --cflag=-Dlinux_HOST_OS=1 \ ... \ libraries/ghci/./GHCi/InfoTable.hsc \ -o libraries/ghci/dist-install/build/GHCi/InfoTable.hs InfoTable.hsc:84:2: error: #error Unknown architecture Signed-off-by: Sergei Trofimovich <siarheit@google.com>
* Synchronise ghci-package version with ghc-packageHerbert Valerio Riedel2015-12-281-13/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | In order to simplify the task, the version munging logic has been radically simplified: Previously, in cases where the version contained dates as version components, the build-system would munge the version of the stage1 ghc package before registering the `ghc` package. However, this hack was already questionable at the time of its introduction (c.f. 7b45c46cbabe1288ea87bd9b94c57e010ed17e60). Simplifying the build-systems by avoiding such hacks may also help the shaking-up-ghc effort. So now we simply munge directly via the `.cabal` files, which gives a simpler picture, as now every stage is munged the same. Munging is only active when the first patch-level version component is a date. So stable snapshots and release candidates are unaffacted (as those have the date in the second patch-level version component) Reviewers: simonmar, bgamari, austin, thomie, ezyang Reviewed By: bgamari, thomie, ezyang Differential Revision: https://phabricator.haskell.org/D1673
* libraries/ghci: Implement mkJumpToAddr for ppc64Peter Trommler2015-12-271-1/+48
| | | | | | | | | | | | | | Test Plan: validated on powerpc64 and powerpc64le Reviewers: austin, erikd, simonmar, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1680 GHC Trac Issues: #11257
* Rework Template Haskell's handling of strictnessRyanGlScott2015-12-223-14/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, Template Haskell's treatment of strictness is not enough to cover all possible combinations of unpackedness and strictness. In addition, it isn't equipped to deal with new features (such as `-XStrictData`) which can change a datatype's fields' strictness during compilation. To address this, I replaced TH's `Strict` datatype with `SourceUnpackedness` and `SourceStrictness` (which give the programmer a more complete toolkit to configure a datatype field's strictness than just `IsStrict`, `IsLazy`, and `Unpack`). I also added the ability to reify a constructor fields' strictness post-compilation through the `reifyConStrictness` function. Fixes #10697. Test Plan: ./validate Reviewers: simonpj, goldfire, bgamari, austin Reviewed By: goldfire, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1603 GHC Trac Issues: #10697
* Maintain cost-centre stacks in the interpreterSimon Marlow2015-12-212-40/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Breakpoints become SCCs, so we have detailed call-stack info for interpreted code. Currently this only works when GHC is compiled with -prof, but D1562 (Remote GHCi) removes this constraint so that in the future call stacks will be available without building your own GHCi. How can you get a stack trace? * programmatically: GHC.Stack.currentCallStack * I've added an experimental :where command that shows the stack when stopped at a breakpoint * `error` attaches a call stack automatically, although since calls to `error` are often lifted out to the top level, this is less useful than it might be (ImplicitParams still works though). * Later we might attach call stacks to all exceptions Other related changes in this diff: * I reduced the number of places that get ticks attached for breakpoints. In particular there was a breakpoint around the whole declaration, which was often redundant because it bound no variables. This reduces clutter in the stack traces and speeds up compilation. * I tidied up some RealSrcSpan stuff in InteractiveUI, and made a few other small cleanups Test Plan: validate Reviewers: ezyang, bgamari, austin, hvr Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1595 GHC Trac Issues: #11047
* Fix two occurences of `x86_HOST_ARCH`Herbert Valerio Riedel2015-12-191-1/+1
| | | | | | | | | | | | | | | The proper name for the define is `i386_HOST_ARCH` One was introduced back in 2011 via 035b8ebb5405efbcbfd3474821a877add1feca1e / #4914 and the other one more recently via 4905b83a2d448c65ccced385343d4e8124548a3b We may want to add some validation to catch such typos early on... Reviewed By: erikd Differential Revision: https://phabricator.haskell.org/D1664
* First pass at cleaning up ghci.cabalHerbert Valerio Riedel2015-12-193-38/+67
| | | | This prepares the meta-data of the new `ghci` package for Hackage
* Build system: fix 'make sdist'Thomas Miedema2015-12-191-5/+0
| | | | | | This was broken in 4905b83a2d448c65ccced385343d4e8124548a3b. libraries/ghci/ghc.mk gets created by ./boot.
* Fix build for AArch64/Arm64Erik de Castro Lopo2015-12-191-0/+21
| | | | | | | | | | | | Test Plan: Build an AArch64 cross compiler. Reviewers: hvr, bgamari, austin Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1654
* GHCi.Run: Remove redundant language pragmaBen Gamari2015-12-181-2/+1
|
* Fix PowerPC buildErik de Castro Lopo2015-12-181-1/+1
| | | | | | | | | | | | | Summary: Replace incorrect `ppc_HOST_ARCH` with `powerpc_HOST_ARCH`. Test Plan: Build on PowerPC Reviewers: hvr, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1651
* ghci: fix UNREG build (missing fromJust import)Sergei Trofimovich2015-12-181-0/+3
| | | | | | | | | | | | | | | | | | libraries/ghci/GHCi/InfoTable.hsc:249:45: error: • Variable not in scope: fromJust :: Maybe EntryFunPtr -> a0 • Perhaps you meant ‘fromList’ (imported from GHC.Exts) Signed-off-by: Sergei Trofimovich <siarheit@google.com> Test Plan: build --enable-unregisterised ghc Reviewers: simonmar, bgamari, austin Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1649
* Random typo fixesHerbert Valerio Riedel2015-12-171-1/+1
| | | | [skip ci]
* Remote GHCi, -fexternal-interpreterSimon Marlow2015-12-1716-0/+2061
Summary: (Apologies for the size of this patch, I couldn't make a smaller one that was validate-clean and also made sense independently) (Some of this code is derived from GHCJS.) This commit adds support for running interpreted code (for GHCi and TemplateHaskell) in a separate process. The functionality is experimental, so for now it is off by default and enabled by the flag -fexternal-interpreter. Reaosns we want this: * compiling Template Haskell code with -prof does not require building the code without -prof first * when GHC itself is profiled, it can interpret unprofiled code, and the same applies to dynamic linking. We would no longer need to force -dynamic-too with TemplateHaskell, and we can load ordinary objects into a dynamically-linked GHCi (and vice versa). * An unprofiled GHCi can load and run profiled code, which means it can use the stack-trace functionality provided by profiling without taking the performance hit on the compiler that profiling would entail. Amongst other things; see https://ghc.haskell.org/trac/ghc/wiki/RemoteGHCi for more details. Notes on the implementation are in Note [Remote GHCi] in the new module compiler/ghci/GHCi.hs. It probably needs more documenting, feel free to suggest things I could elaborate on. Things that are not currently implemented for -fexternal-interpreter: * The GHCi debugger * :set prog, :set args in GHCi * `recover` in Template Haskell * Redirecting stdin/stdout for the external process These are all doable, I just wanted to get to a working validate-clean patch first. I also haven't done any benchmarking yet. I expect there to be slight hit to link times for byte code and some penalty due to having to serialize/deserialize TH syntax, but I don't expect it to be a serious problem. There's also lots of low-hanging fruit in the byte code generator/linker that we could exploit to speed things up. Test Plan: * validate * I've run parts of the test suite with EXTRA_HC_OPTS=-fexternal-interpreter, notably tests/ghci and tests/th. There are a few failures due to the things not currently implemented (see above). Reviewers: simonpj, goldfire, ezyang, austin, alanz, hvr, niteria, bgamari, gibiansky, luite Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1562