[GHC] #13944: Introduce synchronized FFI

GHC ghc-devs at haskell.org
Tue Jul 11 18:19:49 UTC 2017


#13944: Introduce synchronized FFI
-------------------------------------+-------------------------------------
        Reporter:  winter            |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:  8.4.1
       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 bgamari):

 >> The problem is that, other than perhaps the stack walk, I don't think
 any of these costs can be avoided. Afterall, we need to save the thread
 state to the TSO in order to safely GC (since TSOs are GC roots). I
 suspect it would also be necessary to lock the capability.
 >
 > Is there a way to do it lazily? By say lazily i meaning, can we just
 perform the FFI call and mark the capacity with some kind of SYNC flag. If
 a GC thread is asking for sync during FFI, then let it perform these stack
 saving for us. Otherwise we just happily continue, and saving all the
 overheads.

 I'll assume by "it" you mean the thread-state save. I don't believe it is
 possible; afterall, there may be thread state (which may contain reference
 to heap objects) sitting in machine registers.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13944#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list