From: Vishal Bhatia Date: Wed, 16 Dec 1998 03:17:03 +0000 (+0200) Subject: More minor Fixes in CC.pm/C.pm X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9c7139f21bf83efebcf990d36376e93b958bd9cc;p=p5sagit%2Fp5-mst-13.2.git More minor Fixes in CC.pm/C.pm To: perl5-porters@perl.org Message-ID: p4raw-id: //depot/cfgperl@2525 --- diff --git a/ext/B/B/C.pm b/ext/B/B/C.pm index baf6def..95c5858 100644 --- a/ext/B/B/C.pm +++ b/ext/B/B/C.pm @@ -1274,6 +1274,7 @@ sub descend_marked_unused { sub save_main { warn "Starting compile\n"; warn "Walking tree\n"; + seek(STDOUT,0,0); #exclude print statements in BEGIN{} into output walkoptree(main_root, "save"); warn "done main optree, walking symtable for extras\n" if $debug_cv; save_unused_subs(); diff --git a/ext/B/B/CC.pm b/ext/B/B/CC.pm index 391a787..e4f8877 100644 --- a/ext/B/B/CC.pm +++ b/ext/B/B/CC.pm @@ -662,11 +662,15 @@ sub numeric_binop { } } else { if ($force_int) { + my $rightruntime = new B::Pseudoreg ("IV", "riv"); + runtime(sprintf("$$rightruntime = %s;",$right)); runtime(sprintf("sv_setiv(TOPs, %s);", - &$operator("TOPi", $right))); + &$operator("TOPi", $$rightruntime))); } else { + my $rightruntime = new B::Pseudoreg ("double", "rnv"); + runtime(sprintf("$$rightruntime = %s;",$right)); runtime(sprintf("sv_setnv(TOPs, %s);", - &$operator("TOPn", $right))); + &$operator("TOPn",$$rightruntime))); } } } else { @@ -1405,6 +1409,7 @@ sub cc_main { ); } + seek(STDOUT,0,0); #prevent print statements from BEGIN{} into the output output_boilerplate(); print "\n"; output_all("perl_init"); diff --git a/ext/B/B/Stackobj.pm b/ext/B/B/Stackobj.pm index 3f7f0f7..09a3e90 100644 --- a/ext/B/B/Stackobj.pm +++ b/ext/B/B/Stackobj.pm @@ -26,6 +26,7 @@ sub SVf_NOK () { 0x20000 } sub T_UNKNOWN () { 0 } sub T_DOUBLE () { 1 } sub T_INT () { 2 } +sub T_SPECIAL () { 3 } # Flags sub VALID_INT () { 0x01 } @@ -224,17 +225,21 @@ sub B::Stackobj::Const::new { flags => 0, sv => $sv # holds the SV object until write_back happens }, $class; - my $svflags = $sv->FLAGS; - if ($svflags & SVf_IOK) { - $obj->{flags} = VALID_INT|VALID_DOUBLE; - $obj->{type} = T_INT; - $obj->{nv} = $obj->{iv} = $sv->IV; - } elsif ($svflags & SVf_NOK) { - $obj->{flags} = VALID_INT|VALID_DOUBLE; - $obj->{type} = T_DOUBLE; - $obj->{iv} = $obj->{nv} = $sv->NV; - } else { - $obj->{type} = T_UNKNOWN; + if ( ref($sv) eq "B::SPECIAL" ){ + $obj->{type}= T_SPECIAL; + }else{ + my $svflags = $sv->FLAGS; + if ($svflags & SVf_IOK) { + $obj->{flags} = VALID_INT|VALID_DOUBLE; + $obj->{type} = T_INT; + $obj->{nv} = $obj->{iv} = $sv->IV; + } elsif ($svflags & SVf_NOK) { + $obj->{flags} = VALID_INT|VALID_DOUBLE; + $obj->{type} = T_DOUBLE; + $obj->{iv} = $obj->{nv} = $sv->NV; + } else { + $obj->{type} = T_UNKNOWN; + } } return $obj; }