[GHC] #9289: add anyToAddr# :: (#a#)-> Addr# primop (inverse of addrToAny#)

#9289: add anyToAddr# :: (#a#)-> Addr# primop (inverse of addrToAny#) ------------------------------------+------------------------------------- Reporter: carter | Owner: Type: feature request | Status: new Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 7.8.2 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- I was talking with Reid Barton, and he pointed out that having a primop with type {{{ anyToAddr# :: (#a#)-> Addr# }}} would help with a lot of performance hacking. One use case would be running prefetch on lifted values without evaluating them. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9289 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9289: add anyToAddr# :: (#a#)-> Addr# primop (inverse of addrToAny#) -------------------------------------+------------------------------------ Reporter: carter | Owner: Type: feature request | Status: new Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by rwbarton): In particular, you could use it to prefetch a heap object without making any assumptions about the representation of pointers to heap objects (imagine if we used a pointer tagging scheme that used bits 48-62 on x86_64, or compressed pointers). Not sure off-hand what else it would be useful for given that the GC could move the object after we get the `Addr#`; maybe it makes more sense to add a variant of prefetch `a -> Int# -> (# a #)` instead. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9289#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9289: add anyToAddr# :: (#a#)-> Addr# primop (inverse of addrToAny#) -------------------------------------+------------------------------------ Reporter: carter | Owner: Type: feature request | Status: new Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by carter): Thats a good idea! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9289#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9289: add anyToAddr# :: (#a#)-> Addr# primop (inverse of addrToAny#) -------------------------------------+------------------------------------ Reporter: carter | Owner: Type: feature request | Status: new Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by schyler): A more appropriate name addrOf# maybe. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9289#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9289: add anyToAddr# :: (#a#)-> Addr# primop (inverse of addrToAny#) -------------------------------------+------------------------------------ Reporter: carter | Owner: Type: feature request | Status: new Priority: normal | Milestone: 7.10.1 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by carter): It won't be an address. In general, it could also be an Int# or Word# casted to an Addr# :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9289#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC