Public Member Functions

gnash::abc::Machine Class Reference

The virtual machine for executing ABC (ActionScript Bytecode). More...

#include <Machine.h>

Collaboration diagram for gnash::abc::Machine:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Machine (VM &vm)
 Create an AS3 interpreter.
void init ()
 Initialize the AS resources.
DisplayObjectgetTarget ()
 The DisplayObject which initiated these actions.
void setTarget (DisplayObject *target)
int completeName (MultiName &name, int initial=0)
ClassfindSuper (as_value &obj, bool find_primitive)
void getMember (Class *pDefinition, MultiName &name, as_value &source)
void setMember (Class *, MultiName &, as_value &target, as_value &val)
PropertyfindProperty (MultiName &)
void execute ()
void pushGet (as_object *this_obj, as_value &return_slot, Property *prop)
void pushSet (as_object *this_obj, as_value &value, Property *prop)
void pushCall (as_function *func, as_object *pThis, as_value &return_slot, unsigned char stack_in, short stack_out)
void immediateFunction (const as_function *to_call, as_object *pThis, as_value &storage, unsigned char stack_in, short stack_out)
void immediateProcedure (const as_function *to_call, as_object *pthis, unsigned char stack_in, short stack_out)
void initMachine (AbcBlock *pool_block)
as_value executeFunction (Method *function, const fn_call &fn)
void instantiateClass (std::string className, as_object *global)
Global_asglobal ()
 Return the Global object for this Machine.
void markReachableResources () const

Detailed Description

The virtual machine for executing ABC (ActionScript Bytecode).

This machine is intended to work without relying on the C++ call stack, by resetting its Stream and Stack members (actually, by limiting the stack) to make function calls, rather than calling them directly in C++. As a result, many of the internal calls are void functions even though they will be returning some value. The exception to this is that C++ native functions defined in ActionScript objects will be called in the typical way.

The C++ exceptions mechanism is used for exception handling, since this allows both ActionScript code and C++ code to use the exception handling with a minimum of hassle, and it helps with correctness.

It was intended that this Machine should run both AS2 and AS3 code. However, as the two codestreams must be strictly separated - different global objects, no sharing of resources, and no ability to communicate directly, there is no sense in using a single instance of this machine for both AS2 and AS3 interpretation. It's questionable whether there is any advantage in using this Machine for AS2; it is not a near-term goal.


Constructor & Destructor Documentation

gnash::abc::Machine::Machine ( VM vm  ) 

Create an AS3 interpreter.


Member Function Documentation

int gnash::abc::Machine::completeName ( MultiName name,
int  initial = 0 
)

This will complete a name in AS3, where a part of the name is stored in the stream and another part may be stored on the stack.

Parameters:
name A partially filled MultiName, this should be the id from the stream.
initial The depth in the stack where the stack objects may be found.
Returns:
The number of stack elements used by the name. At present, always 0, 1, or 2. These are not dropped.
void gnash::abc::Machine::execute (  ) 

This is not actually an opcode -- it occurs when the stream is empty. We may need to return from a function, or we may be done.

0x01 ABC_ACTION_BKPT Do: Enter the debugger if one has been invoked. This is a no-op. Enable it if desired. 0x02 ABC_ACTION_NOP Do: Nothing. 0xF3 ABC_ACTION_TIMESTAMP

0x03 ABC_ACTION_THROW Stack In: obj -- an object Stack Out: Do: Throw obj as an exception Equivalent: ACTIONTHROW

0x04 ABC_ACTION_GETSUPER Stream: name_id -- V32 index to multiname 'name' Stack In: [ns [n]] -- Namespace stuff. obj -- an object Stack Out: obj.super.name May be the same as the value of obj.name (E.g. inherited variables)

0x05 ABC_ACTION_SETSUPER Stream: UV32 index to multiname 'name' Stack In: val -- an object [ns [n]] -- Namespace stuff. obj -- an object Stack Out: Do: Set obj.super.name to val, if allowable.

0x06 ABC_ACTION_DXNS Default XML Namespace Stream: UV32 index to string pool 'nsname' Do: Create a new public namespace with name nsname, and make this the default XML namespace.

0x07 ABC_ACTION_DXNSLATE Stack In: nsname -- a string object Stack Out: Do: Same as ABC_ACTION_DXNS, but the uri is in the stack, not the stream.

0x08 ABC_ACTION_KILL Stream: UV32 frame pointer offset 'offset' Frame: Kill at offset Equivalent: ACTION_DELETE

0x09 ABC_ACTION_LABEL Do: Unknown purpose, Tamarin does nothing.

0x0C ABC_ACTION_IFNLT Stream: S24 jump offset 'jump' Stack In: b -- an object a -- an object Stack Out: Do: If !(a < b) move by jump in stream, as ABC_ACTION_JUMP does.

0x0D ABC_ACTION_IFNLE Stream: S24 jump offset 'jump' Stack In: b -- an object a -- an object Stack Out: Do: If !(a <= b) move by jump in stream, as ABC_ACTION_JUMP does.

0x0E ABC_ACTION_IFNGT Stream: S24 jump offset 'jump' Stack In: b -- an object a -- an object Stack Out: Do: If !(a > b) move by jump in stream, as ABC_ACTION_JUMP does.

0x0F ABC_ACTION_IFNGE Stream: S24 jump offset 'jump' Stack In: a -- an object b -- an object Stack Out: Do: If !(a >= b) move by jump in stream, as ABC_ACTION_JUMP does.

0x10 ABC_ACTION_JUMP Stream: S24 jump offset 'jump' Do: If jump is negative, check for interrupts. Move by jump in stream. Equivalent: ACTION_BRANCHALWAYS

0x11 ABC_ACTION_IFTRUE Stream: S24 jump offset 'jump' Stack In: a -- an object Stack Out: Do: If a is 'true', move by jump in stream, as ABC_ACTION_JUMP does. Equivalent: ACTION_BRANCHIFTRUE

0x12 ABC_ACTION_IFFALSE Stream: S24 jump offset 'jump' Stack In: a -- an object Stack Out: Do: If a is 'false', move by jump in stream, as ABC_ACTION_JUMP does.

0x13 ABC_ACTION_IFEQ Stream: S24 jump offset 'jump' Stack In: b -- an object a -- an object Stack Out: Do: If a == b (weakly), move by jump in stream, as ABC_ACTION_JUMP does.

0x14 ABC_ACTION_IFNE Stream: S24 jump offset 'jump' Stack In: b -- an object a -- an object Stack Out: Do: If a != b (weakly), move by jump in stream, as ABC_ACTION_JUMP does.

0x15 ABC_ACTION_IFLT Stream: S24 jump offset 'jump' Stack In: b -- an object a -- an object Stack Out: Do: If a < b move by jump in stream, as ABC_ACTION_JUMP does.

0x16 ABC_ACTION_IFLE Stream: S24 jump offset 'jump' Stack In: b -- an object a -- an object Stack Out: Do: If a <= b move by jump in stream, as ABC_ACTION_JUMP does.

0x17 ABC_ACTION_IFGT Stream: S24 jump offset 'jump' Stack In: b -- an object a -- an object Stack Out: Do: If a > b move by jump in stream, as ABC_ACTION_JUMP does.

0x18 ABC_ACTION_IFGE Stream: S24 jump offset 'jump' Stack In: b -- an object a -- an object Stack Out: Do: If a >= b move by jump in stream, as ABC_ACTION_JUMP does.

0x19 ABC_ACTION_IFSTRICTEQ Stream: S24 jump offset 'jump' Stack In: b -- an object a -- an object Stack Out: Do: If a == b (strictly), move by jump in stream, as ABC_ACTION_JUMP

0x1A ABC_ACTION_IFSTRICTNE Stream: S24 jump offset 'jump' Stack In: b -- an object a -- an object Stack Out: Do: If a != b (strongly), move by jump in stream, as ABC_ACTION_JUMP

0x18 ABC_ACTION_LOOKUPSWITCH Stream: 3 bytes | V32 count as 'case_count - 1' | case_count of S24 as 'cases' Stack In: index -- an integer object Stack Out: Do: If index >= case_count, reset stream to position on op entry. Otherwise, move by cases[index] - 1 from stream position on op entry.

0x30 ABC_ACTION_PUSHSCOPE

0x1C ABC_ACTION_PUSHWITH Stack In: scope -- a scope Stack Out: Do: Enter scope with previous scope as its base. If 0x1C, start a new base if the previous one was global.

0x1D ABC_ACTION_POPSCOPE Do: exit current scope. Clear the base if the depth is now shallower than the base's depth.

0x1E ABC_ACTION_NEXTNAME Stack In: index -- an integer object obj -- an object Stack Out: name -- the key name of the property at index in obj

0x1F ABC_ACTION_HASNEXT Stack In: index -- an integer object obj -- an object Stack Out: next_index -- next index after index in obj, or 0 if none. Do: If the index is 0, return the first logical property. We'll do this by name, since the name id can be used for this directly.

0x20 ABC_ACTION_PUSHNULL Stack Out: n -- a Null object.

0x21 ABC_ACTION_PUSHUNDEFINED Stack Out: n -- an Undefined object.

0x23 ABC_ACTION_NEXTVALUE Stack In: index -- an integer object obj -- an object (namespaces okay) Stack Out: value -- the value of the key value pair in obj at index.

0x24 ABC_ACTION_PUSHBYTE Stream: S8 as 'byte' Stack Out: byte -- as a raw byte

0x25 ABC_ACTION_PUSHSHORT Stream: V32 as 'value' Stack Out: value -- as a raw integer

0x26 ABC_ACTION_PUSHTRUE Stack Out: true -- the True object

0x27 ABC_ACTION_PUSHFALSE Stack Out: false -- the False object

0x28 ABC_ACTION_PUSHNAN Stack Out: NaN -- the NaN object

0x29 ABC_ACTION_POP Stack In: a -- anything Stack Out: 0x2A ABC_ACTION_DUP Stack In: a -- anything Stack Out: a a

0x2B ABC_ACTION_SWAP Stack In: a -- anything b -- anything Stack Out: b a

0x2C ABC_ACTION_PUSHSTRING Stream: V32 string pool index 'index' Stack Out: value -- String object from string_pool[index]

0x2D ABC_ACTION_PUSHINT Stream: V32 int pool index 'index' Stack Out: value -- Integer object from integer_pool[index]

0x2E ABC_ACTION_PUSHUINT Stream: V32 uint pool index 'index' Stack Out: value -- Unsigned Integer object from unsigned_integer_pool[index]

0x2F ABC_ACTION_PUSHDOUBLE Stream: V32 double pool index 'index' Stack Out: value -- Double object from double_pool[index]

0x31 ABC_ACTION_PUSHNAMESPACE Stream: V32 namespace pool index 'index' Stack Out: ns -- Namespace object from namespace_pool[index]

0x32 ABC_ACTION_HASNEXT2 Stream: V32 frame location 'objloc' | V32 frame location 'indexloc' Stack Out: truth -- True if frame[objloc] has key/val pair after frame[indexloc], following delegates (__proto__) objects if needed. False, otherwise. Frame: Change at objloc to object which possessed next value. Change at indexloc to index (as object) of the next value. N.B.: A value of '0' for indexloc initializes to the first logical property.

0x40 ABC_ACTION_NEWFUNCTION Stream: V32 'index' Stack Out: func -- the function object Do: Information about function is in the pool at index. Construct the function from this information and bind the current scope.

0x41 ABC_ACTION_CALL Stream: V32 'arg_count' Stack In: argN ... arg1 -- the arg_count arguments to pass obj -- the object to which the function belongs func -- the function to be called Stack Out: value -- the value returned by obj->func(arg1, ...., argN)

0x42 ABC_ACTION_CONSTRUCT Stream: V32 'arg_count' Stack In: argN ... arg1 -- the arg_count arguments to pass function -- constructor for the object to be constructed Stack Out: value -- obj after it has been constructed as obj(arg1, ..., argN)

0x43 ABC_ACTION_CALLMETHOD Stream: V32 'method_id + 1' | V32 'arg_count' Stack In: argN ... arg1 -- the arg_count arguments to pass obj -- the object to be called Stack Out: value -- the value returned by obj::'method_id'(arg1, ..., argN)

0x44 ABC_ACTION_CALLSTATIC Stream: V32 'method_id' | V32 'arg_count' Stack In: argN ... arg1 -- the arg_count arguments to pass obj -- the object to act as a receiver for the static call Stack Out: value -- the value returned by obj->ABC::'method_id' (arg1, ..., argN)

0x45 ABC_ACTION_CALLSUPER 0x4E ABC_ACTION_CALLSUPERVOID Stream: V32 'name_offset' | V32 'arg_count' Stack In: [ns [n]] -- Namespace stuff argN ... arg1 -- the arg_count arguments to pass obj -- the object whose super is to be called Stack Out: 0x45: value -- the value returned by obj::(resolve)'name_offset':: super(arg1, ..., argN) 0x4E: .

0x46 ABC_ACTION_CALLPROPERTY 0x4C ABC_ACTION_CALLPROPLEX 0x4F ABC_ACTION_CALLPROPVOID Stream: V32 'name_offset' | V32 'arg_count' Stack In: argN ... arg1 -- the arg_count arguments to pass [ns [n]] -- Namespace stuff obj -- The object whose property is to be accessed. Stack Out: value -- the value from obj::(resolve)'name_offset' (arg1, ..., argN) (unless ABC_ACTION_CALL_PROPVOID, then: . ) NB: Calls getter/setter if they exist. If the opcode is ABC_ACTION_CALLPROPLEX, obj is not altered by getter/setters

0x47 ABC_ACTION_RETURNVOID Do: Return an undefined object up the callstack.

0x48 ABC_ACTION_RETURNVALUE Stack In: value -- value to be returned Stack Out: Do: Return value up the callstack.

0x49 ABC_ACTION_CONSTRUCTSUPER Stream: V32 'arg_count' Stack In: argN ... arg1 -- the arg_count arguments obj -- the object whose super's constructor should be invoked Stack Out: 0x4A ABC_ACTION_CONSTRUCTPROP Stream: V32 'name_offset' | V32 'arg_count' Stack In: argN ... arg1 -- the arg_count arguments to pass [ns [n]] -- Namespace stuff obj -- the object whose property should be constructed Stack Out: value -- the newly constructed prop from obj::(resolve) 'name_offset'(arg1, ..., argN)

0x55 ABC_ACTION_NEWOBJECT Stream: V32 'arg_count' Stack In: prop_value_1 -- a value object prop_name_1 -- a string . (arg_count value/name pairs in all) prop_value_n -- a value object prop_name_n -- a string Stack Out: obj -- A new object which contains all of the given properties. NB: This builds an object from its properties, it's not a constructor.

0x56 ABC_ACTION_NEWARRAY Stream: V32 'array_size' Stack In: value_n -- a value . (array_size of these) value_1 -- a value Stack Out: array -- an array { value_1, value_2, ..., value_n }

0x57 ABC_ACTION_NEWACTIVATION Stack Out: vtable -- A new virtual table, which has the previous one as a parent.

0x58 ABC_ACTION_NEWCLASS Stream: V32 'class_id' Stack In: obj -- An object to be turned into a class. Its super is constructed. Stack Out: class -- The newly made class, made from obj and the information at cinits_pool[class_id] NB: This depends on scope and scope base (to determine lifetime(?))

This can be null.

0x59 ABC_ACTION_GETDESCENDANTS Stream: V32 'name_id' Stack In: value -- Whose descendants to get [ns [n]] -- Namespace stuff Stack Out: ? NB: This op seems to always throw a TypeError in Tamarin, though I assume that it ought to do something to yield a list of descendants of a class.

0x5A ABC_ACTION_NEWCATCH Stream: V32 'catch_id' Stack Out: vtable -- vtable suitable to catch an exception of type in catch_id. NB: Need more information on how exceptions are set up.

0x5D ABC_ACTION_FINDPROPSTRICT 0x5E ABC_ACTION_FINDPROPERTY Stream: V32 'name_id' Stack In: [ns [n]] -- Namespace stuff Stack Out: owner -- object which owns property given by looking up the name_id. 0x5D is the undefined object if not found 0x5E throws a ReferenceError if not found

0x5F ABC_ACTION_FINDDEF Stream: V32 'name_id' (no ns expansion) Stack Out: def -- The definition of the name at name_id.

