NAME ^

src/classes/delegate.pmc - Delegate PMC

DESCRIPTION ^

Delegate each and every function to parrot bytecode.

Almost all methods are auto-generated in lib/Parrot/Pmc2c.pm

Functions ^

static PMC *find_meth(Interp *interpreter, PMC *pmc, STRING *name)

Finds and returns the delegated method with string name.

static PMC *find_or_die(Interp *interpreter, PMC *pmc, STRING *name)

Returns the result of calling find_meth() with the arguments, raising an exception if no method is found.

All these functions to run code can leak a full parrot register file, as well as potentially permanently unroot some PMCs or strings, if the vtable method throws an exception. It really ought be caught rather than let flow through.

PARROT_INLINE static void noarg_noreturn(Interp *interpreter, PMC *obj, const char *meth, int die)

Calls the delegated method with no arguments or return value. If die is true then an exception will be raised if the method is not found.

Methods ^

void init()

Calls the delegated __init() method if it exists.

PMC *instantiate()

Calls the delegated __instantiate method if it exists.

XXX Actually the PMC compiler should emit different code, if a method is present in src/classes/default.pmc. Some defaulted methods like this one have useful defaults and don't throw exceptions.


parrot