|parrotcode: Parrot Operation|
|Contents | Perl Modules|
Parrot::Op - Parrot Operation
Parrot::Op represents a Parrot operation (op, for short), as read from an ops file via
Parrot::OpsFile, or perhaps even generated by some other means. It is the Perl equivalent of the
struct defined in include/parrot/op.h.
Ops are either auto or manual. Manual ops are responsible for having explicit next-op
RETURN() statements, while auto ops can count on an automatically generated next-op to be appended to the op body.
Note that tools/build/ops2c.pl supplies either 'inline' or 'function' as the op's type, depending on whether the
inline keyword is present in the op definition. This has the effect of causing all ops to be considered manual.
Note that argument 0 is considered to be the op itself, with arguments 1..9 being the arguments passed to the op.
Op argument direction and type are represented by short one or two letter descriptors.
i The argument is incoming o The argument is outgoing io The argument is both incoming and outgoing
i The argument is an integer register index. n The argument is a number register index. p The argument is a PMC register index. s The argument is a string register index. ic The argument is an integer constant (in-line). nc The argument is a number constant index. pc The argument is a PMC constant index. sc The argument is a string constant index. kc The argument is a key constant index. ki The argument is a key integer register index. kic The argument is a key integer constant (in-line).
new($code, $type, $name, $args, $argdirs, $labels, $flags)
$codeis the integer identifier for the op.
$typeis the type of op (see the note on op types above).
$nameis the name of the op.
$argsis a reference to an array of argument type descriptors.
$argdirsis a reference to an array of argument direction descriptors. Element x is the direction of argument
$labelsis a reference to an array of boolean values indicating whether each argument direction was prefixed by '
$flagsis a hash reference containing zero or more hints or directives.
name(). For ops with arguments, an underscore followed by underscore-separated argument types are appended to the name.
full_name(), but with '
op_jump_tvalues joined with
|(see include/parrot/op.h). This indicates if and how an op may jump.
full_body()is the same as
body(). For auto ops this method adds a final
goto NEXT()line to the code to represent the auto-computed return value. See the note on op types above.
VTABLE_macros are enforced by converting
full_body()of the op with substitutions made by
$trans(a subclass of
Author: Gregor N. Purdy <firstname.lastname@example.org>