The patch looks pretty good to me. Here is a proposal for an alternative
inheritance hierarchy. Invocable, the root of the hierarchy, is basically a
sub that is not a closure (i.e. *no* context at all, just an address).
pmclass Invocable { # I called this sublite before
/* SELF->data is always NULL */
/* SELF->cache.int_val holds address */
void set_integer_native(INTVAL value) {
SELF->cache.int_val = value;
}
void* invoke() {
return (void*)SELF->cache.int_value;
}
...
}
pmclass Sub extends Invocable {
/* SELF->data is a lex_pad (or stack as Leo suggests) */
}
pmclass Continuation extends Invocable {
/* SELF->data is a pointer to a Parrot_Context struct */
}
pmclass Coroutine extends Continuation {...} /* maybe ??? */
In the current implementation there is a difference between the sub pmc and
the struct Parrot_Sub. The same goes for continuations and coroutines. The
above suggests that we could merge those together and just have the pmc
versions.
--
Jonathan Sillito