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

tcurtis at svn.parrot.org tcurtis at svn.parrot.org
Fri May 21 01:33:43 UTC 2010


Author: tcurtis
Date: Fri May 21 01:33:42 2010
New Revision: 46834
URL: https://trac.parrot.org/parrot/changeset/46834

Log:
Add small example and initial(seemingly working) prototype of PAST::Walker.

Added:
   branches/gsoc_past_optimization/examples/library/pastwalker.pir   (contents, props changed)
   branches/gsoc_past_optimization/runtime/parrot/library/PAST/   (props changed)
   branches/gsoc_past_optimization/runtime/parrot/library/PAST/Walker.pir   (contents, props changed)
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/   (props changed)

Modified: branches/gsoc_past_optimization/MANIFEST
==============================================================================
--- branches/gsoc_past_optimization/MANIFEST	Thu May 20 23:34:21 2010	(r46833)
+++ branches/gsoc_past_optimization/MANIFEST	Fri May 21 01:33:42 2010	(r46834)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Thu May 20 00:41:03 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Thu May 20 08:04:31 2010 UT
 #
 # See below for documentation on the format of this file.
 #
@@ -627,6 +627,7 @@
 examples/library/getopt_demo.pir                            [examples]
 examples/library/md5sum.pir                                 [examples]
 examples/library/ncurses_life.pir                           [examples]
+examples/library/pastwalker.pir                             [examples]
 examples/library/pcre.pir                                   [examples]
 examples/mops/README                                        [examples]
 examples/mops/mops.c                                        [examples]
@@ -1153,6 +1154,7 @@
 runtime/parrot/library/OpenGL.pir                           [library]
 runtime/parrot/library/OpenGL/Math.pir                      [library]
 runtime/parrot/library/P6object.pir                         [library]
+runtime/parrot/library/PAST/Walker.pir                      [library]
 runtime/parrot/library/PCT/README                           []doc
 runtime/parrot/library/PGE/Dumper.pir                       [library]
 runtime/parrot/library/PGE/Glob.pir                         [library]

Modified: branches/gsoc_past_optimization/MANIFEST.SKIP
==============================================================================
--- branches/gsoc_past_optimization/MANIFEST.SKIP	Thu May 20 23:34:21 2010	(r46833)
+++ branches/gsoc_past_optimization/MANIFEST.SKIP	Fri May 21 01:33:42 2010	(r46834)
@@ -1,6 +1,6 @@
 # ex: set ro:
 # $Id$
-# generated by tools/dev/mk_manifest_and_skip.pl Mon May 17 15:32:39 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Thu May 20 08:04:31 2010 UT
 #
 # This file should contain a transcript of the svn:ignore properties
 # of the directories in the Parrot subversion repository. (Needed for
@@ -535,8 +535,6 @@
 ^runtime/parrot/library/.*\.pbc/
 ^runtime/parrot/library/OpenGL_funcs\.pir$
 ^runtime/parrot/library/OpenGL_funcs\.pir/
-^runtime/parrot/library/PAST$
-^runtime/parrot/library/PAST/
 ^runtime/parrot/library/config\.pir$
 ^runtime/parrot/library/config\.pir/
 # generated from svn:ignore of 'runtime/parrot/library/Archive/'
@@ -578,6 +576,9 @@
 # generated from svn:ignore of 'runtime/parrot/library/OpenGL/'
 ^runtime/parrot/library/OpenGL/.*\.pbc$
 ^runtime/parrot/library/OpenGL/.*\.pbc/
+# generated from svn:ignore of 'runtime/parrot/library/PAST/'
+^runtime/parrot/library/PAST/Walker\.pbc$
+^runtime/parrot/library/PAST/Walker\.pbc/
 # generated from svn:ignore of 'runtime/parrot/library/PCT/'
 ^runtime/parrot/library/PCT/.*\.pbc$
 ^runtime/parrot/library/PCT/.*\.pbc/

