[GHC] #11676: Preserve name of original function in worker name
#11676: Preserve name of original function in worker name -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: feature | Status: new request | Priority: low | Milestone: Component: Compiler | Version: 7.10.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Other Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Currently it's not uncommon to find workers named, e.g., `$wa` while perusing Core. When you find one of these you need to then go searching for its associated wrapper to discover which function the worker implements. Then you need to work hard to keep this piece of information in your mental state. This is unfortunate and makes reading Core unnecessarily hard. Why not name the worker of `thisIsAFunction` something like, e.g., `thisIsAFunction$wa`? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11676> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11676: Preserve name of original function in worker name -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: feature request | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): It is. The worker for `foo` is `$wfoo`. So the function was called `a` in this case. So the culprit is not worker/wrapper, but something else. At a guess, it's `Simplify.makeTrivialWithInfo` which could use a more informative `OccName`. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11676#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11676: Preserve name of original function in worker name -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: feature request | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): Indeed I just noticed that the name should be derived while browsing the source. `makeTrivialWithInfo` sounds quite likely; thanks for that reference, it would have taken quite a while for me to find that myself. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11676#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11676: Preserve name of original function in worker name -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: feature request | Status: patch Priority: low | Milestone: Component: Compiler | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1970 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => patch * differential: => Phab:D1970 Comment: Phab:D1970 is an attempt at coercing `makeTrivialWithInfo` into generating more useful names. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11676#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11676: Preserve name of original function in worker name -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: feature request | Status: patch Priority: low | Milestone: Component: Compiler | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1970 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"4d791b4f77975422df38f6b43084008edd097f1b/ghc" 4d791b4f/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="4d791b4f77975422df38f6b43084008edd097f1b" Simplify: Make generated names more useful makeTrivial is responsible for concocting names during simplification. Previously, however, it would make no attempt to generate a name that might be useful to later readers of the resulting Core. Here we add a bit of state to SimplEnv: a finite depth stack of binders within which we are currently simplifying. We then derive generated binders from this context. See #11676. Open questions: * Is there a better way to accomplish this? * Is `maxContextDepth` too large/small? Test Plan: Validate, look at Core. Reviewers: austin, simonpj Reviewed By: simonpj Subscribers: thomie, simonpj Differential Revision: https://phabricator.haskell.org/D1970 GHC Trac Issues: #11676 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11676#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11676: Preserve name of original function in worker name -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: feature request | Status: patch Priority: low | Milestone: Component: Compiler | Version: 7.10.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1970 Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): I unfortunately just noticed that the commit message of the commit in comment:4 no longer reflects what the commit itself implements. The simplifier does not maintain a stack of contexts; instead we simply pass the context name in from the various call-sites of `makeTrivial` and friends. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11676#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11676: Preserve name of original function in worker name -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: feature request | Status: closed Priority: low | Milestone: 8.0.1 Component: Compiler | Version: 7.10.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1970 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed * milestone: => 8.0.1 Comment: Merged as bceb5becdb408316580c970c1f75cbde92a4f9e6. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11676#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC