[svn:parrot] r40313 - in trunk: . config/gen/makefiles lib/Parrot/Pmc2c src/dynpmc t/dynpmc

chromatic chromatic at wgz.org
Fri Jul 31 02:33:13 UTC 2009


On Tuesday 28 July 2009 13:39:11 cotto at svn.parrot.org wrote:

> Log:
> [pmc2c] make VTABLE function inheritance work between dynpmcs, plus a test
> (see TT #882) flh++ for reporting and the MethodEmitter.pm part of this
> patch

> --- trunk/lib/Parrot/Pmc2c/MethodEmitter.pm	Tue Jul 28 20:39:09
> 2009	(r40312) +++ trunk/lib/Parrot/Pmc2c/MethodEmitter.pm	Tue Jul 28
> 20:39:11 2009	(r40313) @@ -267,7 +267,16 @@
>              \bSUPER\b         # Macro: SUPER
>              \(\s*(.*?)\)      # capture argument list
>            }x,
> -            sub { "interp->vtables[$supertype]->$name(" .
> full_arguments($1) . ')' } +            sub {
> +              if($pmc->is_dynamic($super)) {
> +                return "Parrot_" . $super .
> +                  "_get_vtable(interp)->$name(" . full_arguments($1) .
> +                  ')';

That leaks memory on every affected vtable invocation; 
Parrot_<pmctype>_get_vtable (eventually) allocates a new VTABLE.

We could keep a cache of override function pointers and call them from a 
cache.  The array lookup there would be a lot cheaper than the function call, 
and it wouldn't leak memory.

-- c


More information about the parrot-dev mailing list