[GHC] #7718: ios patch no 8: adjustor pools

GHC cvs-ghc at haskell.org
Sun Apr 21 15:50:05 CEST 2013


#7718: ios patch no 8: adjustor pools
--------------------------------+-------------------------------------------
  Reporter:  StephenBlackheath  |          Owner:         
      Type:  feature request    |         Status:  patch  
  Priority:  normal             |      Milestone:  7.8.1  
 Component:  Compiler           |        Version:  7.7    
Resolution:                     |       Keywords:         
        Os:  Other              |   Architecture:  arm    
   Failure:  None/Unknown       |     Difficulty:  Unknown
  Testcase:                     |      Blockedby:         
  Blocking:  7724               |        Related:         
--------------------------------+-------------------------------------------
Description changed by igloo:

Old description:

> "Adjustor" is the term used for a C function pointer that allows C code
> to call back to Haskell. Normally these are generated at runtime.
>
> However, the iOS kernel doesn't allow self-modifying code. So, on iOS we
> use a pool of precompiled adjustors of a fixed size, and this patch is
> the implementation for that.
>
> It consists of three parts:
>
> 1. A POOLSIZE pragma, that is used like this:
>
>   foreign import ccall safe "wrapper" {-# POOLSIZE 100 #-}
>     mkDelegate :: IO () -> IO (FunPtr (IO ()))
>
>   This patch makes this pragma work on all platforms, but it'll have no
> effect on platforms other than iOS.
>
> I am not sure what the procedure is for additions of pragmas. Do pragmas
> require {-# LANGUAGE xx #-} ? Anyway, please review whether the approach
> taken here is acceptable.
>
> 2. The Haskell code in the compiler to generate the stubs for the pooled
> adjustors.
>
> 3. The runtime system's implementation of pooled adjustors in C.

New description:

 "Adjustor" is the term used for a C function pointer that allows C code to
 call back to Haskell. Normally these are generated at runtime.

 However, the iOS kernel doesn't allow self-modifying code. So, on iOS we
 use a pool of precompiled adjustors of a fixed size, and this patch is the
 implementation for that.

 It consists of three parts:

 1. A POOLSIZE pragma, that is used like this:
 {{{
   foreign import ccall safe "wrapper" {-# POOLSIZE 100 #-}
     mkDelegate :: IO () -> IO (FunPtr (IO ()))
 }}}
   This patch makes this pragma work on all platforms, but it'll have no
 effect on platforms other than iOS.

 I am not sure what the procedure is for additions of pragmas. Do pragmas
 require {-# LANGUAGE xx #-} ? Anyway, please review whether the approach
 taken here is acceptable.

 2. The Haskell code in the compiler to generate the stubs for the pooled
 adjustors.

 3. The runtime system's implementation of pooled adjustors in C.

--

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



More information about the ghc-tickets mailing list