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

cotto at svn.parrot.org cotto at svn.parrot.org
Sun Mar 7 07:21:16 UTC 2010


Author: cotto
Date: Sun Mar  7 07:21:13 2010
New Revision: 44724
URL: https://trac.parrot.org/parrot/changeset/44724

Log:
[opsc] generate jump flags in op_info_t array

Modified:
   branches/ops_pct/compilers/opsc/TODO
   branches/ops_pct/compilers/opsc/src/Ops/Compiler/Actions.pm
   branches/ops_pct/compilers/opsc/src/Ops/Op.pm
   branches/ops_pct/compilers/opsc/src/Ops/Trans/C.pm
   branches/ops_pct/compilers/opsc/t/06-emitter.t

Modified: branches/ops_pct/compilers/opsc/TODO
==============================================================================
--- branches/ops_pct/compilers/opsc/TODO	Sun Mar  7 03:47:43 2010	(r44723)
+++ branches/ops_pct/compilers/opsc/TODO	Sun Mar  7 07:21:13 2010	(r44724)
@@ -2,7 +2,6 @@
 
 Required for initial self-hosting:
 
-  * Implement handling of flags in Compiler:Actions
   * Implement handling of labels in Trans::C
   * Replacement for ops2c.pl
   * Update config/gen/makefiles/root.in to use opsc instead of ops2c

Modified: branches/ops_pct/compilers/opsc/src/Ops/Compiler/Actions.pm
==============================================================================
--- branches/ops_pct/compilers/opsc/src/Ops/Compiler/Actions.pm	Sun Mar  7 03:47:43 2010	(r44723)
+++ branches/ops_pct/compilers/opsc/src/Ops/Compiler/Actions.pm	Sun Mar  7 07:21:13 2010	(r44724)
@@ -72,6 +72,7 @@
         $<op_body>.ast
     );
 
+    $op.jump($<op_body>.ast<jump>);
     $op<flags> := %flags;
     $op<args>  := @args;
     $op<type>  := ~$<op_type>;

Modified: branches/ops_pct/compilers/opsc/src/Ops/Op.pm
==============================================================================
--- branches/ops_pct/compilers/opsc/src/Ops/Op.pm	Sun Mar  7 03:47:43 2010	(r44723)
+++ branches/ops_pct/compilers/opsc/src/Ops/Op.pm	Sun Mar  7 07:21:13 2010	(r44724)
@@ -192,10 +192,10 @@
 
 =end
 
-method jump(*@jumps) {
+method jump($jump?) {
 
-    if (@jumps) {
-        self<JUMP> := @jumps;
+    if ($jump) {
+        self<JUMP> := $jump;
     }
 
     self<JUMP>;

Modified: branches/ops_pct/compilers/opsc/src/Ops/Trans/C.pm
==============================================================================
--- branches/ops_pct/compilers/opsc/src/Ops/Trans/C.pm	Sun Mar  7 03:47:43 2010	(r44723)
+++ branches/ops_pct/compilers/opsc/src/Ops/Trans/C.pm	Sun Mar  7 07:21:13 2010	(r44724)
@@ -194,7 +194,7 @@
         my $full_name := $op.full_name;
         my $func_name := $op.func_name( self );
         my $body      := $op.body;
-        my $jump      := $op.jump || 0;
+        my $jump      := $op.jump;
         my $arg_count := $op.size;
 
         ## 0 inserted if arrays are empty to prevent msvc compiler errors

Modified: branches/ops_pct/compilers/opsc/t/06-emitter.t
==============================================================================
--- branches/ops_pct/compilers/opsc/t/06-emitter.t	Sun Mar  7 03:47:43 2010	(r44723)
+++ branches/ops_pct/compilers/opsc/t/06-emitter.t	Sun Mar  7 07:21:13 2010	(r44724)
@@ -3,7 +3,7 @@
 pir::load_bytecode("compilers/opsc/opsc.pbc");
 pir::load_bytecode("nqp-settings.pbc");
 
-plan(17);
+plan(18);
 
 my $trans := Ops::Trans::C.new();
 
@@ -79,6 +79,7 @@
 $new_body := translate_op_body($trans, $op_body);
 $restart_addr_ok := $new_body ~~ /'return (opcode_t *) cur_opcode + IREG(1);'/;
 ok($restart_addr_ok, "goto OFFSET() and \$1 translated ok");
+ok($new_body ~~ /'PARROT_JUMP_RELATIVE'/, "jump flags generated");
 
 #say($source);
 


More information about the parrot-commits mailing list