[svn:parrot] r44776 - in branches/ops_pct/compilers/opsc: src/Ops src/Ops/Compiler t

bacek at svn.parrot.org bacek at svn.parrot.org
Mon Mar 8 20:23:58 UTC 2010


Author: bacek
Date: Mon Mar  8 20:23:57 2010
New Revision: 44776
URL: https://trac.parrot.org/parrot/changeset/44776

Log:
Skip ops in compiler

Modified:
   branches/ops_pct/compilers/opsc/src/Ops/Compiler/Actions.pm
   branches/ops_pct/compilers/opsc/src/Ops/File.pm
   branches/ops_pct/compilers/opsc/t/06-opsfile.t

Modified: branches/ops_pct/compilers/opsc/src/Ops/Compiler/Actions.pm
==============================================================================
--- branches/ops_pct/compilers/opsc/src/Ops/Compiler/Actions.pm	Mon Mar  8 20:11:43 2010	(r44775)
+++ branches/ops_pct/compilers/opsc/src/Ops/Compiler/Actions.pm	Mon Mar  8 20:23:57 2010	(r44776)
@@ -4,6 +4,7 @@
 class Ops::Compiler::Actions is HLL::Actions;
 
 our $CODE;
+our $OPLIB;
 
 INIT {
     pir::load_bytecode("nqp-settings.pbc");
@@ -32,9 +33,12 @@
 
     for $<op> {
         my $ops := $_.ast;
-        for @($ops) {
-            $_<code> := $CODE++;
-            $past<ops>.push($_);
+        my $skiptable := $OPLIB.skiptable;
+        for @($ops) -> $op {
+            if !$skiptable.exists($op.full_name) {
+                $op<code> := $CODE++;
+                $past<ops>.push($op);
+            }
         }
     }
 

Modified: branches/ops_pct/compilers/opsc/src/Ops/File.pm
==============================================================================
--- branches/ops_pct/compilers/opsc/src/Ops/File.pm	Mon Mar  8 20:11:43 2010	(r44775)
+++ branches/ops_pct/compilers/opsc/src/Ops/File.pm	Mon Mar  8 20:23:57 2010	(r44776)
@@ -183,8 +183,9 @@
 
 =end
 
-method new(*@files, :$nolines) {
+method new(*@files, :$oplib!, :$nolines) {
     self<files>   := @files;
+    self<oplib>   := $oplib;
     self<ops>     := list(); # Ops
     self<preamble>:= '';
 
@@ -222,6 +223,7 @@
 =end
 
 method read_ops($file, $nolines) {
+    $Ops::Compiler::Actions::OPLIB := self<oplib>;
 
     say("# Parsing $file");
     my $buffer := slurp($file);

Modified: branches/ops_pct/compilers/opsc/t/06-opsfile.t
==============================================================================
--- branches/ops_pct/compilers/opsc/t/06-opsfile.t	Mon Mar  8 20:11:43 2010	(r44775)
+++ branches/ops_pct/compilers/opsc/t/06-opsfile.t	Mon Mar  8 20:23:57 2010	(r44776)
@@ -3,24 +3,22 @@
 pir::load_bytecode("compilers/opsc/opsc.pbc");
 pir::load_bytecode("nqp-settings.pbc");
 
-plan(8);
-
-my $f := Ops::File.new();
-ok($f, "Empty Ops::File created");
+plan(7);
 
+my $oplib := Ops::OpLib.new;
 my @files := <
     src/ops/core.ops
     src/ops/math.ops
 >;
 
-$f := Ops::File.new(|@files);
+my $f := Ops::File.new(:oplib($oplib), |@files);
 
 my @ops := $f.ops;
 # 84 core
 # 116 math
 # We can generate more than 1 Ops::Op per op due args expansion.
 say( "# Parsed " ~ + at ops);
-ok( @ops > 84 + 116, "Ops parsed correctly");
+ok(+ at ops == 314, "Ops parsed correctly");
 
 my $op := @ops[0];
 #_dumper($op);


More information about the parrot-commits mailing list