[commit: ghc] master: Make parsed AST dump output lazily (29da01e)
git at git.haskell.org
git at git.haskell.org
Tue Aug 29 03:31:16 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/29da01e0a023eea4bbbfd69dd5d854db721233e6/ghc
>---------------------------------------------------------------
commit 29da01e0a023eea4bbbfd69dd5d854db721233e6
Author: David Feuer <david.feuer at gmail.com>
Date: Mon Aug 28 23:28:08 2017 -0400
Make parsed AST dump output lazily
Previously, `showAstData` produced a `String`. That `String` would
then be converted to a `Doc` using `text` to implement
`-ddump-parsed-ast`. But rendering `text` calculates the length
of the `String` before doing anything else. Since the AST can be
very large, this was bad: the whole dump string (potentially hundreds
of millions of `Char`s) was accumulated in memory.
Now, `showAstData` produces a `Doc` directly, which seems to work
a lot better. As an extra bonus, the code is simpler and cleaner.
The formatting has changed a bit, as the previous ad hoc approach
didn't really match the pretty printer too well. If someone cares
enough to request adjustments, we can surely make them.
Reviewers: austin, bgamari, mpickering, alanz
Reviewed By: bgamari
Subscribers: mpickering, rwbarton, thomie
GHC Trac Issues: #14161
Differential Revision: https://phabricator.haskell.org/D3894
>---------------------------------------------------------------
29da01e0a023eea4bbbfd69dd5d854db721233e6
compiler/hsSyn/HsDumpAst.hs | 160 +++---
compiler/main/HscMain.hs | 4 +-
compiler/typecheck/TcRnDriver.hs | 4 +-
.../parser/should_compile/DumpParsedAst.stderr | 137 ++---
.../parser/should_compile/DumpRenamedAst.stderr | 189 +++----
.../should_compile/DumpTypecheckedAst.stderr | 550 +++++++++++----------
utils/check-ppr/Main.hs | 7 +-
7 files changed, 540 insertions(+), 511 deletions(-)
Diff suppressed because of size. To see it, use:
git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 29da01e0a023eea4bbbfd69dd5d854db721233e6
More information about the ghc-commits
mailing list