I've been working on implementing a peephole optimizer for SBCL.
I've done a lot of Google searching for 'prior art' with regard to this optimization, but I couldn't find much other than that it was supposed to be not easy.
So far it is going pretty well, as I've got hooks in the code to buffer up all of the assembly (as structs used by the 'scheduler', 'label' structs, and functions that do the alignment) and then emit it to a code-vector later.
This allows peephole optimization according to option 1 of the above link. It was pretty straightforward after spending a couple of days figuring out how things work in python...
The (extremely) preliminary version of the optimizer that I have does the optimization mentioned in number 3 (seems to catch it about 400 times compiling SBCL from source). It compiles fully (using vanilla 1.0.40 sbcl as bootstrap and bootstrapping itself) and it seems to pass all of the tests in the tests directory.
I am still working on an elegant interface to pattern matching (I'm thinking a 'unification' style function is the way to go?) and the actual 'sliding peephole window'... thing.
I have a few questions about the process of contributing, (once it is a bit further along):
1.) How do I contribute? The project page (link to sourceforge) on sbcl.org
is a dead link for me. "This page has been deprecated and is now controlled by the consume team
". I was lucky that i was already subscribed to the SBCL-devel mailing list in my gmail, as I had difficulty finding it on the site. I expect that the procedure is to fork the main branch and merge in my changes, and that they then get considered for addition? Where is the main branch?
It obviously needs a lot more work to be included, but I'd like to know where to put the repository for downstream synchronization/bus-insurance.
2.) It seems like these types of changes are pretty important to really, really test thoroughly.
(judging by the number of times I have landed myself in LDB working on this stuff).
Is there a list of commonly-used applications that I could run to test the compiler?
(I was thinking I would try MAXIMA for starters).
3.) These changes would be applicable to all architectures (I think), I've made the changes only within the generic sections of the compiler (with the notable exception that the optimizations are platform specific). I only have an x86_64 machine currently, I can test regular x86 on it, but I cannot test, for example, SPARC or MIPS on it. Is there a procedure for doing this? (An emulator, perhaps?).
That's it for now, I think