Modified: branches/gsoc_past_optimization/config/gen/makefiles/root.in
==============================================================================
--- branches/gsoc_past_optimization/config/gen/makefiles/root.in	Thu May 20 23:34:21 2010	(r46833)
+++ branches/gsoc_past_optimization/config/gen/makefiles/root.in	Fri May 21 01:33:42 2010	(r46834)
@@ -285,6 +285,7 @@
 #IF(has_opengl):    $(LIBRARY_DIR)/OpenGL/Math.pbc \
     $(LIBRARY_DIR)/osutils.pbc \
     $(LIBRARY_DIR)/P6object.pbc \
+    $(LIBRARY_DIR)/PAST/Walker.pbc \
     $(LIBRARY_DIR)/ProfTest.pbc \
     $(LIBRARY_DIR)/ProfTest/PIRProfile.pir \
     $(LIBRARY_DIR)/ProfTest/NQPProfile.pir \

Added: branches/gsoc_past_optimization/examples/library/pastwalker.pir
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/gsoc_past_optimization/examples/library/pastwalker.pir	Fri May 21 01:33:42 2010	(r46834)
@@ -0,0 +1,47 @@
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+.namespace ['PAST';'Walker']
+
+.sub 'onload' :anon :init :load
+	load_bytecode 'PCT.pbc'
+	load_bytecode 'PAST/Walker.pbc'
+	$P0 = subclass ['PAST'; 'Walker'], ['PAST'; 'Walker'; 'Dumper']
+.end
+
+.sub 'walk' :multi(['PAST';'Walker';'Dumper'], ['PAST'; 'Val'])
+	.param pmc walker
+	.param pmc node
+	say "Val {"
+	'walkChildren'(walker, node)
+	say "} laV"
+.end
+
+.sub 'walk' :multi(['PAST';'Walker';'Dumper'], ['PAST';'Var'])
+	.param pmc walker
+	.param pmc node
+	say "Var {"
+	'walkChildren'(walker, node)
+	say "} raV"
+.end
+
+.namespace []
+
+.sub 'main' :main
+	.local pmc past, walker
+	past = new ['PAST';'Var']
+	$P0 = new ['PAST';'Val']
+	push past, $P0
+	$P0 = new ['PAST';'Var']
+	push past, $P0
+
+	walker = new ['PAST';'Walker';'Dumper']
+	$P1 = get_hll_global ['PAST';'Walker'], 'walk'
+	$P1(walker, past)
+.end
+
+# Local Variables:
+#   mode: pir
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:

Added: branches/gsoc_past_optimization/runtime/parrot/library/PAST/Walker.pir
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/gsoc_past_optimization/runtime/parrot/library/PAST/Walker.pir	Fri May 21 01:33:42 2010	(r46834)
@@ -0,0 +1,47 @@
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+.sub 'onload' :anon :init :load
+	$P0 = newclass ['PAST'; 'Walker']
+.end
+
+.namespace ['PAST'; 'Walker']
+
+.sub 'walk' :multi(['PAST';'Walker'], ['PAST';'Node'])
+	.param pmc walker
+	.param pmc node
+	.tailcall 'walkChildren'(walker, node)
+.end
+
+.sub 'walkChildren' :multi(['PAST';'Walker'], ['PAST';'Node'])
+	.param pmc walker
+	.param pmc node
+	.local int max, curr
+	.local pmc child
+	max = elements node
+	curr = 0
+
+loop:
+	ge curr, max, end
+	child = node[curr]
+	'walk'(walker, child)
+	inc curr
+	branch loop
+end:
+.end
+
+.sub 'walk' :method
+	.param pmc node
+	.tailcall 'walk'(self, node)
+.end
+
+.sub 'walkChildren' :method
+	.param pmc node
+	.tailcall 'walkChildren'(self, node)
+.end
+
+# Local Variables:
+#   mode: pir
+#   fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:


More information about the parrot-commits mailing list