summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishal Bhatia <vishal@deja.com>1998-12-16 05:17:03 +0200
committerJarkko Hietaniemi <jhi@iki.fi>1998-12-29 13:06:26 +0000
commit9c7139f21bf83efebcf990d36376e93b958bd9cc (patch)
treef7b7d45997a8fc40ff10f47fefcd4595262e4a0b
parentff144d38e7618d28fa8fdeaf455d8f870e9dbbc6 (diff)
downloadperl-9c7139f21bf83efebcf990d36376e93b958bd9cc.tar.gz
More minor Fixes in CC.pm/C.pm
To: perl5-porters@perl.org Message-ID: <MLIST_199812160055.QAA06272@f10.hotmail.com> p4raw-id: //depot/cfgperl@2525
-rw-r--r--ext/B/B/C.pm1
-rw-r--r--ext/B/B/CC.pm9
-rw-r--r--ext/B/B/Stackobj.pm27
3 files changed, 24 insertions, 13 deletions
diff --git a/ext/B/B/C.pm b/ext/B/B/C.pm
index baf6def71b..95c5858df8 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 391a787f9d..e4f88772be 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 3f7f0f7f07..09a3e902ba 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;
}