experimental.ops - Experimental Operations


This file contains operations that are in an experimental state. Do not rely upon the existence of the ops in this file when writing production code. No decision has yet been made as to whether they are accepted as regular Parrot ops or not. They are included here for testing purposes only!

IO operations ^


Print a newline char to standard output.

print_newline(invar PMC)

Print a newline char to IO stream object $1.

Mathematical operations ^

Implementations of various mathematical operations

gcd(out INT, in NUM, in NUM)

Greatest Common divisor of $2 and $3.

gcd(out INT, out INT, out INT, in INT, in INT)

Given $4 and $5, it calculates $1, $2 and $3 so that

$1 = gcd($4, $5) = $2 * $4 + $3 * $5 (d = gcd(a,b) = x*a + y*b)

Misc other ops ^

splice(invar PMC, invar PMC, in INT, in INT)

Replace $4 values at offset $3 in aggregate $1 with the PMCs in aggregate $2. The values are put into the aggregate by a shallow copy. If the values would be reused, they have to be cloned.

slice(out PMC, invar PMC, in KEY)

Return a new Iterator PMC $1 for aggregate $2 and Slice PMC $3.

slice(out PMC, invar PMC, in KEY, inconst INT)

Return a new list PMC $1 for aggregate $2 and Slice PMC $3.

This is a Python opcode. Range is i <= k < j. $4 must be 1. May change and move to python.ops.

iter(out PMC, invar PMC)

Return a new Iterator PMC $1 for aggregate $2.

morph(invar PMC, in INT)

Have $1 turn itself into a PMC of type $2.

exec(in STR)

Execute the passed-in command. Completely tosses the current process image and replaces it with the command. Doesn't exit (the program ends, after all), though it does throw an exception if something goes wrong.

classname(out PMC, invar PMC)

Get the class name for the class in $2 and put it in $1. Note that $1 will be a Key PMC that you can use with "new", for example.

More Experimental Ops ^


Break into debugger. Implementation notes:

 - x86/gcc ... works with gdb
 - ppc/gcc ... works with gdb, to proceed: gdb> p $pc = $pc + 4
For other architectures, this is a noop.

pow(out NUM, in NUM, in INT)

Set $1 to $2 raised to the power $3.

op getclass(out PMC, in INT)

Return the class PMC of the type $2.

new(out PMC, in INT, in STR)

Create a new PMC of the type $2 according to the PMCs string representation in $3. See also instantiate for a more general form.


instantiate(out PMC)

Create a new PMC of the type of class ARGS[0]. This is a classmethod. Arguments are passed according to the calling conventions in docs/pdds/pdd03_calling_conventions.pod with the set_args opcode. See also the getclass opcode to get a class PMC. BUT SINCE INSTANTIATE WILL PROBABLY DIE, DON'T USE IT; OR IF YOU NEED IT, TELL CHIP

pmcinfo(out INT, invar PMC, inconst INT)

Extract some information about PMC $2 and store it in $1. Possible values for $3 are:

.PMCINFO_FLAGS Get the PMC's flags.

RT#42375 move/officalize this opcode at next op cleanup.

new(out PMC, invar PMC)

Instantiate a new object from a string PMC or key name, or from a class object. For strings and keys, first check the namespace for a class object, then fall back to the type ID if no class object is stored in the namespace.

add_io_event(invar PMC, invar PMC, invar PMC, inconst INT)

Call the sub $2 for PIO $1 with user data $3 on ready state of $4. RT#42376 The only handled $4 = IO_THR_MSG_ADD_SELECT_RD aka 2 for now.

need_finalize(invar PMC)

The ParrotObject $1 needs the __finalize method during GC.

runinterp(invar PMC, in PMC)

Invokes the PMC $2 using interp $1.

newpdd15class(out PMC, in STR)

Creates a new Parrot-style class, named $2, and puts the new PMC for it into $1.

newpdd15class(out PMC, in PMC)

Create a new Parrot-style class, with the hierarchical name given in $2.


Copyright (C) 2001-2004, The Perl Foundation.


This program is free software. It is subject to the same license as the Parrot interp itself.