[PATCH] More NV/IV size issues.

2001-09-20 Thread Andy Dougherty

This patch does two only somewhat related things.

Parrot/Opcode.pm:  Change the hard-wired assumption that sizeof(nv) =
2*sizeof(iv) to a PConfig-type computed value.

Parrot/Test.pm:  Change it to run with the perl that was used to generate
this version of Parrot.  This is useful if, for example, you want to use
bleadperl to build and test parrot (e.g. to try out various 64-bit
options) but you still have a 5.6.x (or 5.005_xx) installed as the default
'perl' on your system.  Since perl-5.7.x is installed 'version-only', a
plain 'perl' is quite likely to pick up the older perl in such cases.
Such an older perl might well not understand pack('q') used in the
assembler.


diff -r -u parrot/Parrot/Opcode.pm parrot-andy/Parrot/Opcode.pm
--- parrot/Parrot/Opcode.pm Mon Sep 17 20:32:15 2001
+++ parrot-andy/Parrot/Opcode.pmThu Sep 20 10:18:43 2001
@@ -2,11 +2,15 @@
 
 use strict;
 use Symbol;
+use Parrot::Config;
 
 my %opcode;
 my $fingerprint;
 my $revision;
 
+my $nvivsize;
+$nvivsize = $PConfig{nvsize}/$PConfig{ivsize};
+
 sub _load {
 my $file = @_ ? shift : opcode_table;
 
@@ -42,7 +46,7 @@
 
my $num_i = () = grep {/i/} @params;
my $num_n = () = grep {/n/} @params;
-   $opcode{$name}{RETURN_OFFSET} = 1 + $num_i + $num_n * 2;
+   $opcode{$name}{RETURN_OFFSET} = 1 + $num_i + $num_n * $nvivsize;
 }
 }
 
@@ -145,7 +149,7 @@
 
my $num_i = () = grep {/i/} @params;
my $num_n = () = grep {/n/} @params;
-   $opcode{$name}{RETURN_OFFSET} = 1 + $num_i + $num_n * 2;
+   $opcode{$name}{RETURN_OFFSET} = 1 + $num_i + $num_n * $nvivsize;
 }
 
 return %opcode;
diff -r -u parrot/Parrot/Test.pm parrot-andy/Parrot/Test.pm
--- parrot/Parrot/Test.pm   Sun Sep 16 12:21:16 2001
+++ parrot-andy/Parrot/Test.pm  Thu Sep 20 10:14:05 2001
@@ -4,6 +4,7 @@
 
 use strict;
 use vars qw(@EXPORT @ISA);
+use Parrot::Config;
 
 require Exporter;
 require Test::More;
@@ -57,7 +58,7 @@
 print ASSEMBLY $assembly;
 close ASSEMBLY;
 
-_run_command( perl assemble.pl $as_f --output $by_f );
+_run_command( $PConfig{perl} assemble.pl $as_f --output $by_f );
 _run_command( ./test_prog $by_f, 'STDOUT' = $out_f );
 
 my $prog_output;
-- 
Andy Dougherty  [EMAIL PROTECTED]
Dept. of Physics
Lafayette College, Easton PA 18042




Re: [PATCH] More NV/IV size issues.

2001-09-20 Thread Simon Cozens

On Thu, Sep 20, 2001 at 10:38:10AM -0400, Andy Dougherty wrote:
 This patch does two only somewhat related things.
 
 Parrot/Opcode.pm:  Change the hard-wired assumption that sizeof(nv) =
 2*sizeof(iv) to a PConfig-type computed value.
 
 Parrot/Test.pm:  Change it to run with the perl that was used to generate
 this version of Parrot.  This is useful if, for example, you want to use
 bleadperl to build and test parrot (e.g. to try out various 64-bit
 options) but you still have a 5.6.x (or 5.005_xx) installed as the default
 'perl' on your system.  Since perl-5.7.x is installed 'version-only', a
 plain 'perl' is quite likely to pick up the older perl in such cases.
 Such an older perl might well not understand pack('q') used in the
 assembler.

Thanks, applied.

-- 
Wouldn't it be wonderful if real life supported control-Z?