Greetings,
On Mon Mar 12 15:25:38 2007, [EMAIL PROTECTED] wrote:
> chromatic wrote:
> > On Monday 12 March 2007 10:52, Nuno Carvalho via RT wrote:
> >
> >
> >> I've run the tests and didn't find any test failling because of
> this
> >> change. With this change we can have "P99999999999..999", if a
> limit to
> >> the number of digits (or size) in the register name is defined i
> can
> >> change the lexer to accept only names inside the limit.
> >>
> >> More testing is welcome.
> >>
> >
> > What does this do to the register allocator and to memory usage? If
> I use integer registers 10,000 and 100,000, will Parrot allocate a
> sparse data structure?
> >
> The assumption is that if you're naming actual registers rather than
> asking Parrot to allocate them for you, you are generating sensible
> code. :-)
>
> > What does this give over using unlimited remappable symbolic
> registers?
> >
> In the .Net translator it was a lot easier to reference registers
> numerically when generating PIR; I guess there will be other cases
> where
> that is the case too. Using ".local"s would have made it harder (I
> assume that's what you meant by symbolic). And yes, admittedly I was
> using numeric remappable registers ($Inn and so on), rather than Inn
> directly, but the win for doing so was small (and it was probably a
> non-win in terms of PIR->PBC time).
>
> On the patch itself, I think at least limit it to something that can
> always fit in a 32-bit integer.
>
> Jonathan
>
Do not forget that we are talking about the lexer here. Looking into the
grammar file we can see that the register name that is matched in the
lexer changed rule is directly translated into an INTVAL (unless i'm
reading something wrong):
SymReg *
mk_pasm_reg(Interp *interp, char * name)
{
SymReg * r;
(...)
r->color = atoi(name+1);
(...)
}
the char* name is exactly the string matched in the lexer we are
discussing here. The 'color' field in SymReg type defintion is type INTVAL.
Bottom line: string matched in lexer is directly mapped to an INTVAL
later, so IMHO the max allowed size of the register name in the lexer
should be the max allowed for an INTVAL.
./smash