[svn:parrot] r39682 - in branches/pmc_pct/compilers/pmcc/src: . emitter

cotto at svn.parrot.org cotto at svn.parrot.org
Sat Jun 20 21:20:23 UTC 2009


Author: cotto
Date: Sat Jun 20 21:20:22 2009
New Revision: 39682
URL: https://trac.parrot.org/parrot/changeset/39682

Log:
[pmcc] put all VTABLE functions in vtables{'default'} to allow a logical place for variant vtables

Modified:
   branches/pmc_pct/compilers/pmcc/src/emitter/pmc.pm
   branches/pmc_pct/compilers/pmcc/src/nodes.pir

Modified: branches/pmc_pct/compilers/pmcc/src/emitter/pmc.pm
==============================================================================
--- branches/pmc_pct/compilers/pmcc/src/emitter/pmc.pm	Sat Jun 20 21:16:42 2009	(r39681)
+++ branches/pmc_pct/compilers/pmcc/src/emitter/pmc.pm	Sat Jun 20 21:20:22 2009	(r39682)
@@ -51,7 +51,7 @@
 
     @res_builder.push("void Parrot_" ~ self.name ~ "_class_init(PARROT_INTERP, int, int);\n");
 
-    my %vtables := self.vtables;
+    my %vtables := self.vtables{'default'};
 
     for %vtables {
         my $entry := %vtables{$_};
@@ -327,7 +327,7 @@
 
 method generate_c_functions() {
     my $past    := self.past;
-    my %vtables := self.vtables;
+    my %vtables := self.vtables{'default'};
     my $emitter := PMC::Emitter::C.new;
     my @res;
 
@@ -492,7 +492,7 @@
         @res.push('        vt->isa_hash     = Parrot_'~self.name~'_get_isa(interp, NULL);');
     }
     else {
-        @res.push'(        vt->isa_hash     = NULL;');
+        @res.push('(        vt->isa_hash     = NULL;');
     }
 
 
@@ -564,7 +564,7 @@
     @res.push('PARROT_EXPORT');
     @res.push('VTABLE *Parrot_'~ self.name ~"_update_vtable(VTABLE *vt) {");
 
-    for (self.past.vtables) {
+    for (self.past.vtables{'default'}) {
         @res.push('    vt->'~$_~' = Parrot_'~self.name~'_'~$_~';');
     }
     @res.push('');
@@ -654,7 +654,7 @@
 }
 
 method vtables() {
-    self.past.vtables;
+    self.past.vtables{'default'};
 }
 
 method attr() {

Modified: branches/pmc_pct/compilers/pmcc/src/nodes.pir
==============================================================================
--- branches/pmc_pct/compilers/pmcc/src/nodes.pir	Sat Jun 20 21:16:42 2009	(r39681)
+++ branches/pmc_pct/compilers/pmcc/src/nodes.pir	Sat Jun 20 21:20:22 2009	(r39682)
@@ -247,7 +247,7 @@
 
 =item C<add_vtable>
 
-Add VTABLE method to PMC.
+Add a VTABLE function to this PMC's default vtable.
 
 =cut
 
@@ -256,12 +256,17 @@
     .param pmc method
 
     $P0 = self.'attr'('vtables', 0, 0)
+    $I0 = exists $P0['default']
+    if $I0 goto check_name
+    $P1 = new ['Hash']
+    $P0['default'] = $P1
+  check_name:
     $I0 = exists $P0[name]
     unless $I0 goto add_method
     $S0 = concat "Duplicate VTABLE function: ", name
     die $S0
   add_method:
-    $P0[name] = method
+    $P0['default';name] = method
     .return ()
 .end
 


More information about the parrot-commits mailing list