[svn:parrot] r47280 - in branches/gsoc_past_optimization: . config/gen/makefiles runtime/parrot/library/PAST

tcurtis at svn.parrot.org tcurtis at svn.parrot.org
Wed Jun 2 04:16:16 UTC 2010


Author: tcurtis
Date: Wed Jun  2 04:16:16 2010
New Revision: 47280
URL: https://trac.parrot.org/parrot/changeset/47280

Log:
Rewrote what I had of PAST::Pattern in NQP.

Added:
   branches/gsoc_past_optimization/runtime/parrot/library/PAST/Pattern.nqp
Deleted:
   branches/gsoc_past_optimization/runtime/parrot/library/PAST/Pattern.pir
Modified:
   branches/gsoc_past_optimization/MANIFEST
   branches/gsoc_past_optimization/MANIFEST.SKIP
   branches/gsoc_past_optimization/config/gen/makefiles/root.in
   branches/gsoc_past_optimization/runtime/parrot/library/PAST/   (props changed)

Modified: branches/gsoc_past_optimization/MANIFEST
==============================================================================
--- branches/gsoc_past_optimization/MANIFEST	Wed Jun  2 03:06:33 2010	(r47279)
+++ branches/gsoc_past_optimization/MANIFEST	Wed Jun  2 04:16:16 2010	(r47280)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Tue Jun  1 23:57:29 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Wed Jun  2 04:07:25 2010 UT
 #
 # See below for documentation on the format of this file.
 #
@@ -1157,7 +1157,7 @@
 runtime/parrot/library/OpenGL.pir                           [library]
 runtime/parrot/library/OpenGL/Math.pir                      [library]
 runtime/parrot/library/P6object.pir                         [library]
-runtime/parrot/library/PAST/Pattern.pir                     [library]
+runtime/parrot/library/PAST/Pattern.nqp                     [library]
 runtime/parrot/library/PAST/Transformer.pir                 [library]
 runtime/parrot/library/PAST/Transformer/Dynamic.pir         [library]
 runtime/parrot/library/PAST/Walker.pir                      [library]

Modified: branches/gsoc_past_optimization/MANIFEST.SKIP
==============================================================================
--- branches/gsoc_past_optimization/MANIFEST.SKIP	Wed Jun  2 03:06:33 2010	(r47279)
+++ branches/gsoc_past_optimization/MANIFEST.SKIP	Wed Jun  2 04:16:16 2010	(r47280)
@@ -1,6 +1,6 @@
 # ex: set ro:
 # $Id$
-# generated by tools/dev/mk_manifest_and_skip.pl Thu May 27 15:30:20 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Wed Jun  2 04:07:25 2010 UT
 #
 # This file should contain a transcript of the svn:ignore properties
 # of the directories in the Parrot subversion repository. (Needed for
@@ -579,6 +579,8 @@
 # generated from svn:ignore of 'runtime/parrot/library/PAST/'
 ^runtime/parrot/library/PAST/.*\.pbc$
 ^runtime/parrot/library/PAST/.*\.pbc/
+^runtime/parrot/library/PAST/Pattern\.pir$
+^runtime/parrot/library/PAST/Pattern\.pir/
 # generated from svn:ignore of 'runtime/parrot/library/PAST/Transformer/'
 ^runtime/parrot/library/PAST/Transformer/.*\.pbc$
 ^runtime/parrot/library/PAST/Transformer/.*\.pbc/

Modified: branches/gsoc_past_optimization/config/gen/makefiles/root.in
==============================================================================
--- branches/gsoc_past_optimization/config/gen/makefiles/root.in	Wed Jun  2 03:06:33 2010	(r47279)
+++ branches/gsoc_past_optimization/config/gen/makefiles/root.in	Wed Jun  2 04:16:16 2010	(r47280)
@@ -1055,6 +1055,11 @@
     @rpath_lib@ $(ALL_PARROT_LIBS) $(LINKFLAGS)
 #IF(win32):	if exist $@.manifest mt.exe -nologo -manifest $@.manifest -outputresource:$@;1
 
+$(LIBRARY_DIR)/PAST/Pattern.pbc: $(LIBRARY_DIR)/PAST/Pattern.pir
+	$(PARROT) -o $@ $(LIBRARY_DIR)/PAST/Pattern.pir
+
+$(LIBRARY_DIR)/PAST/Pattern.pir: $(LIBRARY_DIR)/PAST/Pattern.nqp $(NQP_RX)
+	$(NQP_RX) --target=pir $(LIBRARY_DIR)/PAST/Pattern.nqp > $@
 #
 # Profiling runcore test supporting code
 #

Added: branches/gsoc_past_optimization/runtime/parrot/library/PAST/Pattern.nqp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/gsoc_past_optimization/runtime/parrot/library/PAST/Pattern.nqp	Wed Jun  2 04:16:16 2010	(r47280)
@@ -0,0 +1,95 @@
+#!./parrot-nqp
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+INIT {
+    pir::load_bytecode("PCT.pbc");
+}
+
+class PAST::Pattern is Capture {
+    has $name;
+    has $source;
+    has $pos;
+    has $returns;
+    has $arity;
+    has $named;
+    has $flat;
+    has $lvalue;
+
+    method ACCEPTS ($node) {
+        0;
+    }
+}
+
+class PAST::Pattern::Block is PAST::Pattern {
+    has $blocktype;
+    has $closure;
+    has $control;
+    has $loadinit;
+    has $namespace;
+    has $multi;
+    has $hll;
+    has $nsentry;
+    has $symtable;
+    has $lexical;
+    has $compiler;
+    has $compiler_args;
+    has $subid;
+    has $pirflags;
+
+    method ACCEPTS ($node) {
+        $node ~~ PAST::Block;
+    }
+}
+
+class PAST::Pattern::Op {
+    has $pasttype;
+    has $pirop;
+    has $inline;
+
+    method ACCEPTS ($node) {
+        $node ~~ PAST::Op;
+    }
+}
+
+class PAST::Pattern::Stmts {
+    method ACCEPTS ($node) {
+        $node ~~ PAST::Stmts;
+    }
+}
+
+class PAST::Pattern::Val {
+    has $value;
+
+    method ACCEPTS ($node) {
+        $node ~~ PAST::Val;
+    }
+}
+
+class PAST::Pattern::Var {
+    has $scope;
+    has $isdecl;
+    has $namespace;
+    has $slurpy;
+    has $call_sig;
+    has $viviself;
+    has $vivibase;
+    has $multitype;
+
+    method ACCEPTS ($node) {
+        $node ~~ PAST::Var;
+    }
+}
+
+class PAST::Pattern::VarList {
+    method ACCEPTS ($node) {
+        $node ~~ PAST::VarList;
+    }
+}
+
+# Local Variables:
+#   mode: cperl
+#   cperl-indent-level: 4
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:

Deleted: branches/gsoc_past_optimization/runtime/parrot/library/PAST/Pattern.pir
==============================================================================
--- branches/gsoc_past_optimization/runtime/parrot/library/PAST/Pattern.pir	Wed Jun  2 04:16:16 2010	(r47279)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,166 +0,0 @@
-#!./parrot
-# Copyright (C) 2010, Parrot Foundation.
-# $Id$
-
-.macro accessor(attrname)
-    .sub .attrname :method
-	.param pmc value
-	.param int has_value
-	if has_value goto setattr
-	value = self[.attrname]
-	unless null value goto value_done
-value_undef:
-	value = new 'Undef'
-value_done:
-	.return (value)
-setattr:
-	self[.attrname] = value
-	.return (value)
-    .end
-.endm
-
-.macro check_class(obj, class)
-    $P0 = get_class .class
-    $I0 = isa .obj, $P0
-    unless $I0 goto no
-.endm
-
-.sub 'onload' :anon :init :load
-    load_bytecode 'P6object.pbc'
-    .local pmc p6meta, base
-    p6meta = new 'P6metaclass'
-    $S0 = 'name source pos returns arity named flat lvalue'
-    $P0 = get_class 'Capture'
-    base = p6meta.'new_class'('PAST::Pattern', 'parent'=>$P0, 'attrs'=>$S0)
-    $S1 = 'blocktype closure control loadinit namespace multi hll'
-    $S2 = 'nsentry symtable lexical compiler compiler_args subid pirflags'
-    $S0 = concat $S1, $S2
-    p6meta.'new_class'('PAST::Pattern::Block', 'parent'=>base, 'attrs'=>$S0)
-    $S0 = 'pasttype pirop inline'
-    p6meta.'new_class'('PAST::Pattern::Op', 'parent'=>base, 'attrs'=>$S0)
-    p6meta.'new_class'('PAST::Pattern::Stmts', 'parent'=>base)
-    $S0 = 'value'
-    p6meta.'new_class'('PAST::Pattern::Val', 'parent'=>base, 'attrs'=>$S0)
-    $S0 = 'scope isdecl namespace slurpy call_sig viviself vivibase multitype'
-    p6meta.'new_class'('PAST::Pattern::Var', 'parent'=>base, 'attrs'=>$S0)
-    p6meta.'new_class'('PAST::Pattern::VarList', 'parent'=>base)
-.end
-
-.namespace ['PAST'; 'Pattern']
-
-.accessor('name')
-.accessor('source')
-.accessor('pos')
-
-.accessor('returns')
-.accessor('arity')
-.accessor('named')
-.accessor('flat')
-.accessor('lvalue')
-
-.sub 'ACCEPTS' :method
-    .param pmc node
-    .return (0) # .ACCEPTS should return false by default.
-.end
-
-.namespace ['PAST'; 'Pattern'; 'Block']
-
-.accessor('blocktype')
-.accessor('closure')
-.accessor('control')
-.accessor('loadinit')
-.accessor('namespace')
-.accessor('multi')
-.accessor('hll')
-.accessor('nsentry')
-.accessor('symbtable')
-.accessor('lexical')
-.accessor('compiler')
-.accessor('compiler_args')
-.accessor('subid')
-.accessor('pirflags')
-
-.sub 'ACCEPTS' :method
-    .param pmc node
-    .check_class(node, ['PAST'; 'Block'])
-yes:
-    .return (1)
-no:
-    .return (0)
-.end
-
-.namespace ['PAST'; 'Pattern'; 'Op']
-
-.accessor('pasttype')
-.accessor('pirop')
-.accessor('inline')
-
-.sub 'ACCEPTS' :method
-    .param pmc node
-    .check_class(node, ['PAST'; 'Op'])
-yes:
-    .return (1)
-no:
-    .return (0)
-.end
-
-.namespace ['PAST'; 'Pattern'; 'Stmts']
-
-.sub 'ACCEPTS' :method
-    .param pmc node
-    .check_class(node, ['PAST'; 'Stmts'])
-yes:
-    .return (1)
-no:
-    .return (0)
-.end
-
-.namespace ['PAST'; 'Pattern'; 'Val']
-
-.accessor('value')
-
-.sub 'ACCEPTS' :method
-    .param pmc node
-    .check_class(node, ['PAST'; 'Val'])
-yes:
-    .return (1)
-no:
-    .return (0)
-.end
-
-.namespace ['PAST'; 'Pattern'; 'Var']
-
-.accessor('scope')
-.accessor('isdecl')
-.accessor('namespace')
-.accessor('slurpy')
-.accessor('call_sig')
-.accessor('viviself')
-.accessor('vivibase')
-.accessor('multitype')
-
-.sub 'ACCEPTS' :method
-    .param pmc node
-    .check_class(node, ['PAST'; 'Var'])
-yes:
-    .return (1)
-no:
-    .return (0)
-.end
-
-.namespace ['PAST'; 'Pattern'; 'VarList']
-
-.sub 'ACCEPTS' :method
-    .param pmc node
-    .check_class(node, ['PAST'; 'VarList'])
-yes:
-    .return (1)
-no:
-    .return (0)
-.end
-
-# Local Variables:
-#   mode: pir
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:


More information about the parrot-commits mailing list