set_label and get_label

Andrew Whitworth wknight8111 at
Mon Jul 27 22:17:07 UTC 2009

As per discussion in TT #218, I've just added two new experimental
opcodes: set_label and get_label.

The issue that we're trying to resolve is that there are two
orthogonal uses for the current get_addr/set_addr ops: the first (used
often by Perl6 for example) is to get a unique memory address for the
PMC. The second, used by Sub, Continuation, and ExceptionHandler (and
other similar things) is to associate a label in PIR code with a PMC.

The get_label/set_label opcodes are designed to serve the later
purpose. They have a benefit over get_addr/set_addr in that they can
eventually contain some error checking and bounds checking on the
pointers because they are expected to be valid labels.

Eventually, get_addr will be modified to always return the unique
memory address of the PMC argument, like what Perl6 needs. set_addr
will disappear eventually because it's basically just a wrapper around
VTABLE_set_pointer, which when combined with most arbitrary PMC types
is just a factory for segfaults.

Questions, comments appreciated.

--Andrew Whitworth

More information about the parrot-dev mailing list