src/pmc/sub.pmc - Sub PMC


These are the vtable functions for the Sub (subroutine) base class


static void print_sub_name(PARROT_INTERP, PMC *sub)
static function to print the name of the sub (for tracing/debugging)
void init()
Initializes the subroutine.
void init_pmc()
Initializes the "detached" subroutine from passed Hash. "Detached" means that surboutine is fully constructed but not attached to interpreter.
void destroy()
Destroys the subroutine.
STRING *get_string()
Returns the name of the subroutine.
void set_string_native(STRING *subname)
Sets the name of the subroutine.
void set_pointer(void *value)
Sets the pointer to the actual subroutine.*** Don't use that - use .const 'Sub' in PIR instead ***
void *get_pointer()
Returns the address of the actual subroutine.
INTVAL get_integer_keyed(PMC *key)
This just unconditionally returns the start of bytecode. It's wrong, wrong, wrong, *WRONG*. And there's no other good way, so it's here for now. -DRS
INTVAL defined()
INTVAL get_bool()
Returns True.
opcode_t *invoke(void *next)
Invokes the subroutine.
PMC *clone()
Creates and returns a clone of the subroutine.
void assign_pmc(PMC *other)
Set SELF to the data in other.
void mark()
Marks all GC-able pmc elements as live.
INTVAL is_equal(PMC *value)
Returns whether the two subroutines are equal.
void visit(PMC *info)
This is used by freeze/thaw to visit the contents of the sub.
void freeze(PMC *info)
Archives the subroutine.
void thaw(PMC *info)
Unarchives the subroutine.
PMC *inspect()
Returns the full set of meta-data about the sub.
PMC *inspect_str(STRING *what)
Returns the specified item of metadata about the sub. Allowable values are:
The number of required positional arguments
The number of optional positional arguments
The number of required named arguments
The number of optional named arguments
1 if it takes slurpy positional arguments, 0 if not
1 if it takes slurpy named arguments, 0 if not


INTVAL start_offs()
Returns the start offset of the Sub.
INTVAL end_offs()
Returns the end offset of the Sub.
PMC *get_namespace()
Returns the namespace PMC, where the Sub is defined.TODO return namespace_stash instead.
INTVAL __get_regs_used(char *kind)
Returns the number of used registers for register kinds "I", "S", "P", "N".
PMC *get_lexinfo()
Returns the LexInfo PMC, if any or a Null PMC.
PMC *get_multisig()
Returns the MMD signature PMC, if any, or a Null PMC.
PMC *get_outer()
Gets the sub that is the outer of this one, if any, or a Null PMC.
void set_outer(PMC *outer)
Sets the sub that is the outer of this one.
void set_outer_ctx(PMC *outer_ctx)
Set the outer context to be used on the next invocation of this sub.
INTVAL arity()
Returns the arity of the Sub (the number of arguments, excluding optional and slurpy arguments).
INTVAL comp_flags()
INTVAL pf_flags()
(Experimental) Returns Sub flags.
PMC *get_packfile()
(Experimental) Returns the packfile that contains this Sub