On Tue, Nov 29, 2005 at 04:27:28PM -0500, Matt Diephouse wrote:
> Chip Salzenberg <[EMAIL PROTECTED]> wrote:
> > On Tue, Nov 29, 2005 at 03:25:13PM -0500, Matt Diephouse wrote:
> > > Or, perhaps more accurately, `P1 := ...\n assign P0, P1`?
> >
> > No, PIR doesn't do that kind of thing (allocating P registers) behind
> > your back.  If a sequence needs a second P register, PIR will make you
> > name it.  Somewhere.  Otherwise you'd be unable to e.g. control object
> > lifetime by nulling the register.  (Right, Leo?)
> 
> That would mean that `P0 = opcode P2` is illegal, right?

Depends on the signature of the opcode.

If the opcode's first parameter is marked 'out', so the opcode
actually modifies the P register to point to a new PMC, ':=' would
indeed be required.

However, there are also opcodes that set a new *value* for the PMC
referenced by their first parameter, but do not modify the register
itself.  (I believe 'assign' fits that description.)  So, if we follow
that algorithm, I think these should all be equivalent:

   assign P0, P1
   P0 = assign P1
   P0 = P1

The final plan should include more metadata on opcodes.  Right now the
compiler can distinguish aliasing from non-aliasing, but it also
should be able to distinguish "use value for reading" and "use value
for writing".  Two modes (in and out) are not enough to describe three
use cases (require "=", require ":=", and forbid both).
-- 
Chip Salzenberg <[EMAIL PROTECTED]>

Reply via email to