0x60 ABC_ACTION_GETLEX Stream: V32 'name_id' (no ns expansion) Stack Out: property -- The result of 0x5D (ABC_ACTION_FINDPROPSTRICT) + 0x66 (ABC_ACTION_GETPROPERTY)

ABC_ACTION_SETPROPERTY Stream: V32 'name_id' Stack In: value -- The value to be used [ns [n]] -- Namespace stuff OR [key] -- Key name for property. Will not have both Namespace and key. obj -- The object whose property is to be set Stack Out: NB: If the name at name_id is completely qualified, neither a namespace nor a key is needed. If the name_id refers to a name with a runtime namespace, then this will be used. If neither of those is true and obj is a dictionary and key is a name, then the name_id is discarded and key/value is set in the dictionary obj instead.

0x62 ABC_ACTION_GETLOCAL Stream: V32 'frame_index' Frame: value at frame_index is needed Stack Out: value

0x63 ABC_ACTION_SETLOCAL Stream: V32 'frame_index' Frame: obj at frame_index is set to value Stack In: value Stack Out: 0x64 ABC_ACTION_GETGLOBALSCOPE Stack Out: global -- The global scope object

0x65 ABC_ACTION_GETSCOPEOBJECT Stream: S8 'depth' Stack Out: scope -- The scope object at depth

0x66 ABC_ACTION_GETPROPERTY Stream: V32 'name_id' Stack In: [ns [n]] -- Namespace stuff OR [key] -- Key name for property. Will not have both Namespace and key. obj -- The object whose property is to be retrieved Stack Out: prop -- The requested property. NB: See 0x61 (ABC_ACTION_SETPROPETY) for the decision of ns/key.

0x68 ABC_ACTION_INITPROPERTY Stream V32 'name_id' Stack In: value -- The value to be put into the property. [ns [n]] -- Namespace stuff obj -- The object whose property is to be initialized Stack Out: Do: Set obj::(resolve)'name_id' to value, set bindings from the context.

0x6A ABC_ACTION_DELETEPROPERTY Stream: V32 'name_id' Stack In: [ns [n]] -- Namespace stuff obj -- The object whose property should be deleted. Stack Out: truth -- True if property was deleted or did not exist, else False.

0x6C ABC_ACTION_GETSLOT Stream: V32 'slot_index + 1' Stack In: obj -- The object which owns the desired slot. Stack Out: slot -- obj.slots[slot_index]

0x6D ABC_ACTION_SETSLOT Stream: V32 'slot_index + 1' Stack In: value -- The value intended for the slot. obj -- The object whose slot should be set. Stack Out: Do: obj.slots[slot_index] = value

Slot index must be greater than 0 and less than or equal to the number of slots (so one-based index?).

0x6E ABC_ACTION_GETGLOBALSLOT Stream: V32 'slot_index + 1' Stack In: Stack Out: slot -- globals.slots[slot_index] NB: Deprecated

0x6F ABC_ACTION_SETGLOBALSLOT Stream: V32 'slot_index + 1' Stack In: value -- The value to be placed into the slot. Stack Out: Do: globals[slot_index] = value NB: Deprecated

0x70 ABC_ACTION_CONVERT_S Stack In: value -- An object Stack Out: str_value -- value as a string

0x71 ABC_ACTION_ESC_XELEM Stack In: value -- An object to be escaped Stack Out: str_value -- value as a string, escaped suitably for an XML element.

0x72 ABC_ACTION_ESC_XATTR Stack In: value -- An object to be escaped Stack Out: str_value -- value as a string, escaped suitably for an XML attribute.

0x73 ABC_ACTION_CONVERT_I 0x83 ABC_ACTION_COERCE_I (deprecated) Stack In: value -- An object to be converted to Integer Stack Out: int_value -- value as an integer object

0x74 ABC_ACTION_CONVERT_U 0x88 ABC_ACTION_COERCE_U (deprecated) Stack In: value -- An object to be converted to unsigned integer Stack Out: int_value -- value as an unsigned integer object

0x75 ABC_ACTION_CONVERT_D 0x84 ABC_ACTION_COERCE_D (deprecated) Stack In: value -- An object to be converted to a double Stack Out: double_value -- value as a double object

0x76 ABC_ACTION_CONVERT_B 0x81 ABC_ACTION_COERCE_B (deprecated) Stack In: value -- An object to be converted to a boolean Stack Out: bool_value -- value as a boolean object

