On 12 May 2011 17:22, Gerardo Richarte <[email protected]> wrote: > On 05/10/2011 08:34 PM, Igor Stasenko wrote: >> Things i don't like: register naming. >> In cog you should use following register names: >> FPReg := -1. >> SPReg := -2. >> ReceiverResultReg := GPRegMax := -3. >> TempReg := -4. >> ClassReg := -5. >> SendNumArgsReg := -6. >> Arg0Reg := -7. >> Arg1Reg := GPRegMin := -8. >> DPFPReg0 := -9. >> >> They are mapping 1:1 to real registers on your machine. > > "Our" names are pretty similar to those, and I don't really see they are > 1:1 mapping to architecture (though at some point you will have that > mapping). The 1:1 mapping is not on names, but latter on implementation, > and I think that has to do with exactly what Cog wants: a fast > implementation. >
In Cog TempReg maps to EAX. and rest of register names mapped directly to assembler ones. I don't see how register names could affect an implementation. It depends where and how you using them. I agree that when you generating code which closely related to VM internals, then it makes sense to use special names like SendNumArgsReg. But if you wanna use spare register to hold something else than NumArgs.. then using such name is not helping. In that cases, i would prefer to use neutral names, like GPReg0 ... GPRegX .. which stands for General Purpose Register. Because the role of certain register may be different depending on where you using it. > FP is frame pointer, and it's the generic name for what in intel is BP > (in gdb you can do either $rbp or $fp) > SP is a generic name for the stack pointer (in gdb you can use $sp or $rsp) > ReceiverResult has to do with the use, nothing to do with processor > etc. > > not sure what DPFPReg0 stands for. > I guess its a "Double Precision Floating Point Register number 0" :) > I think the names are good for a VM implementation. Though maybe not for > a generic assembler. I think the that might be the difference between > Cog's and NativeBoost's needs > Yes. This is why i asking.. Because i want it to be generic. > gera > -- Best regards, Igor Stasenko AKA sig.
