[svn:parrot] r38602 - in branches/tt631_part3/lib/Parrot/Pmc2c: . PMC

bacek at svn.parrot.org bacek at svn.parrot.org
Fri May 8 11:18:04 UTC 2009


Author: bacek
Date: Fri May  8 11:18:04 2009
New Revision: 38602
URL: https://trac.parrot.org/parrot/changeset/38602

Log:
Generate non-ro variant of vtable methods iff we override ro status using :write pragma

Modified:
   branches/tt631_part3/lib/Parrot/Pmc2c/PMC/RO.pm
   branches/tt631_part3/lib/Parrot/Pmc2c/PMCEmitter.pm

Modified: branches/tt631_part3/lib/Parrot/Pmc2c/PMC/RO.pm
==============================================================================
--- branches/tt631_part3/lib/Parrot/Pmc2c/PMC/RO.pm	Fri May  8 11:17:30 2009	(r38601)
+++ branches/tt631_part3/lib/Parrot/Pmc2c/PMC/RO.pm	Fri May  8 11:18:04 2009	(r38602)
@@ -65,8 +65,11 @@
 
     foreach my $vt_method ( @{ $self->vtable->methods } ) {
         my $name = $vt_method->name;
-        next unless $parent->vtable_method_does_write($name)
-                    && $parent->{has_method}{$name};
+
+        # Generate ro variant only iff we override method constantness with ":write"
+        next unless $parent->{has_method}{$name}
+                    && $parent->vtable_method_does_write($name)
+                    && !$parent->vtable->attrs($name)->{write};
 
         # All parameters passed in are shims, because we're
         # creating an exception-thrower.

Modified: branches/tt631_part3/lib/Parrot/Pmc2c/PMCEmitter.pm
==============================================================================
--- branches/tt631_part3/lib/Parrot/Pmc2c/PMCEmitter.pm	Fri May  8 11:17:30 2009	(r38601)
+++ branches/tt631_part3/lib/Parrot/Pmc2c/PMCEmitter.pm	Fri May  8 11:18:04 2009	(r38602)
@@ -830,10 +830,16 @@
     # Generate RO vtable for implemented non-updating methods
     $vtable_updates = '';
     foreach my $name ( @{ $self->vtable->names} ) {
-        next if $self->vtable_method_does_write($name);
         next unless exists $self->{has_method}{$name};
-
-        $vtable_updates .= "    vt->$name = Parrot_${classname}_${name};\n";
+        if ($self->vtable_method_does_write($name)) {
+            # If we override constantness status of vtable
+            if (!$self->vtable->attrs($name)->{write}) {
+                $vtable_updates .= "    vt->$name = Parrot_${classname}_ro_${name};\n";
+            }
+        }
+        else {
+            $vtable_updates .= "    vt->$name = Parrot_${classname}_${name};\n";
+        }
     }
 
     $cout .= <<"EOC";


More information about the parrot-commits mailing list