Unique invariants: GHC invocation vs scope?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Unique invariants: GHC invocation vs scope?

Csaba Hruska
Hello,

What are the intended invariants of Unique values?
So far I thought that it is always gives a unique identity to things during a whole GHC invocation. However this is not true. I.e. eta expansion breaks this assumption.

Here is a snippet from the STG IR of GHC.PrimopWrappers:
extendInt8# [InlPrag=NOINLINE] :: Int8# -> Int#
[GblId, Arity=1, Unf=OtherCon []] =
    \r [eta_B1] extendInt8# [eta_B1];

ord# [InlPrag=NOINLINE] :: Char# -> Int#
[GblId, Arity=1, Unf=OtherCon []] =
    \r [eta_B1] ord# [eta_B1];

Where eta_B1 is redefined, so it is only unique in the scope.
Is this intentional?

Thanks,
Csaba Hruska

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

RE: Unique invariants: GHC invocation vs scope?

GHC - devs mailing list

Generally, there is no assumption that binders are unique, anywhere in GHC.

 

The Simplifier does remove gratuitious shadowing (like  (\x. \x. e)), but there is really no guarantee at any stage.

 

Simon

 

From: ghc-devs <[hidden email]> On Behalf Of Csaba Hruska
Sent: 08 May 2020 14:03
To: GHC developers <[hidden email]>
Subject: Unique invariants: GHC invocation vs scope?

 

Hello,

 

What are the intended invariants of Unique values?

So far I thought that it is always gives a unique identity to things during a whole GHC invocation. However this is not true. I.e. eta expansion breaks this assumption.

 

Here is a snippet from the STG IR of GHC.PrimopWrappers:

extendInt8# [InlPrag=NOINLINE] :: Int8# -> Int#
[GblId, Arity=1, Unf=OtherCon []] =
    \r [eta_B1] extendInt8# [eta_B1];

ord# [InlPrag=NOINLINE] :: Char# -> Int#
[GblId, Arity=1, Unf=OtherCon []] =
    \r [eta_B1] ord# [eta_B1];

 

Where eta_B1 is redefined, so it is only unique in the scope.

Is this intentional?

 

Thanks,

Csaba Hruska


_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs