# XXX The standard perl PP code has extra handling for
# some special case arguments of these operators.
#
- sub pp_add { numeric_binop($_[0], $plus_op, INTS_CLOSED) }
- sub pp_subtract { numeric_binop($_[0], $minus_op, INTS_CLOSED) }
- sub pp_multiply { numeric_binop($_[0], $multiply_op, INTS_CLOSED) }
+ sub pp_add { numeric_binop($_[0], $plus_op) }
+ sub pp_subtract { numeric_binop($_[0], $minus_op) }
+ sub pp_multiply { numeric_binop($_[0], $multiply_op) }
sub pp_divide { numeric_binop($_[0], $divide_op) }
sub pp_modulo { int_binop($_[0], $modulo_op) } # differs from perl's
($src, $dst) = ($dst, $src) if $backwards;
my $type = $src->{type};
if ($type == T_INT) {
- $dst->set_int($src->as_int);
+ $dst->set_int($src->as_int,$src->{flags} & VALID_UNSIGNED);
} elsif ($type == T_DOUBLE) {
$dst->set_numeric($src->as_numeric);
} else {
my $type = $src->{type};
runtime("if (PL_tainting && PL_tainted) TAINT_NOT;");
if ($type == T_INT) {
- runtime sprintf("sv_setiv(TOPs, %s);", $src->as_int);
+ if ($src->{flags} & VALID_UNSIGNED){
+ runtime sprintf("sv_setuv(TOPs, %s);", $src->as_int);
+ }else{
+ runtime sprintf("sv_setiv(TOPs, %s);", $src->as_int);
+ }
} elsif ($type == T_DOUBLE) {
runtime sprintf("sv_setnv(TOPs, %s);", $src->as_double);
} else {
package B::Stackobj;
use Exporter ();
@ISA = qw(Exporter);
-@EXPORT_OK = qw(set_callback T_UNKNOWN T_DOUBLE T_INT
+@EXPORT_OK = qw(set_callback T_UNKNOWN T_DOUBLE T_INT VALID_UNSIGNED
VALID_INT VALID_DOUBLE VALID_SV REGISTER TEMPORARY);
%EXPORT_TAGS = (types => [qw(T_UNKNOWN T_DOUBLE T_INT)],
flags => [qw(VALID_INT VALID_DOUBLE VALID_SV
- REGISTER TEMPORARY)]);
+ VALID_UNSIGNED REGISTER TEMPORARY)]);
use Carp qw(confess);
use strict;
-use B qw(class SVf_IOK SVf_NOK);
+use B qw(class SVf_IOK SVf_NOK SVf_IVisUV);
# Types
sub T_UNKNOWN () { 0 }
# Flags
sub VALID_INT () { 0x01 }
-sub VALID_DOUBLE () { 0x02 }
-sub VALID_SV () { 0x04 }
-sub REGISTER () { 0x08 } # no implicit write-back when calling subs
-sub TEMPORARY () { 0x10 } # no implicit write-back needed at all
-sub SAVE_INT () { 0x20 } #if int part needs to be saved at all
-sub SAVE_DOUBLE () { 0x40 } #if double part needs to be saved at all
+sub VALID_UNSIGNED () { 0x02 }
+sub VALID_DOUBLE () { 0x04 }
+sub VALID_SV () { 0x08 }
+sub REGISTER () { 0x10 } # no implicit write-back when calling subs
+sub TEMPORARY () { 0x20 } # no implicit write-back needed at all
+sub SAVE_INT () { 0x40 } #if int part needs to be saved at all
+sub SAVE_DOUBLE () { 0x80 } #if double part needs to be saved at all
#
sub write_back { confess "stack object does not implement write_back" }
-sub invalidate { shift->{flags} &= ~(VALID_INT | VALID_DOUBLE) }
+sub invalidate { shift->{flags} &= ~(VALID_INT |VALID_UNSIGNED | VALID_DOUBLE) }
sub as_sv {
my $obj = shift;
# set_numeric and set_sv are only invoked on legal lvalues.
#
sub set_int {
- my ($obj, $expr) = @_;
+ my ($obj, $expr,$unsigned) = @_;
runtime("$obj->{iv} = $expr;");
$obj->{flags} &= ~(VALID_SV | VALID_DOUBLE);
$obj->{flags} |= VALID_INT|SAVE_INT;
+ $obj->{flags} |= VALID_UNSIGNED if $unsigned;
}
sub set_double {
my $flags = $obj->{flags};
return if $flags & VALID_SV;
if ($flags & VALID_INT) {
- runtime("sv_setiv($obj->{sv}, $obj->{iv});");
+ if ($flags & VALID_UNSIGNED ){
+ runtime("sv_setuv($obj->{sv}, $obj->{iv});");
+ }else{
+ runtime("sv_setiv($obj->{sv}, $obj->{iv});");
+ }
} elsif ($flags & VALID_DOUBLE) {
runtime("sv_setnv($obj->{sv}, $obj->{nv});");
} else {
if ($svflags & SVf_IOK) {
$obj->{flags} = VALID_INT|VALID_DOUBLE;
$obj->{type} = T_INT;
- $obj->{nv} = $obj->{iv} = $sv->IV;
+ if ($svflags & SVf_IVisUV){
+ $obj->{flags} |= VALID_UNSIGNED;
+ $obj->{nv} = $obj->{iv} = $sv->UVX;
+ }else{
+ $obj->{nv} = $obj->{iv} = $sv->IV;
+ }
} elsif ($svflags & SVf_NOK) {
$obj->{flags} = VALID_INT|VALID_DOUBLE;
$obj->{type} = T_DOUBLE;
$Test::Harness::switches = ""; # Too much noise otherwise
$Test::Harness::verbose = shift if @ARGV && $ARGV[0] eq '-v';
+#fudge DATA for now.
+%datahandle = qw(
+ lib/bigint.t 1
+ lib/bigintpm.t 1
+ lib/bigfloat.t 1
+ lib/bigfloatpm.t 1
+ op/gv.t 1
+ lib/complex.t 1
+ lib/ph.t 1
+ lib/soundex.t 1
+ op/misc.t 1
+ op/runlevel.t 1
+ op/tie.t 1
+ op/lex_assign.t 1
+ pragma/subs.t 1
+ );
+
+foreach (keys %datahandle) {
+ unlink "$_.t";
+}
+
@tests = @ARGV;
@tests = <base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t lib/*.t> unless @tests;
Test::Harness::runtests @tests;
exit(0) unless -e "../testcompile";
-#fudge DATA for now.
%infinite = qw (
- op/bop.t 1
- lib/hostname.t 1
- );
-
-%datahandle = qw(
- lib/bigint.t 1
- lib/bigintpm.t 1
- lib/bigfloat.t 1
- lib/bigfloatpm.t 1
+ op/bop.t 1
+ lib/hostname.t 1
+ op/lex_assign.t 1
+ lib/ph.t 1
);
my $dhwrapper = <<'EOT';
@tests = grep (!$infinite{$_}, @tests);
@tests = map {
my $new = $_;
- if ($datahandle{$_}) {
+ if ($datahandle{$_} && !( -f $new.t) ) {
$new .= '.t';
local(*F, *T);
open(F,"<$_") or die "Can't open $_: $!";