[GHC] #15901: Assert and record that code generation requires distinct uiques for let-binders

#15901: Assert and record that code generation requires distinct uiques for let- binders -------------------------------------+------------------------------------- Reporter: sgraf | Owner: (none) Type: task | Status: new Priority: normal | Milestone: ⊥ Component: Compiler | Version: 8.6.2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Simon writes in [https://ghc.haskell.org/trac/ghc/ticket/15754#comment:10 #15754]: Another invariant that the code generator needs is (I believe) that every let-binder has a distinct unique. We can't re-use the same unique, even in a different scope, let alone shadowing. Why? Because (I believe) that the code generator uses these uniques to generate unique top level labels for the entry code and info table for the closure. Now, it's probably the case that they are unique anyway; but we should either * Write this down as a invariant of STG, or * Establish this invariant in the immediately-before-codegen pass that gets the free vars right, or * Not assume it in the code generator -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15901 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15901: Assert and record that code generation requires distinct uiques for let- binders -------------------------------------+------------------------------------- Reporter: sgraf | Owner: (none) Type: task | Status: new Priority: normal | Milestone: ⊥ Component: Compiler | Version: 8.6.2 Resolution: | Keywords: CodeGen Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * keywords: => CodeGen Old description:
Simon writes in [https://ghc.haskell.org/trac/ghc/ticket/15754#comment:10 #15754]:
Another invariant that the code generator needs is (I believe) that every let-binder has a distinct unique. We can't re-use the same unique, even in a different scope, let alone shadowing.
Why? Because (I believe) that the code generator uses these uniques to generate unique top level labels for the entry code and info table for the closure.
Now, it's probably the case that they are unique anyway; but we should either * Write this down as a invariant of STG, or * Establish this invariant in the immediately-before-codegen pass that gets the free vars right, or * Not assume it in the code generator
New description: Simon writes in [https://ghc.haskell.org/trac/ghc/ticket/15754#comment:10 #15754]: Another invariant that the code generator needs is (I believe) that every let-binder has a distinct unique. We can't re-use the same unique, even in a different scope, let alone shadowing. Why? Because (I believe) that the code generator uses these uniques to generate unique top level labels for the entry code and info table for the closure. Now, it's probably the case that they are unique anyway; but we should either 1. Write this down as a invariant of STG, or 2. Establish this invariant in the immediately-before-codegen pass that gets the free vars right, or 3. Not assume it in the code generator -- Comment: I have no strong opinion about 1-3. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15901#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15901: Assert and record that code generation requires distinct uiques for let- binders -------------------------------------+------------------------------------- Reporter: sgraf | Owner: (none) Type: task | Status: new Priority: normal | Milestone: ⊥ Component: Compiler | Version: 8.6.2 Resolution: | Keywords: CodeGen Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonmar): This is currently done by CorePrep, and noted explicitly in the comments (`CorePrep.hs`): {{{ 6. Clone all local Ids. This means that all such Ids are unique, rather than the weaker guarantee of no clashes which the simplifier provides. And that is what the code generator needs. We don't clone TyVars or CoVars. The code gen doesn't need that, and doing so would be tiresome because then we'd need to substitute in types and coercions. }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15901#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC