[GHC] #13084: 'foreign import prim' are marked PlaySafe by the parser

#13084: 'foreign import prim' are marked PlaySafe by the parser -------------------------------------+------------------------------------- Reporter: jberryman | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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: -------------------------------------+------------------------------------- Experimenting with a {{{foreign import prim}}} in my code I noticed the generated core produces {{{__pkg_ccall_GC}}} which concerned me since I thought perhaps we were experiencing the overhead of a "safe" ccall. Reid Barton reccommended filing a report, commenting: it looks like prim imports are marked PlaySafe by the parser, which is presumably mostly ignored, and definitely ignored during code generation. But wherever it's not ignored there could be a bug see: http://stackoverflow.com/questions/41528208/why-is-there-no-foreign- import-prim-unsafe -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13084 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13084: 'foreign import prim' are marked PlaySafe by the parser -------------------------------------+------------------------------------- Reporter: jberryman | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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 simonpj): I think that's a good question. Neither the [https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ffi- chap.html user manual section] nor the [wiki:Commentary/PrimOps wiki commentary] discuss the interaction of `foreign import prim` with GC. Indeed my assumption would have been that `foreign import prim` was by- default unsafe, i.e. should not trigger gc. I'd have thought it made sense to allow a safe/unsafe attribute on `foreign import prim`. Simon M: any thoughts? Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13084#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13084: 'foreign import prim' are marked PlaySafe by the parser -------------------------------------+------------------------------------- Reporter: jberryman | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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 jberryman): Sorry I think my description above was a little unclear; it ''does'' I think look like the generated code is just setting up the registers and doing a jump, which is what I was expecting/hoping (although maybe a GC is being triggered and I don't know what that looks like). It was suggested that this might be a "display bug" that might cause issues down the line. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13084#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC