ios patch no 8: adjustor pools
"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:
- 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.
- The Haskell code in the compiler to generate the stubs for the pooled adjustors.
- The runtime system's implementation of pooled adjustors in C.