Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex D
GHC
Commits
34393d99
Commit
34393d99
authored
Dec 18, 2015
by
Simon Marlow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Documentation for -fexternal-interpreter
parent
dc8b6474
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
2 deletions
+77
-2
docs/users_guide/7.12.1-notes.rst
docs/users_guide/7.12.1-notes.rst
+4
-0
docs/users_guide/ghci.rst
docs/users_guide/ghci.rst
+41
-0
docs/users_guide/glasgow_exts.rst
docs/users_guide/glasgow_exts.rst
+13
-2
docs/users_guide/phases.rst
docs/users_guide/phases.rst
+19
-0
No files found.
docs/users_guide/7.12.1-notes.rst
View file @
34393d99
...
...
@@ -40,6 +40,10 @@ The highlights, since the 7.10 branch, are:
- A rewritten (and greatly improved) pattern exhaustiveness checker
- GHC can run the interpreter in a separate process (see
:ref:`external-interpreter`), and the interpreter can now run profiled
code.
- The reworked users guide you are now reading
...
...
docs/users_guide/ghci.rst
View file @
34393d99
...
...
@@ -2938,6 +2938,47 @@ breakpoints in object-code modules, for example. Only the exports of an
object-code module will be visible in GHCi, rather than all top-level
bindings as in interpreted modules.
.. _external-interpreter:
Running the interpreter in a separate process
---------------------------------------------
Normally GHCi runs the interpreted code in the same process as GHC
itself, on top of the same RTS and sharing the same heap. However, if
the flag ``-fexternal-interpreter`` is given, then GHC will spawn a
separate process for running interpreted code, and communicate with it
using messages over a pipe.
``-fexternal-interpreter``
.. index::
single: -fexternal-interpreter
Run interpreted code (for GHCi, Template Haskell, Quasi-quoting,
or Annotations) in a separate process. The interpreter will run
in profiling mode if ``-prof`` is in effect, and in
dynamically-linked mode if ``-dynamic`` is in effect.
There are a couple of caveats that will hopefully be removed in
the future: this option is currently not implemented on Windows
(it is a no-op), and the external interpreter does not support the
GHCi debugger, so breakpoints and single-stepping don't work with
``-fexternal-interpreter``.
See also the ``-pgmi`` (:ref:`replacing-phases`) and ``-opti``
(:ref:`forcing-options-through`) flags.
Why might we want to do this? The main reason is that the RTS running
the interpreted code can be a different flavour (profiling or
dynamically-linked) from GHC itself. So for example, when compiling
Template Haskell code with ``-prof``, we don't need to compile the
modules without ``-prof`` first (see :ref:`th-profiling`) because we
can run the profiled object code in the interpreter. GHCi can also
load and run profiled object code when run with
``-fexternal-interpreter`` and ``-prof``.
This feature is experimental in GHC 8.0.x, but it may become the
default in future releases.
.. _ghci-faq:
FAQ and Things To Watch Out For
...
...
docs/users_guide/glasgow_exts.rst
View file @
34393d99
...
...
@@ -10097,6 +10097,8 @@ Run "main.exe" and here is your output:
$
./
main
Hello
..
_th
-
profiling
:
Using
Template
Haskell
with
Profiling
-------------------------------------
...
...
@@ -10116,9 +10118,11 @@ runtime.
This causes difficulties if you have a multi-module program containing
Template Haskell code and you need to compile it for profiling, because
GHC cannot load the profiled object code and use it when executing the
splices. Fortunately GHC provides a workaround. The basic idea is to
compile the program twice:
splices.
Fortunately GHC provides two workarounds.
The first option is to compile the program twice:
1. Compile the program or library first the normal way, without ``-prof``.
...
...
@@ -10136,6 +10140,13 @@ compile the program twice:
..
index
::
single
:
``-
osuf
``
The
second
option
is
to
add
the
flag
``-
fexternal
-
interpreter
``
(
see
:
ref
:`
external
-
interpreter
`),
which
runs
the
interpreter
in
a
separate
process
,
wherein
it
can
load
and
run
the
profiled
code
directly
.
There
's no need to compile the code twice, just add
``-fexternal-interpreter`` and it should just work. (this option is
experimental in GHC 8.0.x, but it may become the default in future
releases).
.. _th-quasiquotation:
...
...
docs/users_guide/phases.rst
View file @
34393d99
...
...
@@ -92,6 +92,15 @@ given compilation phase:
Use
⟨
cmd
⟩
as
the
libtool
command
(
when
using
``-
staticlib
``
only
).
``-
pgmi
⟨
cmd
⟩
``
..
index
::
single
:
-
pgmi
Use
⟨
cmd
⟩
as
the
external
interpreter
command
(
see
:
:
ref
:`
external
-
interpreter
`).
Default
:
``
ghc
-
iserv
-
prof
``
if
``-
prof
``
is
enabled
,
``
ghc
-
iserv
-
dyn
``
if
``-
dynamic
``
is
enabled
,
or
``
ghc
-
iserv
``
otherwise
.
..
_forcing
-
options
-
through
:
Forcing
options
to
a
particular
phase
...
...
@@ -165,6 +174,16 @@ the following flags:
Pass
⟨
option
⟩
to
``
windres
``
when
embedding
manifests
on
Windows
.
See
``-
fno
-
embed
-
manifest
``
in
:
ref
:`
options
-
linker
`.
``-
opti
⟨
option
⟩
``
..
index
::
single
:
-
opti
Pass
⟨
option
⟩
to
the
interpreter
sub
-
process
(
see
:
ref
:`
external
-
interpreter
`).
A
common
use
for
this
is
to
pass
RTS
options
e
.
g
.,
``-
opti
+
RTS
-
opti
-
A64m
``,
or
to
enable
verbosity
with
``-
opti
-
v
``
to
see
what
messages
are
being
exchanged
by
GHC
and
the
interpreter
.
So
,
for
example
,
to
force
an
``-
Ewurble
``
option
to
the
assembler
,
you
would
tell
the
driver
``-
opta
-
Ewurble
``
(
the
dash
before
the
E
is
required
).
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment