Leopold Toetsch wrote:

> I currently can't imagine any useful RL example for the current 
> implementation of set_p_p as $1=$2, _if_ the involved PMC types are 
> different.

You need to differentiate between the PMC itself, and a Parrot register
that holds the address of a PMC. In the instruction "set Px, Py" the only
PMC involved is the one pointed to by register Py; if Px happens to point
to a PMC then that linkage will be broken, with no effect on the PMC
(previously) pointed to by Px; the register Px will then point to the same
PMC as Py does.
In the code snippet you originally posted, there seemed to be no need
for this; however, calling subroutines, for example, will require that the
addresses of the parameters be placed in specific registers, and so
the set operation may well be used frequently in those circumstances.

The instruction that performed the actual assignment to the PMC was
the "set Px, 2" instruction; this (which may be replaced by "assign")
calls the set_integer_native vtable method. Since the PMC type is
PerlUndef at that point, the current automatic morphing kicks in, and
the PMC actually gets turned into a PerlInt - in future, the perl compiler
will have to create a PMC with the correct type initially, and this
morphing will be removed for typed variables. 
-- 
Peter Gibbs
EmKel Systems

Reply via email to