[Git][ghc/ghc][wip/24327] 2 commits: GHCi: Lookup breakpoint CCs in the correct module

Zubin (@wz1000) gitlab at gitlab.haskell.org
Wed Jan 17 14:47:15 UTC 2024



Zubin pushed to branch wip/24327 at Glasgow Haskell Compiler / GHC


Commits:
736086dc by Zubin Duggal at 2024-01-11T16:51:47+05:30
GHCi: Lookup breakpoint CCs in the correct module

We need to look up breakpoint CCs in the module that the breakpoint
points to, and not the current module.

Fixes #24327

- - - - -
18586dbf by Zubin Duggal at 2024-01-17T19:51:53+05:30
testsuite: Add test for #24327

- - - - -


4 changed files:

- compiler/GHC/StgToByteCode.hs
- + testsuite/tests/ghci/T24327/T24327A.hs
- + testsuite/tests/ghci/T24327/T24327B.hs
- + testsuite/tests/ghci/T24327/all.T


Changes:

=====================================
compiler/GHC/StgToByteCode.hs
=====================================
@@ -86,7 +86,6 @@ import qualified Data.Map as Map
 import qualified Data.IntMap as IntMap
 import qualified GHC.Data.FiniteMap as Map
 import Data.Ord
-import GHC.Stack.CCS
 import Data.Either ( partitionEithers )
 
 import GHC.Stg.Syntax
@@ -391,8 +390,7 @@ schemeER_wrk d p (StgTick (Breakpoint tick_ty tick_no fvs mod) rhs) = do
   current_mod_breaks <- getCurrentModBreaks
   case break_info hsc_env mod current_mod current_mod_breaks of
     Nothing -> pure code
-    Just ModBreaks {modBreaks_flags = breaks, modBreaks_module = mod_ptr} -> do
-      cc_arr <- getCCArray
+    Just ModBreaks {modBreaks_flags = breaks, modBreaks_module = mod_ptr, modBreaks_ccs = cc_arr} -> do
       platform <- profilePlatform <$> getProfile
       let idOffSets = getVarOffSets platform d p fvs
           ty_vars   = tyCoVarsOfTypesWellScoped (tick_ty:map idType fvs)
@@ -2260,12 +2258,6 @@ getLabelsBc n
   = BcM $ \st -> let ctr = nextlabel st
                  in return (st{nextlabel = ctr+n}, coerce [ctr .. ctr+n-1])
 
-getCCArray :: BcM (Array BreakIndex (RemotePtr CostCentre))
-getCCArray = BcM $ \st ->
-  let breaks = expectJust "GHC.StgToByteCode.getCCArray" $ modBreaks st in
-  return (st, modBreaks_ccs breaks)
-
-
 newBreakInfo :: BreakIndex -> CgBreakInfo -> BcM ()
 newBreakInfo ix info = BcM $ \st ->
   return (st{breakInfo = IntMap.insert ix info (breakInfo st)}, ())


=====================================
testsuite/tests/ghci/T24327/T24327A.hs
=====================================
@@ -0,0 +1,10 @@
+module T24327A where
+
+{-# INLINE foo1 #-}
+foo1 :: Char -> Int -> Int
+foo1 _  y = bar1 y
+
+{-# INLINE bar1 #-}
+bar1 :: Int -> Int
+bar1 x = length [1..10] + x
+


=====================================
testsuite/tests/ghci/T24327/T24327B.hs
=====================================
@@ -0,0 +1,6 @@
+module T24327B where
+import T24327A
+
+bar :: Int
+bar = foo1 'a' 1
+


=====================================
testsuite/tests/ghci/T24327/all.T
=====================================
@@ -0,0 +1 @@
+test('T24327', [only_ways(['ghci-ext-prof']), extra_files(['T24327A.hs', 'T24327B.hs'])], compile, ['-fno-unoptimized-core-for-interpreter', '-O1'])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/424af57adf2fa61f51df7ebb7839a37ed8b15c65...18586dbfa683a2e99ee7da3e7061d6ba01586a7d

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/424af57adf2fa61f51df7ebb7839a37ed8b15c65...18586dbfa683a2e99ee7da3e7061d6ba01586a7d
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240117/024cbdf1/attachment-0001.html>


More information about the ghc-commits mailing list