0x77 ABC_ACTION_CONVERT_O Stack In: obj -- An object Stack Out: obj -- An object Do: If obj is Undefined or Null, throw TypeError

0x78 ABC_ACTION_CHECKFILTER Stack In: obj -- An object Stack Out: obj -- An object Do: If obj is not XML based, throw TypeError

0x80 ABC_ACTION_COERCE Stream: V32 'name_index' Stack In: [ns [n]] -- Possibly name/namespace stuff obj -- An object to be converted Stack Out: coerced_obj -- The object as the desired (resolve)

0x82 ABC_ACTION_COERCE_A Stack In: obj -- An object to be converted Stack Out: obj Do: Nothing. (The 'a' is for atom, and it's unclear if anything is needed.)

0x85 ABC_ACTION_COERCE_S Stack In: obj -- An object to be converted Stack Out: str_obj -- obj as string. nullString object if obj is Null or Undefined

0x86 ABC_ACTION_ASTYPE Stream: V32 'name_index' Stack In: [ns [n]] -- Possible namespace stuff obj -- An object to be checked Stack Out: cobj -- obj if obj is of type (resolve)'name_index', otherwise Null

0x87 ABC_ACTION_ASTYPELATE Stack In: valid -- The object whose type is to be matched obj -- An object to be checked Stack Out: cobj -- obj if type of obj conforms to valid, otherwise Null

0x89 ABC_ACTION_COERCE_O Stack In: obj -- An object Stack Out: cobj -- obj if obj is not Undefined, otherwise Null

0x90 ABC_ACTION_NEGATE Stack In: obj -- An object Stack Out: negdouble -- -1.0 * (double) obj

0x91 ABC_ACTION_INCREMENT Stack In: num -- A number, integer or double Stack Out: num + 1

0x92 ABC_ACTION_INCLOCAL Stream: V32 'frame_addr' Frame: Load i from frame_addr and increment it.

0x93 ABC_ACTION_DECREMENT Stack In: num -- A number, integer or double Stack Out: num - 1

0x94 ABC_ACTION_DECLOCAL Stream: V32 'frame_addr' Frame: Load i from frame_addr and decrement it.

0x95 ABC_ACTION_ABC_TYPEOF Stack In: obj -- An object Stack Out: type -- typeof(obj) as a string

0x96 ABC_ACTION_NOT Stack In: obj -- An object Stack Out: nobj -- A truth object with value !((Boolean) obj)

0x97 ABC_ACTION_BITNOT Stack In: obj -- An object Stack Out: nint -- ~((Int) obj)

0xA0 ABC_ACTION_ADD Stack In: a b Stack Out: a + b (double if numeric)

0xA1 ABC_ACTION_SUBTRACT Stack In: b a Stack Out: a - b (double)

0xA2 ABC_ACTION_MULTIPLY Stack In: a b Stack Out: a * b (double)

0xA3 ABC_ACTION_DIVIDE Stack In: b a Stack Out: a / b (double)

0xA4 ABC_ACTION_MODULO Stack In: b a Stack Out: a % b (not integer mod, but remainder)

0xA5 ABC_ACTION_LSHIFT Stack In: b a Stack Out: a << b

0xA6 ABC_ACTION_RSHIFT Stack In: a b Stack Out: a >> b

0xA7 ABC_ACTION_URSHIFT Stack In: b a Stack Out: ((unsigned) a) >> b

0xA8 ABC_ACTION_BITAND a b Stack Out: a & b

0xA9 ABC_ACTION_BITOR Stack In: b a Stack Out: a | b

0xAA ABC_ACTION_BITXOR Stack In: b a Stack Out: a ^ b

0xAB ABC_ACTION_EQUALS Stack In: b a Stack Out: truth -- Truth of (a == b) (weakly)

0xAC ABC_ACTION_STRICTEQUALS Stack In: b a Stack Out: truth -- Truth of (a == b) (strongly, as in 0x19 (ABC_ACTION_IFSTRICTEQ))

0xAD ABC_ACTION_LESSTHAN Stack In: b a Stack Out: truth -- Truth of (a < b)

0xAE ABC_ACTION_LESSEQUALS Stack In: b a Stack Out: truth -- Truth of (a <= b)

0xAF ABC_ACTION_GREATERTHAN Stack In: b a Stack Out: truth -- Truth of (a > b)

0xB0 ABC_ACTION_GREATEREQUALS Stack In: b a Stack Out: truth -- Truth of (a >= b)

0xB1 ABC_ACTION_INSTANCEOF Stack In: super -- An object val -- An object Stack Out: truth -- Truth of "val is an instance of super"

0xB2 ABC_ACTION_ISTYPE Stream: V32 'name_id' Stack In: [ns] -- Namespace stuff obj -- An object Stack Out: truth -- Truth of "obj is of the type given in (resolve)'name_id'"

0xB3 ABC_ACTION_ISTYPELATE Stack In: type -- A type to match obj -- An object Stack Out: truth -- Truth of "obj is of type"

0xB4 ABC_ACTION_IN Stack In: obj -- The object to search for it name -- The name to find Stack Out: truth -- True if name is in current namespace or anywhere in object. Don't look in the namespace if obj is a dictionary. NB: Since there doesn't seem to be a way to make a dictionary, this is not done. If there is, fix this lack.

0xC0 ABC_ACTION_INCREMENT_I See: 0x91 (ABC_ACTION_INCREMENT), but forces types to int, not double

0xC1 ABC_ACTION_DECREMENT_I See: 0x93 (ABC_ACTION_DECREMENT), but forces types to int, not double

0xC2 ABC_ACTION_INCLOCAL_I See: 0x92 (ABC_ACTION_INCLOCAL), but forces types to int not double

0xC3 ABC_ACTION_DECLOCAL_I See: 0x94 (ABC_ACTION_DECLOCAL), but forces types to int, not double

0xC4 ABC_ACTION_NEGATE_I See: 0x90 (ABC_ACTION_NEGATE), but forces type to int, not double

0xC5 ABC_ACTION_ADD_I See: 0xA0 (ABC_ACTION_ADD), but forces type to int

0xC6 ABC_ACTION_SUBTRACT_I See: 0xA1 (ABC_ACTION_SUBTRACT), but forces type to int

0xC7 ABC_ACTION_MULTIPLY_I See: 0xA2 (ABC_ACTION_MULTIPLY), but forces type to int

0xD0 ABC_ACTION_GETLOCAL0 0xD1 ABC_ACTION_GETLOCAL1 0xD2 ABC_ACTION_GETLOCAL2 0xD3 ABC_ACTION_GETLOCAL3 Frame: Load frame[#] as val Stack Out: val

0xD4 ABC_ACTION_SETLOCAL0 0xD5 ABC_ACTION_SETLOCAL1 0xD6 ABC_ACTION_SETLOCAL2 0xD7 ABC_ACTION_SETLOCAL3 Frame: Store val as frame[#] Stack In: val Stack Out: 0xEF ABC_ACTION_DEBUG Stream: 7 bytes of unknown stuff to be skipped Do: skip ahead 7 bytes in stream

0xF0 ABC_ACTION_DEBUGLINE Stream: V32 'line_number' Do: Nothing, but line_number is for the debugger if wanted.

0xF1 ABC_ACTION_DEBUGFILE Stream: V32 'name_offset' Do: Nothing. 'name_offset' into string pool is the file name if wanted.

0xF2 ABC_ACTION_BKPTLINE Stream: V32 'line_number' Do: Enter debugger if present, line_number is the line number in source.

Referenced by gnash::SWF::DoABCTag::executeActions(), and instantiateClass().

as_value gnash::abc::Machine::executeFunction ( Method function,
const fn_call fn 
)
Property* gnash::abc::Machine::findProperty ( MultiName  )  [inline]
Class * gnash::abc::Machine::findSuper ( as_value obj,
bool  find_primitive 
)

Given a value v, find the class object of the superclass of v.

Parameters:
obj The object whose superclass is desired.
find_primitive If true, the ActionScript prototype will be found for primitive values.
Returns:
Null if the superclass was not found, or the superclass.
void gnash::abc::Machine::getMember ( Class pDefinition,
MultiName name,
as_value source 
)

Get a member from an object.

Parameters:
pDefinition The definition of the class which is to be used. This should be the one which has the property.
name The bound name of the member
source The source object -- the specific instance of the pDefinition class.
Returns:
This returns the value, but on the stack. (Since the return value is not known until after control has left the caller of this, it's impossible to return a meaningful value.
DisplayObject* gnash::abc::Machine::getTarget (  ) 

The DisplayObject which initiated these actions.

Global_as * gnash::abc::Machine::global (  ) 

Return the Global object for this Machine.

This should be different from the AVM1 global object because the VMs do not share any ActionScript resources. It should be the same for a complete run of the Machine so that modifications carried out by scripts are preserved for subsequent scripts.

References gnash::key::g.

Referenced by gnash::abc::abc_function::abc_function().

void gnash::abc::Machine::immediateFunction ( const as_function to_call,
as_object pThis,
as_value storage,
unsigned char  stack_in,
short  stack_out 
)

Referenced by immediateProcedure().

void gnash::abc::Machine::immediateProcedure ( const as_function to_call,
as_object pthis,
unsigned char  stack_in,
short  stack_out 
) [inline]

References immediateFunction().

void gnash::abc::Machine::init (  ) 

Initialize the AS resources.

This extra step is necessary because the Machine is initialized and owned by the AVM1 machine(VM). All access to Machine currently occurs through VM, but since the VM's Machine pointer is null until the Machine ctor has completed, we cannot construct AS resources until after the ctor is complete, because AS resource creation accesses the Machine through the VM's pointer... TODO: fix the mess.

void gnash::abc::Machine::initMachine ( AbcBlock pool_block  ) 
void gnash::abc::Machine::instantiateClass ( std::string  className,
as_object global 
)

This seems like a big error.

References execute().

Referenced by gnash::SWF::SymbolClassTag::executeActions().

void gnash::abc::Machine::markReachableResources (  )  const
void gnash::abc::Machine::pushCall ( as_function func,
as_object pThis,
as_value return_slot,
unsigned char  stack_in,
short  stack_out 
)

push a call to be executed next

Push a call to be executed as soon as execution of the current opcode finishes. At the end, transfer will return to the previous context.

Parameters:
func The function to call
pThis The object to act as the 'this' pointer.
return_slot The slot to use for returns. Use mIgnoreReturn if you don't care what happens here.
stack_in How many of the values on the stack are for the new context
stack_out How much of the stack should be left behind when the function exits. For example: 0 will leave a stack which is stack_in shorter than it was on call. 1 will leave a stack which is 1 taller than it was on call.

RESTRICTION: stack_in - stack_out must not be negative

References gnash::Property::isGetterSetter(), gnash::SafeStack< T >::push(), and gnash::Property::setValue().

void gnash::abc::Machine::pushGet ( as_object this_obj,
as_value return_slot,
Property prop 
)

push a get call to be executed next.

Any Property can be pushed, and it will put an appropriate value into return_slot. This ensures that getter properties can be accessed in the same way as other properties, and hides the difference between ActionScript methods and native C++ methods.

Parameters:
this_obj The 'this' to use for a getter/setter if it exists.
return_slot A space for the return value. An assignment will always be made here, but mVoidSlot can be used for values that will be discarded.
prop The property. If this is a value, it simply returns that value in the return_slot immediately. Otherwise, it may immediately call the gettter or it may push that onto the call stack and transfer control. Callers can be agnostic as to which happens.
void gnash::abc::Machine::pushSet ( as_object this_obj,
as_value value,
Property prop 
)

push a set call to be executed next.

Any Property can be pushed, and it will set the property, if possible. setter properties and simple properties alike will be handled by this.

Parameters:
this_obj The 'this' to use for a getter/setter if it exists.
value The value which should be set
prop The property desired to be set.

References gnash::Property::getValue(), and gnash::Property::isGetterSetter().

void gnash::abc::Machine::setMember ( Class pDefinition,
MultiName name,
as_value target,
as_value val 
)

Set a member in an object.

Parameters:
pDefinition The definition of the class which is to be used.
name The bound name of the member
source The source object -- where the instance should be set
newvalue The new value
Returns:
Nothing.
void gnash::abc::Machine::setTarget ( DisplayObject target  ) 

Set the DisplayObject which initiated the actions. Not null.


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