Phil Hassey wrote:


Not knowing much about virtual machine design... Here's a question --
Why do we have a set number of registers? Particularily since JITed code ends up setting the register constraints again, I'm not sure why parrot should set up register limit constraints first. Couldn't each code block say "I need 12 registers for this block" and then the JIT system would go on to do it's appropriate spilling magic with the system registers...


This is somehow the approach, the current optimizer in jit.c takes. The optimizer looks at a section (a JITed part of a basic block) checks register usage and then assigns the top N registers to processor registers.

This has 2 disadvantages:
- its done at runtime - always. It's pretty fast, but could have non trivial overhead for big programs
- as each section and therefore each basic block has its own set of mapped registers, now on almost every boundary of a basic block and when calling out to non JITed code, processor registers have to be saved parrot's and restored back again. These memory accesses slow things down, so I want to avoid them where possible.



Phil

leo



Reply via email to