NAME ^

oo.c - Class and object

DESCRIPTION ^

Handles class and object manipulation.

Functions ^

void Parrot_oo_extract_methods_from_namespace

Extract methods and vtable overrides from the given namespace and insert them into the class.

PMC *Parrot_oo_get_namespace

Lookup a namespace object from a class PMC.

PMC *Parrot_oo_get_class

Lookup a class object from a namespace, string, or key PMC.

PMC *Parrot_oo_get_class_str

Lookup a class object from a builtin string.

PMC *Parrot_oo_newclass_from_str

Create a new class object from a string name.

PMC *Parrot_oo_find_vtable_override_for_class

Lookup a vtable override in a specific class object.

PMC *Parrot_oo_find_vtable_override

Lookup a vtable override in a class, including any vtable overrides inherited from parents.

INTVAL Parrot_get_vtable_index

Return index if name is a valid vtable slot name.

static PMC *find_vtable_meth_ns

Return Sub PMC if a method with the vtable name exists in ns

PMC *Parrot_find_vtable_meth

Given pmc, run through its mro looking for the meth vtable method. Return the vtable method PMC if found.

STRING *readable_name

Given a String or Key PMC return the STRING* representation

RT#45967 this function, key_set_to_string, and the key PMC get_repr should be consolidated

static void rebuild_attrib_stuff

Take the class and completely rebuild the attribute stuff for it. Horribly destructive, and definitely not a good thing to do if there are instantiated objects for the class

static void create_deleg_pmc_vtable

Create a vtable that dispatches either to the contained PMC in the first attribute (deleg_pmc) or to an overridden method (delegate), depending on the existence of the method for this class.

const char *Parrot_MMD_method_name

Return the method name for the given MMD enum.

INTVAL Parrot_MMD_method_idx

Return the MMD function number for method name or -1 on failure.

RT#45973 allow dynamic expansion at runtime.

PMC *Parrot_single_subclass

Subclass a class. Single parent class, nice and straightforward. If child_class is NULL, this is an anonymous subclass we're creating, function.

PMC *Parrot_class_lookup

Looks for the class named class_name and returns it if it exists. Otherwise it returns PMCNULL.

PMC *Parrot_class_lookup_p

Looks for the class named class_name and returns it if it exists. Otherwise it returns PMCNULL.

static void fail_if_type_exists

This function throws an exception if a PMC or class with the same name * already exists in the global type registry. The global type registry will go away eventually, but this allows the new object metamodel to interact with the old one until it does.

INTVAL Parrot_oo_register_type

This function registers a type in the global registry, first checking if it already exists. The global type registry will go away eventually, but this allows the new object metamodel to interact with the old one until it does.

static void parrot_class_register

This is the way to register a new Parrot class as an instantiable type. Doing this involves putting it in the class hash, setting its vtable so that the init method initializes objects of the class rather than the class itself, and adding it to the interpreter's base type table so you can create a new foo in PASM like this: new Px, foo.

static PMC *get_init_meth

RT#48260: Not yet documented!!!

static void do_initcall

RT#48260: Not yet documented!!!

void Parrot_instantiate_object_init

Creates a Parrot object. Takes a passed-in class PMC that has sufficient information to describe the layout of the object and makes the object.

void Parrot_instantiate_object

Wrapper for instantiate_object, passing NULL as initialization. Returns a new Parrot object.

static void instantiate_object

RT#48260: Not yet documented!!!

PMC *Parrot_remove_parent

This currently does nothing but return PMCNULL. RT#50646

void mark_object_cache

Marks all PMCs in the object method cache as live. This shouldn't strictly be necessary, as they're likely all reachable from namespaces and classes, but it's unlikely to hurt anything except mark phase performance.

void init_object_cache

Allocate memory for object cache.

void destroy_object_cache

RT#48260: Not yet documented!!!

static void invalidate_type_caches

RT#48260: Not yet documented!!!

static void invalidate_all_caches

RT#48260: Not yet documented!!!

void Parrot_invalidate_method_cache

Clear method cache for the given class. If class is NULL, caches for all classes are invalidated.

PMC *Parrot_find_method_direct

Find a method PMC for a named method, given the class PMC, current interpreter, and name of the method. Don't use a possible method cache.

PMC *Parrot_find_method_with_cache

Find a method PMC for a named method, given the class PMC, current interp, and name of the method.

This routine should use the current scope's method cache, if there is one. If not, it creates a new method cache. Or, rather, it will when we've got that bit working. For now it unconditionally goes and looks up the name in the global stash.

static void debug_trace_find_meth

RT#48260: Not yet documented!!!

static PMC *find_method_direct_1

RT#48260: Not yet documented!!!

INTVAL Parrot_add_attribute

Adds the attribute attr to the class.

   Life is ever so much easier if a class keeps its attributes at the
   end of the attribute array, since we don't have to insert and
   reorder attributes. Inserting's no big deal, especially since we're
   going to break horribly if you insert into a class that's been
   subclassed, but it'll do for now.
static PMC *C3_merge

RT#48260: Not yet documented!!!

PMC *Parrot_ComputeMRO_C3

Computes the C3 linearization for the given class.

void Parrot_ComposeRole

Used by the Class and Object PMCs internally to compose a role into either of them. The role parameter is the role that we are composing into the class or role. methods_hash is the hash of method names to invokable PMCs that contains the methods the class or role has. roles_list is the list of roles the the class or method does.

The role parameter is only dealt with by its external interface. Whether this routine is usable by any other object system implemented in Parrot very much depends on how closely the role composition semantics they want are to the default implementation.

SEE ALSO ^

include/parrot/oo.h, include/parrot/oo_private.h, docs/pdds/pdd15_objects.pod.


parrot