summaryrefslogtreecommitdiff
path: root/compiler/GHC/CoreToByteCode.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-03-05 18:25:55 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-03-11 20:33:37 -0400
commitbc41e47123b205a45385a3aa69de97ce22686423 (patch)
treec36b02eb7ec07c9a8ca661c4fae13d81fb3f2d46 /compiler/GHC/CoreToByteCode.hs
parent8e6febcee4b91a88a5027baac4bee5a8847fe79b (diff)
downloadhaskell-bc41e47123b205a45385a3aa69de97ce22686423.tar.gz
Refactor interpreterDynamic and interpreterProfiled
* `interpreterDynamic` and `interpreterProfiled` now take `Interp` parameters instead of DynFlags * slight refactoring of `ExternalInterp` so that we can read the iserv configuration (which is pure) without reading an MVar.
Diffstat (limited to 'compiler/GHC/CoreToByteCode.hs')
-rw-r--r--compiler/GHC/CoreToByteCode.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler/GHC/CoreToByteCode.hs b/compiler/GHC/CoreToByteCode.hs
index 241066c2b3..7285f192ce 100644
--- a/compiler/GHC/CoreToByteCode.hs
+++ b/compiler/GHC/CoreToByteCode.hs
@@ -19,12 +19,10 @@ import GHC.ByteCode.Asm
import GHC.ByteCode.Types
import GHC.Runtime.Interpreter
-import GHC.Runtime.Interpreter.Types
import GHCi.FFI
import GHCi.RemoteTypes
import BasicTypes
import GHC.Driver.Session
-import GHC.Driver.Ways
import Outputable
import GHC.Platform
import Name
@@ -418,8 +416,10 @@ schemeER_wrk d p rhs
, cgb_resty = exprType (deAnnotate' newRhs)
}
newBreakInfo tick_no breakInfo
- dflags <- getDynFlags
- let cc | interpreterProfiled dflags = cc_arr ! tick_no
+ hsc_env <- getHscEnv
+ let cc | Just interp <- hsc_interp hsc_env
+ , interpreterProfiled interp
+ = cc_arr ! tick_no
| otherwise = toRemotePtr nullPtr
let breakInstr = BRK_FUN (fromIntegral tick_no) (getUnique this_mod) cc
return $ breakInstr `consOL` code
@@ -996,8 +996,9 @@ doCase d s p (_,scrut) bndr alts is_unboxed_tuple
hsc_env <- getHscEnv
let
profiling
- | Just (ExternalInterp _) <- hsc_interp hsc_env = gopt Opt_SccProfilingOn dflags
- | otherwise = hostIsProfiled
+ | Just interp <- hsc_interp hsc_env
+ = interpreterProfiled interp
+ | otherwise = False
-- Top of stack is the return itbl, as usual.
-- underneath it is the pointer to the alt_code BCO.