[Haskell-cafe] ghci & ghc -> JS (Emscripten)
blackbox.dev.ml at gmail.com
Wed Jul 3 11:06:01 CEST 2013
should work (as I belive).
I've tried to compile 'hello wrold' Haskell program to JS using Emscripten
but I faced a problem, that in generated LLVM IR code there is no C-like
main function (https://github.com/kripken/emscripten/issues/500) so there
has to be a runtime library that has to be linked and will run the code -
is this "RTS" or something else?
it as a library to emscripten? Do you have a working RTS js version?
I want to simply try emscripten and see how it performs on such GHC
generater LLVM IRs.
2013/7/2 Luite Stegeman <stegeman at gmail.com>
> On Tue, Jul 2, 2013 at 4:38 PM, B B <blackbox.dev.ml at gmail.com> wrote:
>> Thank you for all the replies.
>> Luite Stegeman - I was thinking that the LLVM IR code is optimized
>> already or you can run LLVM IR optimization passes to get rid of such
>> things. I think compiling with ghc -fllvm generates LLVM bitcode and then
>> as expected.
> Most of the optimizations that GHC does are on Core, so you also get those
> if you use Core or STG as the source. You do miss out on the later
> optimization passes (GHC optimizes Cmm with Hoopl, and LLVM optimizes
> again). We implement this in GHCJS ourselves, optimizing the generated
> Since GHC itself is written in Haskell, it would be a good goal to compile
> simple Haskell programs first and make sure that the RTS is working (you'll
> need to compile the Cmm and C RTS files to LLVM). You can try to get the
> GHC Testsuite  running. The GHCJS testsuite  might also be useful, it
> contains much of the GHC Testsuite and a runner program that checks the
> Like i said in the previous post, the generated code is a bit weird:
> stacks are allocated dynamically, functions never return, there are only
> tail calls. Emscripten might have a hard time with this.
>  https://github.com/ghc/testsuite
>  https://github.com/ghcjs/ghcjs/tree/master/test
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe