develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r33585 - in trunk: compilers/pct/src/PCT src/pmc

From:
pmichaud
Date:
December 6, 2008 20:49
Subject:
[svn:parrot] r33585 - in trunk: compilers/pct/src/PCT src/pmc
Message ID:
20081207044900.EEE36CB9AF@x12.develooper.com
Author: pmichaud
Date: Sat Dec  6 20:49:00 2008
New Revision: 33585

Modified:
   trunk/compilers/pct/src/PCT/Node.pir
   trunk/src/pmc/capture.pmc

Log:
[pct]:  Switch PCT::Node to use Capture PMC instead of Capture_PIR.
This results in another 7.5% speedup in the Rakudo action.pm benchmark.


Modified: trunk/compilers/pct/src/PCT/Node.pir
==============================================================================
--- trunk/compilers/pct/src/PCT/Node.pir	(original)
+++ trunk/compilers/pct/src/PCT/Node.pir	Sat Dec  6 20:49:00 2008
@@ -13,14 +13,9 @@
 
 .sub 'onload' :anon :load :init
     ##   create the PCT::Node base class
-    ##   FIXME: Eventually we want this to be a subclass of
-    ##   Capture, but as of now Capture isn't working so we
-    ##   use the Capture_PIR class for now.
-    load_bytecode 'Parrot/Capture_PIR.pbc'
-
     .local pmc p6meta
     p6meta = new 'P6metaclass'
-    p6meta.'new_class'('PCT::Node', 'parent'=>'Capture_PIR')
+    p6meta.'new_class'('PCT::Node', 'parent'=>'Capture')
 
     $P0 = box 10
     set_hll_global ['PCT';'Node'], '$!serno', $P0
@@ -319,6 +314,17 @@
 .end
 
 
+=item VTABLE get_bool()
+
+Return true since the node is defined.
+
+=cut
+
+.sub '' :vtable('get_bool') :method
+    .return (1)
+.end
+
+
 =back
 
 =head1 AUTHOR

Modified: trunk/src/pmc/capture.pmc
==============================================================================
--- trunk/src/pmc/capture.pmc	(original)
+++ trunk/src/pmc/capture.pmc	Sat Dec  6 20:49:00 2008
@@ -468,6 +468,22 @@
 
 /*
 
+=item C<STRING get_string()>
+
+Return a string representation of the hash, showing class
+and memory address.
+
+=cut
+
+*/
+
+    VTABLE STRING *get_string() {
+        STRING *classname = VTABLE_name(INTERP, SELF);
+        return Parrot_sprintf_c(INTERP, "%S[0x%x]", classname, SELF);
+    }
+
+/*
+
 =back
 
 =head2 Methods



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About