
On Thu, 2008-07-24 at 14:38 -0700, John Meacham wrote:
Neat stuff. I used to work at Sun in the solaris kernel group, the SPARC architecture is quite elegant. I wonder if we can find an interesting use for the register windows in a haskell compiler. Many compilers for non c-like languages (such as boquist's one that jhc is based on (in spirit, if not code)) just ignore the windows and treat the architecture as having a flat 32 register file.
Right. GHC on SPARC has also always disabled the register window when running Haskell code (at least for registerised builds) and only uses it when using the C stack and calling C functions. We should discuss this with our project adviser from the SPARC compiler group. The problem of course is recursion and deeply nested call stacks which don't make good use of register windows because they keep having to interrupt to spill them to the save area. I vaguely wondered if they might be useful for leaf calls or more generally where we can see statically that the call depth is small (and we can see all callers of said function, since it'd change the calling convention). But now you mention it, I wonder if there is anything even more cunning we could do, perhaps with lightweight threads or something. Or perhaps an area to quickly save registers at GC safe points. Duncan