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
9fa9dd77
Commit
9fa9dd77
authored
Feb 15, 2012
by
Simon Marlow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #5534 (ghci -fobject-code strangeness)
parent
7bfb7bfc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
4 deletions
+27
-4
compiler/deSugar/Desugar.lhs
compiler/deSugar/Desugar.lhs
+2
-2
compiler/iface/MkIface.lhs
compiler/iface/MkIface.lhs
+13
-2
compiler/main/DynFlags.hs
compiler/main/DynFlags.hs
+12
-0
No files found.
compiler/deSugar/Desugar.lhs
View file @
9fa9dd77
...
...
@@ -300,8 +300,8 @@ addExportFlagsAndRules target exports keep_alive rules prs
-- isExternalName separates the user-defined top-level names from those
-- introduced by the type checker.
is_exported :: Name -> Bool
is_exported | target
== HscInterpreted
= isExternalName
| otherwise
= (`elemNameSet` exports)
is_exported | target
RetainsAllBindings target
= isExternalName
| otherwise
= (`elemNameSet` exports)
\end{code}
...
...
compiler/iface/MkIface.lhs
View file @
9fa9dd77
...
...
@@ -287,7 +287,7 @@ mkIface_ hsc_env maybe_old_fingerprint
mi_fixities = fixities,
mi_warns = warns,
mi_anns = mkIfaceAnnotations anns,
mi_globals =
Just
rdr_env,
mi_globals =
maybeGlobalRdrEnv
rdr_env,
-- Left out deliberately: filled in by addFingerprints
mi_iface_hash = fingerprint0,
...
...
@@ -344,7 +344,7 @@ mkIface_ hsc_env maybe_old_fingerprint
-- correctly. This stems from the fact that the interface had
-- not changed, so addFingerprints returns the old ModIface
-- with the old GlobalRdrEnv (mi_globals).
; let final_iface = new_iface{ mi_globals =
Just
rdr_env }
; let final_iface = new_iface{ mi_globals =
maybeGlobalRdrEnv
rdr_env }
; return (errs_and_warns, Just (final_iface, no_change_at_all)) }}
where
...
...
@@ -359,6 +359,17 @@ mkIface_ hsc_env maybe_old_fingerprint
dflags = hsc_dflags hsc_env
-- We only fill in mi_globals if the module was compiled to byte
-- code. Otherwise, the compiler may not have retained all the
-- top-level bindings and they won't be in the TypeEnv (see
-- Desugar.addExportFlagsAndRules). The mi_globals field is used
-- by GHCi to decide whether the module has its full top-level
-- scope available.
maybeGlobalRdrEnv :: GlobalRdrEnv -> Maybe GlobalRdrEnv
maybeGlobalRdrEnv rdr_env
| targetRetainsAllBindings (hscTarget dflags) = Just rdr_env
| otherwise = Nothing
deliberatelyOmitted :: String -> a
deliberatelyOmitted x = panic ("Deliberately omitted: " ++ x)
...
...
compiler/main/DynFlags.hs
View file @
9fa9dd77
...
...
@@ -32,6 +32,7 @@ module DynFlags (
HasDynFlags
(
..
),
ContainsDynFlags
(
..
),
RtsOptsEnabled
(
..
),
HscTarget
(
..
),
isObjectTarget
,
defaultObjectTarget
,
targetRetainsAllBindings
,
GhcMode
(
..
),
isOneShot
,
GhcLink
(
..
),
isNoLink
,
PackageFlag
(
..
),
...
...
@@ -753,6 +754,17 @@ isObjectTarget HscAsm = True
isObjectTarget
HscLlvm
=
True
isObjectTarget
_
=
False
-- | Does this target retain *all* top-level bindings for a module,
-- rather than just the exported bindings, in the TypeEnv and compiled
-- code (if any)? In interpreted mode we do this, so that GHCi can
-- call functions inside a module. In HscNothing mode we also do it,
-- so that Haddock can get access to the GlobalRdrEnv for a module
-- after typechecking it.
targetRetainsAllBindings
::
HscTarget
->
Bool
targetRetainsAllBindings
HscInterpreted
=
True
targetRetainsAllBindings
HscNothing
=
True
targetRetainsAllBindings
_
=
False
-- | The 'GhcMode' tells us whether we're doing multi-module
-- compilation (controlled via the "GHC" API) or one-shot
-- (single-module) compilation. This makes a difference primarily to
...
...
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