diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2021-02-24 10:45:58 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-03-03 08:12:42 -0500 |
commit | 3f9af89128988652f024b142e3feb6216fa88b30 (patch) | |
tree | e7caced4f4e450442c3a2caab6b8cd33a09a11ff /ghc | |
parent | 3630b9baa3887a5bf5cb3ba12e48301fe6cce173 (diff) | |
download | haskell-3f9af89128988652f024b142e3feb6216fa88b30.tar.gz |
Add a flag to dump the FastString table
Diffstat (limited to 'ghc')
-rw-r--r-- | ghc/Main.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ghc/Main.hs b/ghc/Main.hs index 2626d78924..e09242b5ad 100644 --- a/ghc/Main.hs +++ b/ghc/Main.hs @@ -757,9 +757,16 @@ showUsage ghci dflags = do dump (c:s) = putChar c >> dump s dumpFinalStats :: Logger -> DynFlags -> IO () -dumpFinalStats logger dflags = +dumpFinalStats logger dflags = do when (gopt Opt_D_faststring_stats dflags) $ dumpFastStringStats logger dflags + when (dopt Opt_D_dump_faststrings dflags) $ do + fss <- getFastStringTable + let ppr_table = fmap ppr_segment (fss `zip` [0..]) + ppr_segment (s,n) = hang (text "Segment" <+> int n) 2 (vcat (fmap ppr_bucket (s `zip` [0..]))) + ppr_bucket (b,n) = hang (text "Bucket" <+> int n) 2 (vcat (fmap ftext b)) + dumpIfSet_dyn logger dflags Opt_D_dump_faststrings "FastStrings" FormatText (vcat ppr_table) + dumpFastStringStats :: Logger -> DynFlags -> IO () dumpFastStringStats logger dflags = do segments <- getFastStringTable |