I'm trying to get my head round the relationship between pad lexicals,
pad tmps, and registers (if any).
The PMC registers are just a way of allowing the the address of a PMC to
be passed to an op, and possibly remembered for soonish reuse, right?
So presumably we still have the equivalent of a padsv op, except that now
it puts the address of a pad lexical in a nominated PMC register rather than
pushing it on the stack. Then as an optimisation, the compiler may remember
that the address is now in register 5 say, and can remove further padsv
ops for the same variable in subsequent steps?
I'm less clear about pad tmps. Will we still statically allocate tmp PMCs
to ops and store them in pad slots á la Perl 5? ie is
$a = $a + $a*$b
compiled to
getaddr P0, PADOFFSET($a)
getaddr P1, PADOFFSET($b)
getaddr P2, PADOFFSET(firsttmp)
mult P0, P1, P2 # tmp = a*b
add P0, P2, p0 # a = tmp + a
where PADOFFSET(...) are compile-time constants.
Or are we going for some other mechanism?
NB for what it's worth, I really dislike Perl 5's tendency to have a
a whole bunch of intermediate results left languishing in pad tmps until
the end of the program, eg
$a = ' ' x 100_000_000;
$a = ' ' x 100_000_000;
$a = ' ' x 100_000_000;
$a = ' ' x 100_000_000;
$a = ' ' x 100_000_000;
Leaves 500Mb of useless data sitting around in op_repeat targets.
Dave "confused as always" M.