I wrote here at mid-May: [ vtable <-> opcode coverage ]
Here is an update of a really old story: $ ./vtbc.pl # s. below vtable coverage vtable.tbl has 202 entries core_ops.c has 116 entries + 10 internally used [ ... ] 76 unused 19 _bignum variants - TODO 19 unused vtables with _same suffix > - _same are intended as short cuts, when all data types are known. But > IMHO to know what data types are involved, you have to test the PMC > types - this is what the normal methods do anyway, so these methods > are probably superfluous. And: is_same does compare, if the PMCs have the same address, so there is really no need for a vtable slot. All but one _same variant are unused. set_bool set_integer set_number set_string These have the same problem as the _same variants. The assembler would have to know, that the RHS is a PMC of the given type, and that the assignment should result in that type. I can hardly imagine how. If no one has good reasons to keep these 19 + 4 vtable slots, I'll removed it, reducing vtable size by more then 10%. OTOH I'm thinking of adding _keyed_str variants to used _keyed vtables. We are already constructing too much temporary key PMCs from a string just to pass a string to an hash lookup. Object ops and functions do this all over the place repeatedly. Yeah, and we still have 29 unused _keyed entries ... leo #!/usr/bin/perl # # vtbc.pl - vtable coverage use FindBin; use lib 'lib'; use lib "$FindBin::Bin/.."; use lib "$FindBin::Bin/../lib"; use Parrot::Vtable; use strict; my $default = parse_vtable("./vtable.tbl"); printf " vtable coverage\n"; printf " vtable.tbl has " . scalar (@{$default}). " entries\n"; my %methods; foreach my $method (@{$default}) { $methods{$method->[1]}=1; } my %vops; open IN, "src/core_ops.c" or die("can't read core_ops.c\n"); while (<IN>) { $vops{$1}++ while (/VTABLE_(\w+)/g); } close(IN); my @int = qw/morph mark destroy elements init_pmc visit freeze thaw thawfinish nextkey_keyed/; printf " core_ops.c has ". keys(%vops) . " entries + " . scalar(@int) . " internally used\n"; foreach my $i (@int) { $vops{$i}++; } my $unused; foreach my $c (keys(%methods)) { $unused++, printf "$c\n" unless $vops{$c}; } printf " $unused unused\n";