| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
Further work refactoring and enhancing GHCi will make it desirable to
split up GHCi's code-base into multiple modules with specific functions,
and rather than have several top-level 'Ghci*' modules, it's nicer to
have a common namespace. This commit is provides the basis for that.
Note that the remaining GHCi.* namespace belongs to the new `ghci`
package.
Differential Revision: https://phabricator.haskell.org/D1593
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This adds the new commands `:all-types`, `:loc-at`, `:type-at`, and
`:uses` designed for editor-integration (such as Emacs' `haskell-mode`).
This was originally implemented by Chris Done on
https://github.com/chrisdone/ghci-ng
and has been in use by Emacs' `haskell-mode` for over a year already,
and closely missed the GHC 7.10 release back then.
I've squashed the commits, rebased to GHC HEAD, and heavily refactored and
improved the patch.
Tests will be added in a separate commit.
Reviewed By: bgamari
Differential Revision: https://phabricator.haskell.org/D1240
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This transforms the 'Command' tuple into a record which is
easier to extend.
While at it, this refactoring turns the IDE `:complete` into a hidden
command excluded from completion.
The next obvious step is to add a summary text field for constructing
the `:help` output (as well as allowing to get `:help <CMD>` for single
commands.
This is a preparatory refactoring for D1240 / #10874
Reviewed By: thomie, bgamari
Differential Revision: https://phabricator.haskell.org/D1590
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This allows to reach the GhciState without having to keep
track how many Monad transformer layers sit on top of the
GHCi monad.
While at it, this also refactors code to make more use of the
existing `modifyGHCiState` operation.
This is a preparatory refactoring for #10874
Differential Revision: https://phabricator.haskell.org/D1582
|
|
|
|
|
|
|
| |
It makes little sense to have __GLASGOW_HASKELL__ conditional
code inside GHCi's source-code, as GHCi is only ever build
by the current stage1 GHC, whose version is assumed to be the
same as the GHCi version being built.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: austin, thomie, bgamari
Reviewed By: thomie, bgamari
Subscribers: mpickering, thomie
Differential Revision: https://phabricator.haskell.org/D1518
GHC Trac Issues: #9015
|
|
|
|
|
| |
This reverts commit 72e362076e7ce823678797a162d0645e088cd594 which was
accidentally merged.
|
|
|
|
|
| |
This is an updated version of @jlengyel's original patch adding support
for prompt functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch allows define and re-define functions in ghci. `let` is not
required anymore (but can be used).
Idea: If ghci input string can be parsed as statement then run it as
statement else run it as declaration.
Reviewers: mpickering, bgamari, austin
Reviewed By: mpickering, bgamari, austin
Subscribers: hvr, mpickering, dterei, thomie
Differential Revision: https://phabricator.haskell.org/D1299
GHC Trac Issues: #7253
|
|
|
|
|
| |
As GHCi is compiled by stage1+ GHC only, we can
drop the explicit `return` definition rightaway.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The point of this commit is to make the memory allocation statistic
from :set +s in GHCi a lot more accurate. Currently it uses the total
allocation figure calculated by the RTS, which is only updated during
GC, so can be wrong by an arbitrary amount. The fix is to the the
per-thread allocation counter that was introduced for allocation
limits.
This required changes to the GHC API, because we now have to return
the allocation value from each evaluation. Rather than just change
the API, I introduced a new API and deprecated the old one. The new
one is simpler and more extensible, so hopefully we won't need to make
this transition in the future. See GHC.hs for details.
|
|
|
|
|
|
| |
[skip ci]
Differential Revision: https://phabricator.haskell.org/D812
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Note: This commit includes an API change to GhciMonad.runDecls
to allow the caller to determine whether the declarations were
run successfully or not.
Test Plan: harbormaster
Reviewers: austin
Reviewed By: austin
Subscribers: carter, thomie
Differential Revision: https://phabricator.haskell.org/D582
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Some Trues and Falses were mixed up due to Bool being used in
different senses in different parts of GHCi.
Test Plan: harbormaster; validate
Reviewers: austin
Reviewed By: austin
Subscribers: carter, thomie
Differential Revision: https://phabricator.haskell.org/D581
GHC Trac Issues: #9905
Conflicts:
ghc/InteractiveUI.hs
|
|
|
|
|
|
|
| |
This reverts commit 35672072b4091d6f0031417bc160c568f22d0469.
Conflicts:
compiler/main/DriverPipeline.hs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
In preparation for indirecting all references to closures,
we rename _closure to _static_closure to ensure any old code
will get an undefined symbol error. In order to reference
a closure foobar_closure (which is now undefined), you should instead
use STATIC_CLOSURE(foobar). For convenience, a number of these
old identifiers are macro'd.
Across C-- and C (Windows and otherwise), there were differing
conventions on whether or not foobar_closure or &foobar_closure
was the address of the closure. Now, all foobar_closure references
are addresses, and no & is necessary.
CHARLIKE/INTLIKE were not changed, simply alpha-renamed.
Part of remove HEAP_ALLOCED patch set (#8199)
Depends on D265
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Test Plan: validate
Reviewers: simonmar, austin
Subscribers: simonmar, ezyang, carter, thomie
Differential Revision: https://phabricator.haskell.org/D267
GHC Trac Issues: #8199
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This includes pretty much all the changes needed to make `Applicative`
a superclass of `Monad` finally. There's mostly reshuffling in the
interests of avoid orphans and boot files, but luckily we can resolve
all of them, pretty much. The only catch was that
Alternative/MonadPlus also had to go into Prelude to avoid this.
As a result, we must update the hsc2hs and haddock submodules.
Signed-off-by: Austin Seipp <austin@well-typed.com>
Test Plan: Build things, they might not explode horribly.
Reviewers: hvr, simonmar
Subscribers: simonmar
Differential Revision: https://phabricator.haskell.org/D13
|
| |
|
|
|
|
|
|
|
| |
This replaces the previous `default-extensions` by per-file declared
`{-# LANGUAGE ... #-}` pragmas.
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
|
|
|
|
|
|
|
|
| |
When printing allocated bytes (`:set +s` in ghci), separate thousands
to make it easier to read large allocations sizes, e.g. “1,200,000
bytes”.
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
| |
Authored-by: David Luposchainsky <dluposchainsky@gmail.com>
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
| |
- Remove unused property `def_prompt`.
|
| |
|
|
|
|
|
| |
This means that we can use the standard MonadIO class, rather than
needing our own copy.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
This means we no longer need mtl in a GHC tree.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GHCi now maintains two DynFlags: one that applies to whole modules
loaded with :load, and one that applies to things typed at the prompt
(expressions, statements, declarations, commands).
The :set command modifies both DynFlags. This is for backwards
compatibility: users won't notice any difference.
The :seti command applies only to the interactive DynFlags.
Additionally, I made a few changes to ":set" (with no arguments):
* Now it only prints out options that differ from the defaults,
rather than the whole list.
* There is a new variant, ":set -a" to print out all options (the
old behaviour).
* It also prints out language options.
e.g.
Prelude> :set
options currently set: none.
base language is: Haskell2010
with the following modifiers:
-XNoDatatypeContexts
-XNondecreasingIndentation
GHCi-specific dynamic flag settings:
other dynamic, non-language, flag settings:
-fimplicit-import-qualified
warning settings:
":seti" (with no arguments) does the same as ":set", but for the
interactive options. It also has the "-a" option.
The interactive DynFlags are kept in the InteractiveContext, and
copied into the HscEnv at the appropriate points (all in HscMain).
There are some new GHC API operations:
-- | Set the 'DynFlags' used to evaluate interactive expressions.
setInteractiveDynFlags :: GhcMonad m => DynFlags -> m ()
-- | Get the 'DynFlags' used to evaluate interactive expressions.
getInteractiveDynFlags :: GhcMonad m => m DynFlags
-- | Sets the program 'DynFlags'.
setProgramDynFlags :: GhcMonad m => DynFlags -> m [PackageId]
-- | Returns the program 'DynFlags'.
getProgramDynFlags :: GhcMonad m => m DynFlags
Note I have not completed the whole of the plan outlined in #3217 yet:
when in the context of a loaded module we don't take the interactive
DynFlags from that module. That needs some more refactoring and
thinking about, because we'll need to save and restore the original
interactive DynFlags.
This solves the immediate problem that people are having with the new
flag checking in 7.4.1, because now it is possible to set language
options in ~/.ghci that do not affect loaded modules and thereby cause
recompilation.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
We no longer have many separate, clashing getDynFlags functions
I've given each GhcMonad its own HasDynFlags instance, rather than
using UndecidableInstances to make a GhcMonad m => HasDynFlags m
instance.
|
|
|
|
|
| |
We only use it for "compiler" sources, i.e. not for libraries.
Many modules have a -fno-warn-tabs kludge for now.
|
|
|
|
|
| |
Also removed the type argument to Any in primops.txt.pp. I don't
see why we need it, and it now breaks haddocking GHC.Prim.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously we remembered the whole history of commands and replayed
them on every :load/:reload, which lead to some non-linear performance
characteristics (#5317). The handling of the implicit Prelude import
and the implicit imports of recently loaded modules was also
complicated and wrong in various obscure ways.
The Prelude import works just like the implicit Prelude import in a
Haskell module: it can be overriden with an explicit Prelude
import.
I have added a new ":show imports" command to show which imports are
currently in force.
Prelude> :show imports
import Prelude -- implicit
Prelude> import Prelude ()
Prelude> :show imports
import Prelude ()
Prelude> map
<interactive>:0:1: Not in scope: `map'
Prelude>
Full documentation in the User's Guide.
There are various other little tweaks and improvements, such as when a
module is imported with 'as', we now show the 'as' name in the prompt
rather than the original name.
|
|
|
|
|
|
| |
was [(Module, Maybe ImportDecl)], now it is just [ImportDecl]. So now
":m +A" and "import A" do exactly the same thing in GHCi, and use the
same code paths.
|
|
|
|
|
|
|
|
|
| |
This patch adds the script command in GHCi
A file is read and executed as a series of GHCi commands.
Execution terminates on the first error. The filename and
line number are included in the error.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds support for multiline commands in GHCi.
The first line of input is lexed. If there is an active
layout context once the lexer reaches the end of file, the
user is prompted for more input.
Multiline input is exited by an empty line and can be escaped
with a user interrupt.
Multiline mode is toggled with `:set +m`
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While trying to fix #1666 (-Werror aborts too early) I decided to some
tidyup in GHC/DriverPipeline/HscMain.
- The GhcMonad overloading is gone from DriverPipeline and HscMain
now. GhcMonad is now defined in a module of its own, and only
used in the top-level GHC layer. DriverPipeline and HscMain
use the plain IO monad and take HscEnv as an argument.
- WarnLogMonad is gone. printExceptionAndWarnings is now called
printException (the old name is deprecated). Session no longer
contains warnings.
- HscMain has its own little monad that collects warnings, and also
plumbs HscEnv around. The idea here is that warnings are collected
while we're in HscMain, but on exit from HscMain (any function) we
check for warnings and either print them (via log_action, so IDEs
can still override the printing), or turn them into an error if
-Werror is on.
- GhcApiCallbacks is gone, along with GHC.loadWithLogger. Thomas
Schilling told me he wasn't using these, and I don't see a good
reason to have them.
- there's a new pure API to the parser (suggestion from Neil Mitchell):
parser :: String
-> DynFlags
-> FilePath
-> Either ErrorMessages (WarningMessages,
Located (HsModule RdrName))
|
| |
|
| |
|