[svn:parrot] r40154 - in branches/ops_pct: . compilers/opsc compilers/opsc/ops
cotto at svn.parrot.org
cotto at svn.parrot.org
Sun Jul 19 07:47:50 UTC 2009
Author: cotto
Date: Sun Jul 19 07:47:50 2009
New Revision: 40154
URL: https://trac.parrot.org/parrot/changeset/40154
Log:
[opsc] move (and attempt to use) code from op.pm to oplib.pm, remove now-obsolete files, update manifest
Deleted:
branches/ops_pct/compilers/opsc/ops/op.pir
branches/ops_pct/compilers/opsc/ops/op.pm
Modified:
branches/ops_pct/MANIFEST
branches/ops_pct/compilers/opsc/ops/oplib.pm
branches/ops_pct/compilers/opsc/opsc_core.pir
Modified: branches/ops_pct/MANIFEST
==============================================================================
--- branches/ops_pct/MANIFEST Sun Jul 19 07:20:51 2009 (r40153)
+++ branches/ops_pct/MANIFEST Sun Jul 19 07:47:50 2009 (r40154)
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Tue Jul 7 18:00:09 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sun Jul 19 07:46:20 2009 UT
#
# See below for documentation on the format of this file.
#
@@ -86,6 +86,7 @@
compilers/nqp/src/Grammar.pg [nqp]
compilers/nqp/src/Grammar/Actions.pir [nqp]
compilers/nqp/src/builtins.pir [nqp]
+compilers/nqp/src/quote_expression.pir [nqp]
compilers/nqp/t/01-literals.t [test]
compilers/nqp/t/02-if-else.t [test]
compilers/nqp/t/02-if.t [test]
@@ -115,23 +116,26 @@
compilers/nqp/t/27-ternary.t [test]
compilers/nqp/t/28-return.t [test]
compilers/nqp/t/29-self.t [test]
+compilers/nqp/t/30-interpolate.t [test]
compilers/nqp/t/harness [test]
compilers/opsc/builtins.pir [opsc]
compilers/opsc/compiler/actions.pm [opsc]
compilers/opsc/compiler/grammar.pg [opsc]
-compilers/opsc/op/op.pir [opsc]
-compilers/opsc/op/op.pm [opsc]
+compilers/opsc/ops/oplib.pir [opsc]
+compilers/opsc/ops/oplib.pm [opsc]
compilers/opsc/opsc.pir [opsc]
+compilers/opsc/opsc_core.pir [opsc]
compilers/opsc/runcore/base.pm [opsc]
compilers/opsc/runcore/c.pm [opsc]
compilers/opsc/runcore/cgoto.pm [opsc]
compilers/opsc/runcore/cgp.pm [opsc]
compilers/opsc/runcore/cprederef.pm [opsc]
compilers/opsc/runcore/cswitch.pm [opsc]
-compilers/opsc/runcore/runcore.pm [opsc]
compilers/opsc/t/01-parse.t [test]
compilers/opsc/t/02-parse-all-ops.t [test]
compilers/opsc/t/03-past.t [test]
+compilers/opsc/t/04-oplib_BUILD.t [test]
+compilers/opsc/t/04-oplib_parse_ops.t [test]
compilers/opsc/t/common.pir [test]
compilers/opsc/t/harness [test]
compilers/pct/PCT.pir [pct]
Deleted: branches/ops_pct/compilers/opsc/ops/op.pir
==============================================================================
--- branches/ops_pct/compilers/opsc/ops/op.pir Sun Jul 19 07:47:50 2009 (r40153)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,34 +0,0 @@
-# $Id$
-
-=head1 NAME
-
-PAST - Parrot abstract syntax tree for PMC.
-
-=head1 DESCRIPTION
-
-PAST node for a single Op
-
-=cut
-
-.sub '' :anon :load :init
- ## create the classes
- .local pmc p6meta
- p6meta = new 'P6metaclass'
-
- p6meta.'new_class'('Ops::Op', 'parent'=>'PAST::Op')
-
- .return ()
-.end
-
-
-=head1 COPYRIGHT
-
-Copyright (C) 2009, Parrot Foundation.
-
-=cut
-
-# Local Variables:
-# mode: pir
-# fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:
Deleted: branches/ops_pct/compilers/opsc/ops/op.pm
==============================================================================
--- branches/ops_pct/compilers/opsc/ops/op.pm Sun Jul 19 07:47:50 2009 (r40153)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,81 +0,0 @@
-# Copyright (C) 2009, Parrot Foundation.
-# $Id$
-
-class Ops::Op;
-
-=head1 NAME
-
-C<Ops::Op> - Parrot Operation
-
-=head1 DESCRIPTION
-
-Extends PAST::Block with various helper methods.
-
-=head2 Methods
-
-=over 4
-
-=item C<set_body>
-
-Set the body of this Op and do some processing on the body to determine which
-jump flags need to be set.
-
-=cut
-
-method set_body($body) {
- my %jumps;
- my @jumps;
-
- #figure out which control flow flags need to be set for this op
- if (match( " 'goto' \s+ 'ADDRESS' ", $body)) {
- %jumps{'PARROT_JUMP_ADDRESS'} := 1;
- }
-
- if (match( " 'goto' \s+ 'OFFSET' ", $body) ||
- self.name eq 'runinterp' ) {
- %jumps{'PARROT_JUMP_RELATIVE'} := 1;
- }
-
- if (match( " 'goto' \s+ 'POP' ", $body)) {
- %jumps{'PARROT_JUMP_POP'} := 1;
- }
-
- if (match( " 'expr' \s+ 'NEXT' ", $body) ||
- self.name eq 'runinterp' ) {
- %jumps{'PARROT_JUMP_ENEXT'} := 1;
- }
-
- if (match( " 'restart' \s+ 'OFFSET' ", $body)) {
- %jumps{'PARROT_JUMP_RELATIVE'} := 1;
- %jumps{'PARROT_JUMP_RESTART'} := 1;
- }
- elsif (match( " 'restart' \s+ 'OFFSET' ", $body)) {
- %jumps{'PARROT_JUMP_RESTART'} := 1;
- %jumps{'PARROT_JUMP_ENEXT'} := 1;
- }
- elsif (self.name eq 'branch_cs' || self.name eq 'returncc' ) {
- %jumps{'PARROT_JUMP_RESTART'} := 1;
- }
- elsif (match( " 'restart' \s+ 'ADDRESS' ", $body)) {
- %jumps{'PARROT_JUMP_RESTART'} := 1;
- %jumps{'PARROT_JUMP_ENEXT'} := 0;
- }
-
- #XXX: need to handle PARROT_JUMP_GNEXT
-
- for %jumps {
- if %jumps{$_} {
- @jumps.push($_);
- }
- }
-
- if + at jumps == 0 {
- self<jump_flags> := '0';
- }
- else {
- self<jump_flags> := join('|', @jumps);
- }
-}
-
-
-
Modified: branches/ops_pct/compilers/opsc/ops/oplib.pm
==============================================================================
--- branches/ops_pct/compilers/opsc/ops/oplib.pm Sun Jul 19 07:20:51 2009 (r40153)
+++ branches/ops_pct/compilers/opsc/ops/oplib.pm Sun Jul 19 07:47:50 2009 (r40154)
@@ -108,9 +108,6 @@
self.load_op_map_files();
- #split ops_past into ops
- self.build_ops();
-
self;
}
@@ -152,7 +149,7 @@
=cut
method set_ops_past($past) {
- self<ops_past> := past;
+ self<ops_past> := $past;
}
=item C<load_op_map_files>
@@ -184,9 +181,10 @@
my $op_num := 0;
- for self<ops_past> {
+ for self<ops_past><ops>.iterator {
my $cur_op := $_;
- my $jump_flags := self.get_jump_flags($cur_op);
+ say("found an op: "~ ~$_<name>);
+ #my $jump_flags := self.get_jump_flags($cur_op);
#figure out all the constant data: flags, name, etc
#build an array of args
#$args := [ [] ];
@@ -219,6 +217,69 @@
}
+=item C<get_jump_flags>
+
+Process the body of this op to figure out which jump flags need to be set.
+
+=cut
+
+method get_jump_flags($op) {
+ my %jumps;
+ my @jumps;
+
+ #figure out which control flow flags need to be set for this op
+ if (match( " 'goto' \s+ 'ADDRESS' ", ~$op)) {
+ %jumps{'PARROT_JUMP_ADDRESS'} := 1;
+ }
+
+ if (match( " 'goto' \s+ 'OFFSET' ", ~$op) ||
+ $op.name eq 'runinterp' ) {
+ %jumps{'PARROT_JUMP_RELATIVE'} := 1;
+ }
+
+ if (match( " 'goto' \s+ 'POP' ", ~$op)) {
+ %jumps{'PARROT_JUMP_POP'} := 1;
+ }
+
+ if (match( " 'expr' \s+ 'NEXT' ", ~$op) ||
+ $op.name eq 'runinterp' ) {
+ %jumps{'PARROT_JUMP_ENEXT'} := 1;
+ }
+
+ if (match( " 'restart' \s+ 'OFFSET' ", ~$op)) {
+ %jumps{'PARROT_JUMP_RELATIVE'} := 1;
+ %jumps{'PARROT_JUMP_RESTART'} := 1;
+ }
+ elsif (match( " 'restart' \s+ 'OFFSET' ", ~$op)) {
+ %jumps{'PARROT_JUMP_RESTART'} := 1;
+ %jumps{'PARROT_JUMP_ENEXT'} := 1;
+ }
+ elsif ($op.name eq 'branch_cs' || $op.name eq 'returncc' ) {
+ %jumps{'PARROT_JUMP_RESTART'} := 1;
+ }
+ elsif (match( " 'restart' \s+ 'ADDRESS' ", ~~$op)) {
+ %jumps{'PARROT_JUMP_RESTART'} := 1;
+ %jumps{'PARROT_JUMP_ENEXT'} := 0;
+ }
+
+ #XXX: need to handle PARROT_JUMP_GNEXT
+
+ for %jumps {
+ if %jumps{$_} {
+ @jumps.push($_);
+ }
+ }
+
+ if + at jumps == 0 {
+ $op<jump_flags> := '0';
+ }
+ else {
+ $op<jump_flags> := join('|', @jumps);
+ }
+ say(~$op<jump_flags>);
+}
+
+
method _load_num_file() {
# slurp isn't very efficient. But extending NQP beyond bare minimum is not in scope.
Modified: branches/ops_pct/compilers/opsc/opsc_core.pir
==============================================================================
--- branches/ops_pct/compilers/opsc/opsc_core.pir Sun Jul 19 07:20:51 2009 (r40153)
+++ branches/ops_pct/compilers/opsc/opsc_core.pir Sun Jul 19 07:47:50 2009 (r40154)
@@ -40,6 +40,7 @@
#use default location for ops.num and ops.skip for now
oplib.'BUILD'(files :named("files"))
oplib.'set_ops_past'(past)
+ oplib.'build_ops'()
#for each runcore
# * make a clone of the op tree
More information about the parrot-commits
mailing list