Add support for Portable Native Client
Portable Native Client
PNaCl is present in Chrome 29 (go to chrome://flags to enable it), and will be enabled for arbitrary sources (the "open web") in Chrome 30. Mozilla have announced that they don't intend to support Native Client.
The pexe bitcode format is a frozen subset of LLVM bitcode. The PNaCl toolchain provides
pnacl-finalize, which translates LLVM bitcode into pexe bitcode.
PNaCl only allows the standard "ccc" calling convention, whereas GHC likes to use its own "cc 10" calling convention. You can make GHC use ccc by using an unregisterised build, for a slow-down factor of about 2.
It seems likely that code-next-to-tables will upset the validator. If so, this can be turned off for a small performance hit.
The validator requires that requests for IO are sent to Pepper. PNaCl also requires that you use newlib instead of glibc. Spawning new processes is forbidden (although creating pthreads is fine). It also seems likely that the validator with take umbrage at calls to
mmap, which the GHC runtime uses to request memory allocation.
It seems, therefore, that significant chunks of the RTS will have to be ported.