NAME

src/pmc/object.pmc - Object PMC

DESCRIPTION

Implements an instance of a class.

TODO: If a vtable override exists, calls the found method via the slow Parrot_ext_call, which creates a new interp, task and calls a new runloop.

Functions

static INTVAL get_attrib_index(PARROT_INTERP, PMC *self, STRING *name)
Find the index of an attribute in an object's attribute store and return it. Return -1 if the attribute does not exist.
static INTVAL get_attrib_index_keyed(PARROT_INTERP, PMC *self, PMC *key, STRING *name)
This variation bypasses the cache and finds the index of a particular parent's attribute in an object's attribute store and returns it. Returns -1 if the attribute does not exist.
static PMC * find_cached(PARROT_INTERP, PMC *_class, STRING *name)
Search for a method in a class' method cache, if available. If no cache is available, return PMCNULL.
static void cache_method(PARROT_INTERP, PMC *_class, STRING *name, PMC *method)
Add a method to a class' method cache. If no method cache exists, create one.
static PMC* clone_key_arg(PARROT_INTERP, PMC *key)
Replaces any src registers by their values. Used for *_keyed overrides.
void init()
Raises an exception; you can only instantiate objects from a class.
void init_pmc(PMC *class)
Raises an exception; you can only instantiate objects from a class.
void destroy()
Just to avoid the automatic generation of one.
STRING *name()
Returns the fully qualified name of the object's class.
void mark()
Mark any referenced strings and PMCs.
PMC *get_attr_str(STRING *name)
Gets the value of an attribute for this object. Will find the first attribute of the given name walking up the inheritance tree.
PMC *get_attr_keyed(PMC *key, STRING *name)
Gets the value of an attribute for this object. Will only look for attributes defined in the parent identified by the given key.
void set_attr_str(STRING *name, PMC *value)
Sets the value of an attribute for this object. Will set the first attribute of the given name walking up the inheritance tree.
void set_attr_keyed(PMC *key, STRING *name, PMC *value)
Sets the value of an attribute for this object. Will only set attributes defined in the parent identified by the given key.
PMC *find_method(STRING *name)
Queries this object's class to find the method with the given name.
INTVAL get_integer()
Invoke the PIR-defined vtable override, or call the default get_integer.
PMC *get_class()
Get the class PMC representing the class that this object is an instance of.
PMC *get_namespace()
Get the namespace PMC associated with the class that this object is an instance of.
INTVAL isa_pmc(PMC *lookup)
Returns whether the object's class is or inherits from lookup.
INTVAL isa(STRING *classname)
Returns whether the class is or inherits from *classname.
INTVAL does(STRING *role_name)
Returns whether the object's class does the role with name *role_name.
INTVAL does_pmc(PMC *role)
Returns whether the object's class does *role.
opcode_t *invoke(void *next)
Invokes the object (if this vtable function is overridden).
INTVAL type()
Returns the integer type of the object's class.
PMC * clone()
Creates a clone of the object.
void visit(PMC *info)
This is used by freeze/thaw to visit the contents of the object.*info is the visit info, (see include/parrot/pmc_freeze.h).
void freeze(PMC *info)
void thaw(PMC *info)
Realias magically generated methods so they don't wreak havoc.The info arguments are ignored.
void thawfinish(PMC *info)
Called after the object has been thawed.
void morph(PMC* type)
Changes the PMC to a PMC of a new type

SEE ALSO

docs/pdds/pdd15_objects.pod.