[svn:parrot] r46563 - in branches/ops_pct/compilers/opsc: . src/Ops src/Ops/Compiler

cotto at svn.parrot.org cotto at svn.parrot.org
Thu May 13 01:26:04 UTC 2010


Author: cotto
Date: Thu May 13 01:26:03 2010
New Revision: 46563
URL: https://trac.parrot.org/parrot/changeset/46563

Log:
[opsc] only read ops.num and ops.skip for core ops

Modified:
   branches/ops_pct/compilers/opsc/ops2c.nqp
   branches/ops_pct/compilers/opsc/src/Ops/Compiler/Actions.pm
   branches/ops_pct/compilers/opsc/src/Ops/File.pm

Modified: branches/ops_pct/compilers/opsc/ops2c.nqp
==============================================================================
--- branches/ops_pct/compilers/opsc/ops2c.nqp	Thu May 13 01:09:34 2010	(r46562)
+++ branches/ops_pct/compilers/opsc/ops2c.nqp	Thu May 13 01:26:03 2010	(r46563)
@@ -50,13 +50,21 @@
 
 
 my $trans := Ops::Trans::C.new();
-my $lib := Ops::OpLib.new(
-    :num_file('src/ops/ops.num'),
-    :skip_file('src/ops/ops.skip'),
-);
 
 my $start_time := pir::time__N();
-my $f := Ops::File.new(|@files, :oplib($lib), :core($core));
+my $f;
+
+if $core {
+    my $lib := Ops::OpLib.new(
+        :num_file('src/ops/ops.num'),
+        :skip_file('src/ops/ops.skip'),
+    );
+    $f := Ops::File.new(|@files, :oplib($lib), :core(1));
+}
+else {
+    $f := Ops::File.new(|@files, :core(0));
+}
+
 my $end_time := pir::time__N();
 say('# Ops parsed ' ~ ($end_time - $start_time));
 my $emitter := Ops::Emitter.new(

Modified: branches/ops_pct/compilers/opsc/src/Ops/Compiler/Actions.pm
==============================================================================
--- branches/ops_pct/compilers/opsc/src/Ops/Compiler/Actions.pm	Thu May 13 01:09:34 2010	(r46562)
+++ branches/ops_pct/compilers/opsc/src/Ops/Compiler/Actions.pm	Thu May 13 01:26:03 2010	(r46563)
@@ -17,7 +17,6 @@
 }
 
 method body($/) {
-    $OPLIB := Ops::OpLib.new() if !defined($OPLIB);
 
     my $past := PAST::Stmts.new(
         :node($/)
@@ -36,11 +35,15 @@
 
     for $<op> {
         my $ops := $_.ast;
-        my $skiptable := $OPLIB.skiptable;
-        my $optable   := $OPLIB.optable;
+        my $skiptable;
+        my $optable;
+        if $OPLIB {
+            $skiptable := $OPLIB.skiptable;
+            $optable   := $OPLIB.optable;
+        }
         for @($ops) -> $op {
             my $full_name := $op.full_name;
-            if ! $skiptable.exists($full_name) {
+            if $OPLIB && ! $skiptable.exists($full_name) {
                 if $optable.exists($full_name) {
                     $op<code> := $optable{$full_name};
                     $op<experimental> := 0;
@@ -52,6 +55,10 @@
 
                 $past<ops>.push($op);
             }
+            else {
+                $op<code> := $CODE++;
+                $op<experimental> := 0;
+            }
         }
     }
 

Modified: branches/ops_pct/compilers/opsc/src/Ops/File.pm
==============================================================================
--- branches/ops_pct/compilers/opsc/src/Ops/File.pm	Thu May 13 01:09:34 2010	(r46562)
+++ branches/ops_pct/compilers/opsc/src/Ops/File.pm	Thu May 13 01:26:03 2010	(r46563)
@@ -183,9 +183,8 @@
 
 =end
 
-method new(*@files, :$oplib!, :$nolines, :$core) {
+method new(*@files, :$oplib, :$nolines, :$core) {
     self<files>   := @files;
-    self<oplib>   := $oplib;
     self<core>    := $core;
     self<ops>     := list(); # Ops
     self<preamble>:= '';
@@ -195,7 +194,10 @@
     }
 
     self<compiler>:= pir::compreg__Ps('Ops');
-    self<compiler>.set_oplib($oplib);
+    if $core {
+        self<oplib>   := $oplib;
+        self<compiler>.set_oplib($oplib);
+    }
 
     self._set_version();
 
@@ -251,7 +253,7 @@
     my $past     := $compiler.compile($str, :target('past'));
 
     for @($past<ops>) {
-        if $_<experimental> && self<core> {
+        if $_<experimental> {
             say("# Experimental op " ~ $_.full_name ~ " is not in ops.num.");
         }
         self<ops>.push($_);


More information about the parrot-commits mailing list