Otherwise the ghc binary should be fully functional as a native compiler. Thus
-fllvm in spirit.
The patch adds
HscTarget. It is used to dispatch code output to
disables GHC Hp and Sp overflow checks.
To distinguish between pointers and scalars we run Hoopl heuristics in
As in native world, the generated JS object files are to be linked. In order to do this, there is another project, tentatively called Josh. Josh is regular cabalized Haskell binary which links JS object files using function maps provided by GHC.
handful of handwritten JS code residing in Josh distribution.
ghc-prim, integer-gmp and base are compiled with small changes. Those changes seem to be orthogonal to the GHC patch.
For bootstrap process please see Josh README at github. Josh also includes several tests which work on 32-bit Debian Wheezy.
Generated code is in order of 2 MB uncompressed and un-minified. Most of it is in RTS. It compresses very well though (to 150Kb approx). Plenty of low-hanging fruit optimizations are possible.
There are plenty caveats to the current patch.
- It works on 32 bits only. Math is fishy and Integer support is nonexistant.
- Lots of tests should be imported from GHC, GHCJS, Fay.
- No Handle based IO works at the moment.
- No performance tests were done.
Despite its shortcomings, the patch is fairly non-invasive, IMHO. It should be noted, that the same approach could work for other GC based platforms (e.g. Java, C#).
I'd like to continue working towards merging the patch into GHC, if possible. Could GHC committers provide any guidance of what should be done in order to merge it?