Saturday, February 10, 2007

Automatically detecting SSE2, and other stuff

Bleeding edge Factor no longer has separate x86 boot images with and without SSE2 support. Instead, SSE2 is detected at the start of bootstrap. You can override this to produce an SSE2-less image on Pentium 4 chips with the -no-sse2 switch.

Basically we use the CPUID instruction, present on the original Pentium and above (and what if you want to run Factor on a 486? Sucks to be you! You'll need an FPU, at least, but it will work. Just pass the -no-sse2 switch to skip detection altogether). The code for this was written by Doug, with a bit of explanation on my part regarding some (presently undocumented) compiler internals. It serves as a simple demonstration of defining a new compiler intrinsic. Check it out.

... and what about the ARM port? There was a "day 4", but I didn't blog about it, because it was boring... all I did was fix some bugs and define some intrinsics. However I was doing all this in QEMU, because my Gumstix was borked (I corrupted the root fs). QEMU was too slow to be usable and it was quite frustrating to use, so I put the port aside. I ordered a serial daughterboard for my Gumstix, which arrived today, and I successfully reflashed it. So the porting work will continue, and in fact the only thing that remains is FFI support.

A major core feature I implemented in the last few days is an automatically growing data heap. You can still specify a heap size larger than the default on startup, but its not necessary because it will grow as needed.

The release of 0.88 is approaching fast. I just have to finish the ARM port and fix assorted bugs. I'm also hoping some cool upcoming libraries from contributors will be completed before the release. Chris has some mysterious uberframework which combines the Factor to JavaScript compiler with distributed concurrency and the HTTP server. Dan is working on Unicode 5.0 support. We also have AVL trees and binary heaps in the works, respectively from Alex and some other gentleman whose name escapes me right now, unfortunately.

Lots of hacking all around.

1 comment:

Yuhong Bao said...

Actually, some later 486s do support the CPUID instruction. And it is trivial to add an additional check to see if CPUID instruction exists by toggling the ID flag in EFLAGS.