NAME ^

stack.ops - Stack Ops

DESCRIPTION ^

Operations that manipulate Parrot's register, user and integer stacks.

Register stack operations ^

These operations affect entire sets of registers.

popi()

popn()

popp()

pops()

Restore all the registers of the type indicated in the name of the operation from the most recently pushed register frames.

A register frame holds only 16 registers, so we pop two frames from the frame stack. We use the first frame to restore registers 16-31, and the second frame to restore registers 0-15. By restoring in this order, we ensure that a push followed by a pop returns the working set of registers to their original state.

popbottomi()

popbottomn()

popbottomp()

popbottoms()

Restore registers 0-15 of the type indicated in the name of the operation from a register frame popped off the corresponding frame stack.

poptopi()

poptopn()

poptopp()

poptops()

Restore registers 16-31 of the type indicated in the name of the operation from a register frame popped off the corresponding frame stack.

pushi()

pushn()

pushp()

pushs()

Save all the registers of the type indicated in the name of the operation on the appropriate register frame stack.

A register frame holds only 16 registers, so we push two frames onto the stack. The first frame holds the values from registers 0-15; the second frame holds the values from registers 16-31.

pushtopi()

pushtopn()

pushtopp()

pushtops()

Save registers 16-31 of the type indicated in the name of the operation on the appropriate register frame stack.

pushbottomi()

pushbottomn()

pushbottomp()

pushbottoms()

Save registers 0-15 of the type indicated in the name of the operation on the appropriate register frame stack.

saveall()

Save all of the registers onto the appropriate frame stacks. This op is equivalent to:

        pushi
        pushn
        pushs
        pushp
(or some other permutation of these ops).

restoreall()

Restore all the registers from the appropriate frame stacks. This op is equivalent to:

        popi
        popn
        pops
        popp
(or some other permutation of these ops).

savetop()

Save registers 16-31 of all the register sets on the appropriate frame stacks. This op is equivalent to:

        pushtopi
        pushtopn
        pushtops
        pushtopp
(or some other permutation of these ops).

restoretop()

Restore registers 16-31 of all the register sets from the appropriate frame stacks. This op is equivalent to:

        poptopi
        poptopn
        poptops
        poptopp
(or some other permutation of these ops).

User stack operations ^

These operations affect individual registers.

entrytype(out INT, in INT)

Gets the type of entry $2 of the user stack and puts it in $1.

depth(out INT)

Puts the depth of the user stack in $1.

lookback(out INT, in INT)

lookback(out STR, in INT)

lookback(out NUM, in INT)

lookback(out PMC, in INT)

Finds the entry in the user stack at offset $2 from the top and put it in register $1. Positive numbers count down from the top of the stack, negative numbers count up from the bottom. (0 is the topmost entry, -1 is the bottom-most)

save(in INT)

save(in NUM)

save(in STR)

save(in PMC)

Save register or constant $1 onto the user stack.

savec(in STR)

Save a clone of register or constant $1 onto the user stack.

restore(out INT)

restore(out NUM)

restore(out PMC)

restore(out STR)

Restore register $1 from the user stack.

rotate_up(in INT)

Rotate the top $1 entries in the user stack by one. If $1 is positive, then the stack rotates upwards: the ($1)th entry becomes the ($1-1)th entry and so on, all the way up to the top of the stack, while the entry formerly at the top of the stack becomes the new ($1)th entry. If $1 is negative, the stack rotates downwards: the top entry becomes the second entry, the second becomes the third etc., while the former ($1)th entry becomes the new top entry.

intsave(in INT)

Save register or constant $1 onto the high-speed int stack.

intrestore(out INT)

Restore register $1 from the high-speed int stack.

intdepth(out INT)

Puts the depth of the high-speed int stack in $1.

COPYRIGHT ^

Copyright (C) 2001-2004 The Perl Foundation. All rights reserved.

LICENSE ^

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


parrot