NAME

experimental.ops - Experimental Opcodes

DESCRIPTION

This file contains experimental opcodes.

These opcodes should be considered implicitly deprecated - that is, they may be removed in any release.

If you rely on any of these opcodes, please open a https://trac.parrot.org/.

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

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

trap()
Break into debugger. Implementation notes:
 - x86/gcc ... works with gdb
 - ppc/gcc ... works with gdb, to proceed: gdb> p $pc = $pc + 4
 - TODO
For other architectures, this is a noop.
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.
substr_r(out STR, in STR, in INT, in INT)
Make $1 refer to the given part of $2, basically like above, but it is reusing the given destination string and does not care if the source string is changed later. This is changed includes also GC runs, which will move the referenced string. This also means that $1 has to be reset before any GC may happen.This opcode should really be just used to quickly refer to a substring of another part, e.g. for printing and is a temporary hack.Handle with care.

COPYRIGHT

Copyright (C) 2001-2009, Parrot Foundation.

LICENSE

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