Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

resolve conflict in opsc

  • Loading branch information...
commit 2eb2f979b2ec8c7ebe0dd2609bf22753c6950447 1 parent 95b0fa1
luben authored May 28, 2011
1  MANIFEST
@@ -80,7 +80,6 @@ compilers/opsc/src/Ops/Op.pm                                [opsc]
80 80
 compilers/opsc/src/Ops/OpLib.pm                             [opsc]
81 81
 compilers/opsc/src/Ops/Trans.pm                             [opsc]
82 82
 compilers/opsc/src/Ops/Trans/C.pm                           [opsc]
83  
-compilers/opsc/src/Ops/Util.pm                              [opsc]
84 83
 compilers/opsc/src/builtins.pir                             [opsc]
85 84
 compilers/pct/Defines.mak                                   [pct]
86 85
 compilers/pct/PCT.pir                                       [pct]
54  compilers/opsc/ops2c.nqp
@@ -58,54 +58,17 @@ sub MAIN() {
58 58
                     )
59 59
                  !! undef;
60 60
 
61  
-    my $f;
62  
-    my $do_dump_file := 0;
63  
-    my $do_load      := 1;
64  
-    my $dump_file := $core ?? 'src/ops/ops.dump' !! @files[0] ~ ".dump";
65  
-    if $opts<dump> {
66  
-        try {
67  
-            my $fh   := open($dump_file, :r, :bin);
68  
-            my $dump := $fh.readall;
69  
-            $fh.close();
70  
-
71  
-            $f := pir::thaw__ps($dump);
72  
-            $do_load := 0;
73  
-
74  
-            CATCH {
75  
-                $quiet || pir::say("# Caught $!");
76  
-                $do_dump_file := 1;
77  
-                $f := undef;
78  
-            };
79  
-        }
80  
-    }
81  
-
82  
-    if $do_load {
83  
-        $f := Ops::File.new(|@files,
84  
-            :oplib($lib),
85  
-            :core($core),
86  
-            :quiet($quiet),
87  
-        );
88  
-    }
89  
-
90  
-    if $do_dump_file {
91  
-        $quiet || say("Dumping");
92  
-        my $capture := Ops::Util::strip_source($f);
93  
-        my $frozen  := pir::freeze__sp($capture);
94  
-
95  
-        my $fh := open($dump_file, :w, :bin);
96  
-        $fh.print($frozen);
97  
-        $fh.close();
98  
-    }
  61
+    my $f := Ops::File.new(|@files, :oplib($lib), :core($core), :quiet($quiet));
99 62
 
100 63
     $quiet || say("# Ops parsed in { pir::sprintf__ssp("%.3f", [pir::time__N() - $start_time] ) } seconds.");
  64
+ 
  65
+    my $emitter := Ops::Emitter.new(
  66
+        :ops_file($f), :trans($trans),
  67
+        :script('ops2c.nqp'), :file(@files[0]),
  68
+        :flags( hash( core => $core, quiet => $quiet ) ),
  69
+    );
101 70
 
102 71
     unless $debug {
103  
-        my $emitter := Ops::Emitter.new(
104  
-            :ops_file($f), :trans($trans),
105  
-            :script('ops2c.nqp'), :file(@files[0]),
106  
-            :flags( hash( core => $core, quiet => $quiet ) ),
107  
-        );
108  
-
109 72
         $emitter.print_ops_num_files() if $core;
110 73
         $emitter.print_c_header_files();
111 74
         $emitter.print_c_source_file();
@@ -135,9 +98,6 @@ sub get_options() {
135 98
     # suppress timing and debug output on stdout
136 99
     $getopts.add_option('quiet', 'q');
137 100
 
138  
-    # Use .dump files with parsed ops.
139  
-    $getopts.add_option('dump', 'D');
140  
-
141 101
     $getopts.get_options(pir::getinterp__p()[2]);
142 102
 }
143 103
 
10  compilers/opsc/src/Ops/Compiler/Actions.pm
@@ -104,7 +104,7 @@ method op ($/, $key?) {
104 104
         my @variants  := expand_args(pir::clone__PP($OP<normalized_args>));
105 105
         if @variants {
106 106
             for @variants {
107  
-                my $new_op := deep_clone($OP);
  107
+                my $new_op := pir::clone__PP($OP);
108 108
                 $new_op<arg_types> := $_;
109 109
                 $past.push($new_op);
110 110
             }
@@ -117,12 +117,6 @@ method op ($/, $key?) {
117 117
     }
118 118
 }
119 119
 
120  
-sub deep_clone($thingy) {
121  
-    Ops::Util::process_recursive($thingy, -> $_ {
122  
-        $_.WHAT.new;
123  
-    });
124  
-}
125  
-
126 120
 # Normalize args
127 121
 # For each arg produce LoL of all available variants
128 122
 # E.g. "in" will produce "i" and "ic" variants
@@ -173,8 +167,6 @@ sub normalize_args(@args) {
173 167
             $res<direction> := 'o';
174 168
         }
175 169
 
176  
-        #$arg<type> := $res<type>;
177  
-
178 170
         @result.push($res);
179 171
     }
180 172
     @result;
4  compilers/opsc/src/Ops/File.pm
@@ -181,7 +181,7 @@ ops file.
181 181
 
182 182
 =end
183 183
 
184  
-method new(*@files, :$oplib, :$core, :$nolines, :$quiet? = 0) {
  184
+method new(*@files, :$oplib, :$core!, :$nolines, :$quiet? = 0) {
185 185
     self<files>   := @files;
186 186
     self<core>    := $core;
187 187
     self<ops>     := list(); # Ops
@@ -258,7 +258,7 @@ method compile_ops($str, :$experimental? = 0) {
258 258
     my $past     := $compiler.compile($str, :target('past'));
259 259
 
260 260
     for @($past<ops>) {
261  
-        $_<experimental> := ?$experimental;
  261
+        $_<experimental> := $experimental;
262 262
         self<ops>.push($_);
263 263
         #say($_.full_name ~ " is number " ~ self<op_order>);
264 264
         self<op_order>++;

0 notes on commit 2eb2f97

Please sign in to comment.
Something went wrong with that request. Please try again.