Elizabeth Mattijsen <[EMAIL PROTECTED]> wrote:

> If you're thinking about this, then maybe a better heuristic would be
> to group globals into groups that are _only_ referenced within a
> specific scope and fetch them on scope entry and store them on scope
> exit.  But then, anything like eval"" or the equivalent of a glob
> assignment (or even worse: an event) within that scope, will cause
> problems.

Storing lexicals or globals isn't needed:

$ cat g.pasm
  new P0, .PerlInt
  set P0, 4
  store_global "$a", P0
  # ...
  find_global P1, "$a"
  inc P1
  find_global P2, "$a"
  print P2
  print "\n"
  end
$ parrot g.pasm
5

So the optimization is to just keep lexicals/globals in registers as long
as we have some. Where currently spilling is done, we just forget about
that register (but not *reuse* it, C<new> or such is ok) - and refetch
the variable later.

So the *only* current optimization is: we need HLL directives for
lexicals and globals so that the spilling code and register allocator
can use this information. That is: we can always cut the life range of
lexicals/globals, *if* we refetch, where we now fetch from the spill
array.

> Liz

leo

Reply via email to