Public Types | Public Member Functions | Friends

gnash::CallFrame Class Reference

A CallFrame is an element of a CallStack. More...

#include <CallStack.h>

Collaboration diagram for gnash::CallFrame:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::vector< as_valueRegisters

Public Member Functions

 CallFrame (UserFunction *func)
 Construct a CallFrame for a specific UserFunction.
 CallFrame (const CallFrame &other)
 Copy constructor for containers.
CallFrameoperator= (const CallFrame &other)
 Assignment operator for containers.
as_objectlocals ()
 Access the local variables for this function call.
UserFunctionfunction ()
 Get the function for which this CallFrame provides a scope.
const as_valuegetLocalRegister (size_t i) const
 Get a specific register in this CallFrame.
void setLocalRegister (size_t i, const as_value &val)
 Set a specific register in this CallFrame.
bool hasRegisters () const
 Set the number of registers for this CallFrame.
void markReachableResources () const
 Mark all reachable resources.

Friends

std::ostream & operator<< (std::ostream &, const CallFrame &)

Detailed Description

A CallFrame is an element of a CallStack.

A CallFrame exists for the duration of a UserFunction call. NativeFunctions have no call frame. The CallFrame provides space for local registers and local variables. These values are discarded when the CallFrame is destroyed at the end of a function call. It provides a scope for the function's execution.


Member Typedef Documentation

typedef std::vector<as_value> gnash::CallFrame::Registers

Constructor & Destructor Documentation

gnash::CallFrame::CallFrame ( UserFunction func  ) 

Construct a CallFrame for a specific UserFunction.

Parameters:
func The UserFunction to create the CallFrame for. This must provide information about the amount of registers to allocate.
gnash::CallFrame::CallFrame ( const CallFrame other  )  [inline]

Copy constructor for containers.


Member Function Documentation

UserFunction& gnash::CallFrame::function (  )  [inline]

Get the function for which this CallFrame provides a scope.

Referenced by gnash::ActionExec::ActionExec(), and gnash::Function2::call().

const as_value* gnash::CallFrame::getLocalRegister ( size_t  i  )  const [inline]

Get a specific register in this CallFrame.

Parameters:
i The index of the register to return.
Returns:
A pointer to the value in the register or 0 if no such register exists.

Referenced by gnash::VM::getRegister().

bool gnash::CallFrame::hasRegisters (  )  const [inline]

Set the number of registers for this CallFrame.

The number of registers may only be set once! This is to ensure that pointers to the register values are always valid.

Referenced by gnash::VM::getRegister(), and gnash::VM::setRegister().

as_object& gnash::CallFrame::locals (  )  [inline]

Access the local variables for this function call.

Referenced by gnash::ActionExec::ActionExec().

void gnash::CallFrame::markReachableResources (  )  const

Mark all reachable resources.

Reachable resources would be registers and locals (expected to be empty?) and function.

References gnash::for_each(), gnash::as_value::setReachable(), and gnash::GcResource::setReachable().

CallFrame& gnash::CallFrame::operator= ( const CallFrame other  )  [inline]

Assignment operator for containers.

void gnash::CallFrame::setLocalRegister ( size_t  i,
const as_value val 
)

Set a specific register in this CallFrame.

If the register doesn't exist, nothing happens.

Parameters:
i The index of the register to set.
val The value to set the register to.

References _, and IF_VERBOSE_ACTION.

Referenced by gnash::Function2::call(), and gnash::VM::setRegister().


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  ,
const CallFrame  
) [friend]

The documentation for this class was generated from the following files: