On Wednesday 22 October 2008 22:49:37 Patrick R. Michaud (via RT) wrote:
> Since a number of steps have changed since the last time I worked
> with adding/removing opcodes (April 2008), and I have little idea
> what might be causing this, I'm filing this ticket in hopes that
> someone can clear things up for me.
This patch fixes things for me, with minimal fuss and without inadvertently
adding back in ops that we explicitly blacklist via src/ops/ops.skip.
Note that I had to manually rebuild the PGE, TGE, and JSON compilers because
op numbers changed in bytecode. 'make realclean' will do.
I didn't run the Perl 5 tests of the Parrot::Ops2pm modules. They'll probably
fail, because the Perl 5 code was wrong.
-- c
=== lib/Parrot/OpsRenumber.pm
==================================================================
--- lib/Parrot/OpsRenumber.pm (revision 32155)
+++ lib/Parrot/OpsRenumber.pm (local)
@@ -1,4 +1,4 @@
-# Copyright (C) 2007, The Perl Foundation.
+# Copyright (C) 2007-2008, The Perl Foundation.
# $Id$
package Parrot::OpsRenumber;
use strict;
@@ -77,7 +77,6 @@
my $file = scalar(@_) ? shift : $self->{num_file};
if ($major_version == 0) {
-
# Pre-Parrot 1.0 case
# We open up the currently existing ops.num and file and read it
@@ -91,7 +90,7 @@
# pushed into %fixed as well. Nothing happens to the (opcode) lines
# below the DYNAMIC line.
- my ( $name, $number, @lines, %fixed, $fix );
+ my ( $name, $number, @lines, %seen, %fixed, $fix );
$fix = 1;
open my $OP, '<', $file
or die "Can't open $file, error $!";
@@ -104,7 +103,8 @@
s/^\s*//;
next unless $_;
( $name, $number ) = split( /\s+/, $_ );
- $fixed{$name} = $number if ($fix);
+ $seen{$name} = $number;
+ $fixed{$name} = $number if $fix;
}
close $OP;
@@ -148,7 +148,7 @@
# For all other opcodes, we'll print the opcode, increment the
# index, then print the index on that same line.
- else {
+ elsif ( $seen{ $_->full_name } ) {
printf $OP "%-31s%4d\n", $_->full_name, ++$n;
}
}