[GHC] #15714: Compacting StaticPtr of a function doesn't work

#15714: Compacting StaticPtr of a function doesn't work -------------------------------------+------------------------------------- Reporter: osa1 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.3 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: -------------------------------------+------------------------------------- I think we should be able to compact a StaticPtr of a function, but it currently doesn't work. Reproducer: {{{#!haskell {-# LANGUAGE StaticPointers #-} import GHC.StaticPtr import Data.Compact foo :: Int -> Int foo x = x^2 main = do c <- compact (static foo :: StaticPtr (Int -> Int)) return () }}} Output: {{{ ./compact_test compact_test: compaction failed: cannot compact functions }}} Tried with 8.4.3 (compact on hackage doesn't build with 8.6). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15714 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15714: Compacting StaticPtr of a function doesn't work -------------------------------------+------------------------------------- Reporter: osa1 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.3 Resolution: | Keywords: 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 because a `FUN_STATIC` can refer (directly or indirectly) to CAFs, and compact regions cannot have any dependencies on other heap objects. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15714#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15714: Compacting StaticPtr of a function doesn't work -------------------------------------+------------------------------------- Reporter: osa1 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.3 Resolution: | Keywords: 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 osa1): Ah, that makes sense. But at least in theory we could check if the FUN has CAF references before failing, right? StaticPtr to a FUN with no CAF references should be OK I think -- although I guess in practice that may not be too useful as most functions probably have some CAF references. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15714#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15714: Compacting StaticPtr of a function doesn't work -------------------------------------+------------------------------------- Reporter: osa1 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.3 Resolution: | Keywords: 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): I don't think that would be deterministic enough to be a reliable API. You could imagine the compiler making different optimisation choices which would change whether a function refers to CAFs or not - e.g. full laziness can do that, and then your program either works or not depending on whether optimisation is turned on. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15714#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#15714: Compacting StaticPtr of a function doesn't work -------------------------------------+------------------------------------- Reporter: osa1 | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.4.3 Resolution: invalid | Keywords: 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 osa1): * status: new => closed * resolution: => invalid Comment: Agreed -- closing. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15714#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC