[Haskell-cafe] Building Haskell Platform natively for 64bit Windows

austin seipp as at hacks.yi.org
Fri Jun 10 20:24:03 CEST 2011


It's worth mentioning 'foreign prim' is still a bit different from
"inline" code - while you can certainly write Cmm and have GHC link it
into your program, it is not really "inline." GHC has two different
kinds of primitive operations: inline primops, and out of line
primops. foreign primops are currently always out of line. Inline
primops require actual GHC hacking, as they are short code sequences
emitted directly by the code generator, that don't block or require
allocation. As far as I know, GHC will naturally still generate a call
to these out of line primops when you use them - in the form of a
'jmp' instruction, which is all that exists in Cmm (if someone out
there knows more, like Johan perhaps who recently did memcpy inline
primops, please correct me.) GHC will not necessarily have to spill
STG registers (as it would in the case of a true foreign call,) but
the instructions certainly won't be inline.

Truthfully the use case for foreign prim is frighteningly small I
think. It's been around for a while, but currently it's only client is
integer-gmp, which was part of the motivation for the implementation
anyway (to split GMP away from the GHC RTS, so it would be possibly to
build full BSD3 haskell executables for commercial purposes, etc.)
Outside of perhaps, an integer-openssl binding that instead used
OpenSSL bignums, I can't think of many use cases personally. And a
true 64bit GHC port to windows is of course, going to help the
situation much more than any amount of hacking around the issue with
32bits and 8 registers will, while trying to retain some sense of
efficiency.

On Fri, Jun 10, 2011 at 12:16 PM, Andrew Coppin
<andrewcoppin at btinternet.com> wrote:
> On 10/06/2011 01:44 AM, Jason Dagit wrote:
>>
>> On Thu, Jun 9, 2011 at 2:06 PM, Andrew Coppin
>> <andrewcoppin at btinternet.com>  wrote:
>>
>>> Too bad GHC doesn't support inline assembly yet... (Or does it? I know it
>>> supports inline Core now.)
>>
>> Really?  I found this in the manual so I think either the docs need to
>> be updated or you are mistaken:
>
> Apparently I am mistaken. It allows inline C-- (as of 6.12.1):
>
> http://www.haskell.org/ghc/docs/6.12.1/html/users_guide/ffi.html#ffi-prim
>
> Of course, C-- is not nearly the same as Core. Sorry about that...
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
Regards,
Austin



More information about the Haskell-Cafe mailing list