[svn:parrot] r39666 - trunk/lib/Parrot/Pmc2c

cotto at svn.parrot.org cotto at svn.parrot.org
Fri Jun 19 00:37:38 UTC 2009


Author: cotto
Date: Fri Jun 19 00:37:38 2009
New Revision: 39666
URL: https://trac.parrot.org/parrot/changeset/39666

Log:
[pmc2c] make get_vtable etc only use functions from a PMC and its immediate parent
This is another "pmcc will do it this way so make sure it works" patch.

Modified:
   trunk/lib/Parrot/Pmc2c/PMCEmitter.pm

Modified: trunk/lib/Parrot/Pmc2c/PMCEmitter.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/PMCEmitter.pm	Fri Jun 19 00:21:37 2009	(r39665)
+++ trunk/lib/Parrot/Pmc2c/PMCEmitter.pm	Fri Jun 19 00:37:38 2009	(r39666)
@@ -907,9 +907,19 @@
 
     my $cout      = "";
     my $classname = $self->name;
+    my @other_parents = @{ $self->direct_parents };
+    my $first_parent = shift @other_parents;
 
     my $get_vtable = '';
-    foreach my $parent_name ( reverse ($self->name, @{ $self->parents }) ) {
+
+    if ($first_parent eq 'default') {
+        $get_vtable .= "    vt = Parrot_default_get_vtable(interp);\n";
+    }
+    else {
+        $get_vtable .= "    vt = Parrot_${first_parent}_get_vtable(interp);\n";
+    }
+
+    foreach my $parent_name ( @other_parents) {
         if ($parent_name eq 'default') {
             $get_vtable .= "    vt = Parrot_default_get_vtable(interp);\n";
         }
@@ -917,6 +927,7 @@
             $get_vtable .= "    Parrot_${parent_name}_update_vtable(vt);\n";
         }
     }
+    $get_vtable .= "    Parrot_${classname}_update_vtable(vt);\n";
 
     $cout .= <<"EOC";
 PARROT_EXPORT
@@ -931,7 +942,15 @@
 EOC
 
     my $get_extra_vtable = '';
-    foreach my $parent_name ( reverse ($self->name, @{ $self->parents }) ) {
+
+    if ($first_parent eq 'default') {
+        $get_extra_vtable .= "    vt = Parrot_default_ro_get_vtable(interp);\n";
+    }
+    else {
+        $get_extra_vtable .= "    vt = Parrot_${first_parent}_ro_get_vtable(interp);\n";
+    }
+
+    foreach my $parent_name ( @other_parents ) {
         if ($parent_name eq 'default') {
             $get_extra_vtable .= "    vt = Parrot_default_ro_get_vtable(interp);\n";
         }
@@ -939,6 +958,7 @@
             $get_extra_vtable .= "    Parrot_${parent_name}_ro_update_vtable(vt);\n";
         }
     }
+    $get_extra_vtable .= "    Parrot_${classname}_ro_update_vtable(vt);\n";
 
     $cout .= <<"EOC";
 PARROT_EXPORT


More information about the parrot-commits mailing list