Haskell on risc os!
James Hobson (3319) 13 posts |
Hello! Thought I’d mention that I have just finished building the JHC as a cross compiler to risc os! If you want to have a play, you can find a docker image here |
Julie Stamp (8365) 474 posts |
Brilliant! I had to work out how to use docker first, here’s what I did 1. Install docker using package manager
3.
Now in container
Back on host
4. Then copied hs,e1f to risc os and ran it. I wonder how _swix would look? Maybe
so
Where should I go in the docker container to see the risc os changes you’ve made to jhc? |
James Hobson (3319) 13 posts |
So far, other than getting it to build the rts correctly for risc os, I’ve done nothing! The plan is risc os libraries next. I’m thinking toolbox or oslib first. If you want to make a base risc os library, I’d be happy to include it in the container |
Michael Grunditz (8594) 259 posts |
Which version of gcc do you use? There are new versions in the autobuilder directory. |
Julie Stamp (8365) 474 posts |
I’m quite liking jhc. I think what ghc would help with is errors. I’d expect when a SWI generates an error for an exception to be raised in Haskell. So then you could go
But catch doesn’t work in jhc. |
Julie Stamp (8365) 474 posts |
Unfortunately jhc’s garbage collector is picking up a null pointer. Specifically the argument val of s_set_used_bit called by gc_add_grey called by gc_perform_gc. I don’t know how to fix this :-( |
Daniel Hanlon (1373) 8 posts |
Great news James – thanks for working on this! |
James Hobson (3319) 13 posts |
Julie! Feel free to provide some code for me to look at. I’ve hacked on this compiler a lot in the past! And Michael, is that a gcc cross compiler? Or Risc os compiler? I need a cross compiler and posix libraries in order to bootstrap GHC. |
Julie Stamp (8365) 474 posts |
Since then I’ve found it’s making an array with a length of zero that causes a null-pointer to get fed into the garbage collector. The code
compiled with
prints
Looking at the C it produces (-C —tdir=./), there’s a line
That function in gc_jhc.c is
In my example count is zero and the NULL sptr_t returned is put on the gc stack. Maybe it should return TO_SPTR(P_VALUE, NULL) instead so that gc_peform_gc skips over the entry in the stack? |