the big week
My process for building WebKit has been simple. I made minor changes to their build system to use AROS crosscompilers, and then let it build until it breaks. Then I go in, figure out what died, and fix it. Often this is easy, requiring only some platform defines and such. Sometimes its been a little harder, which is where
posix_memalign() came from. The really fun thing happened at the start of the week when the build failed because a couple of math library functions were missing.
Our math library (known as
arosm, depending on where you look, though every other platform calls it
libm, go figure) was originally taken from a math library written at Sun way back in 1993, and released for free. We got our copy from FreeBSD in 1999, and it was updated again in 2003. Its missing a lot of stuff though, notably things from C99.
I had a look through the FreeBSD code and found the functions I needed, but on noticing just how much stuff was missing I decided it might be better to do a full refresh of
libm. As is usual when I start on something, it rapidly got out of hand.
I had to make a few changes to our core headers to provide all the necessary defines and types and such to make it work. The new code also has an amount of architecture-specific code for using the FPU. Fortunately FreeBSD supports all of the architectures that we have active ports for (i386, x86_64 and ppc), so it was just a matter of getting the right code into place.
In any case, lots of tweaking and merging has been going on such that I now have about 20000 lines changes spread out over 21 patches. I haven’t committed them yet as I’m waiting on some build macros from Staf to allow me to build the architecture-specific files into the library correctly. My hacked version seems to work well, and passes a couple of tests from Fred Tydeman’s C99 FPCE test suite. I’ll run all the tests soon, but I expect them to pass without issue.
Once the patches can compile cleanly, I’ll try to get some other AROS devs to review them, as they’re big and I’m scared. Once its all deemed good, they’ll go in, and we’ll be doing fancy math forever. Hurrah!
Anyway, after shoring up the holes in AROS, it was back to JSCore. The code is exceptionally well written, and easy to port. Apart from adding
#ifdef here and there, the only actual code I had to write was stuff to help the garbage collector find the stack base, and thats two lines in
struct Task *task = FindTask(NULL); return task->tc_SPReg;
testkjs runs properly. The only issue is that the garbage collector is not fully cleaning up all the objects at script exit, which I think may be a memory management issue. I haven’t fully tracked it down, but the folks in
#webkit (particularly bdash) have been very helpful and I’m expecting to have it sorted out soon.
I’ll be making my git repositories available shortly, so the brave can track my progress. And you’d better believe that only the brave need apply - you need to be willing to track AROS and WebKit SVN repositories and regularly recompile AROS, gcc and WebKit. Oh, and there’s a 20-step build process for ICU as well, one of the WebKit prerequisites. Its early though, this will be made easier after I’m finished so other people can hack on this too.