
#8281: The impossible happened: primRepToFFIType -------------------------------------+------------------------------------- Reporter: tibbe | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.4.1 Component: Compiler | Version: 7.6.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): I see that the docmentation on `foreign import unsafe` is thin in the extreme. The [http://downloads.haskell.org/~ghc/master/users-guide/ffi- chap.html user manual section] does not mention `unsafe`; while the [https://www.haskell.org/onlinereport/haskell2010/haskellch8.html#x15-1490008 relevant section of the Haskell 2010 report] has only a single cryptic sentence about "call backs into the Haskell system". It would be good to document it better, perhaps in the user manual. A good example is this thread: can you pass an unpinned bytearry to a foreign call? I don't think we have a shred of documentation about this. At one point we thought of unsafe foreign calls as a "fat machine instruction". GHC's obligations are simpler because GC cannot be invoked by the call, or thread-switching. Nor, I think, should it block (because then GC might happen while it was blocked). So it could be used for things like `cosine` that might be implemented out of line, but morally are like a machine instruction. I think Simon's `unsafenogc` gets closer to the "fat machine instruction" idea. It really must be used only for short-running calls. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8281#comment:21 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler