Ron Blaschke wrote:
> Joshua Isom wrote:
>> On Oct 13, 2007, at 7:20 AM, Ron Blaschke wrote:
>>> Attached patch should fix computed goto on Solaris with the Sun C
>>> compiler.
> [snip]
>>> Could someone please review the patch if I got it right, and maybe test
>>> it on other computed goto platforms?
>> Just to clarify, you did reenable CGP in compilers/imcc/main.c,
>> correct?  It's been disabled for a while.
> 
> Bummer, no I did not.  I thought everything was connected to Configure's
> --cgoto.  Thanks for noticing, Joshua.
> 
> chromatic, thanks for giving it a spin.  Since it's working for you I
> guess it'll work on Solaris as well, but I'll verify on Monday.  This
> time, the right way.

I've revised the patch a bit (r22073 introduced an incompatible change)
and tested it against r22101.

$make testC

All tests successful (1 subtest UNEXPECTEDLY SUCCEEDED), 8 tests and 242
subtests skipped.
Passed TODO      Stat Wstat TODOs Pass  List of Passed
-------------------------------------------------------------------------------
t/op/debuginfo.t                2    1  8
Files=222, Tests=4816, 995 wallclock secs (439.78 cusr + 369.99 csys =
809.77
CPU)

Ron
Index: lib/Parrot/OpTrans/CGP.pm
===================================================================
--- lib/Parrot/OpTrans/CGP.pm   (revision 22101)
+++ lib/Parrot/OpTrans/CGP.pm   (working copy)
@@ -91,7 +91,7 @@
         return "if ($addr == 0)
           return 0;
    _reg_base = (char*)interp->ctx.bp.regs_i;
-   goto **(cur_opcode = opcode_to_prederef(interp, $addr))";
+   goto **(void **)(cur_opcode = opcode_to_prederef(interp, $addr))";
     }
 }
 
@@ -105,7 +105,7 @@
 sub goto_offset {
     my ( $self, $offset ) = @_;
 
-    return "goto **(cur_opcode += $offset)";
+    return "goto **(void **)(cur_opcode += $offset)";
 }
 
 =item C<goto_pop()>
@@ -118,7 +118,7 @@
 sub goto_pop {
     my ($self) = @_;
 
-    return "goto **(opcode_t *)(cur_opcode = opcode_to_prederef(interp,
+    return "goto **(void **)(cur_opcode = opcode_to_prederef(interp,
         (opcode_t*)pop_dest(interp)))";
 }
 
Index: lib/Parrot/Ops2c/Utils.pm
===================================================================
--- lib/Parrot/Ops2c/Utils.pm   (revision 22101)
+++ lib/Parrot/Ops2c/Utils.pm   (working copy)
@@ -588,7 +588,7 @@
 # endif
 #endif
     _reg_base = (char*)interp->ctx.bp.regs_i;
-    goto **cur_opcode;
+    goto **(void **)cur_opcode;
 
 END_C
     }

Reply via email to