I've started the final release testing for Exupery 0.14. There are two bugs captured with tests so far. The first has something to do with interrupts, it needs a few running profilers to cause the bug to happen. I'm hoping this one is the source of the unrepeatable bugs that were in the the previous release, if so solving it may allow Exupery to run for much longer as a background compiler.
The second bug is caused by the current work. What's happening is the currentContext register is being spilled but is being used by code generated in the register allocator to load the stack. It may also be needed by spill code to spill back into the stack.
The simplest fix is to avoid spilling the currentContext. I doubt that spilling the currentContext is a good idea as it'll make spills of stack registers much more complex. Not spilling currentContext is probably the right thing to do unless the spill heuristics are improved to avoid spilling currentContext then spilling many stack registers that will use it to load themselves from the stack.
A theoretically better fix would be to get the register allocator to reload the currentContext if required when generating spill code that needs it. This is nicer as it doesn't require making another register special. There are a few practical problems to make sure that this doesn't lead to very bad code when we decide to spill currentContext then spill other registers. Also, the only gain to handling currentContext as a real register is allowing it to be spilled when appropriate which could be very nice if it was a special register that would be loaded from it's real location rather than spilled from the stack.
My feeling is the right solution for now is to avoid spilling currentContext and leave the better solution until a time when it's appropriate to develop a more complete solution including both proper spill heuristics and reloading spilled registers from the interpreter's variables.
The background compiler compiled over 1200 methods before running into one where the currentContext was spilled. So at worst, forcing it into a register will only make 1 method in a thousand worse, and may make it better.
Bryce
exupery@lists.squeakfoundation.org