Hello All,
I have been hard at work, trying to grok the reg_alloc.c code, and with some success. My code is assigning registers, so that none are conflicting (which I double-verify), and I'm getting to the end of "make".
Woohoo! A non-trivial thing. :)
Here's some questions:
1) In the existing parrot code, when a register is assigned, it uses the following code: for (color = 0; color < MAX_COLOR; color++) { int c = (color + MAX_COLOR/2) % MAX_COLOR; if (!colors[c]) { reglist[x]->color = c;
debug(interpreter, DEBUG_IMC, "#[%s] provisionally gets color [%d]" "(%d free colors, score %d)\n", reglist[x]->name, c, free_colors, reglist[x]->score); break; } }
Thus, it seems to prefer to use register #16 and up, first, before it uses 0-15. This is mistifying to me, since it's not so trivial to code it this way, and yet I cannot figure out why this color preference. It seems like maybe there's a reason which I need to understand here. My new code doesn't do this behaviour.
Registers 0-15 are the registers used for sub/method/function calls. Leaving them empty makes calls easier -- if the low-registers are in use you need to shuffle the contents somewhere else.
[Snippage]
Looks like we've got some... incidental behavior. This isn't particularly good. Feel free to rip out anything you want -- this is all internals stuff, much of it's first-generation code, and nobody's got any attachment to it. (I hope :)
Incidentally, reg allocation is done on the following subs: _main __library_dumper_onload _dumper _register_dumper _global_dumper __library_data_dumper_onload dumper __library_data_dumper_default_onload dumpWithName dumpCached dumpProperties dumpHash dumpStringEscaped pmcDefault pmcPMCArray pmcIntList pmcStringArray pmcPerlArray pmcPerlHash pmcPerlString pmcPerlInt pmcPerlNum pmcPerlUndef pmcSub pmcNull pmcOrderedHash pmcManagedStruct pmcUnManagedStruct pmcArray __library_data_dumper_base_onload prepare cache createIndent indent newIndent deleteIndent dump simple String
which seems like a lot to me, but I guess it's compiling a lot of stuff.
That doesn't seem right. Leo may well have an idea of why. On the other hand, I'm fine with ripping a lot of this stuff out and centralizing it.
-- Dan
--------------------------------------it's like this------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk