From: Jarkko Hietaniemi Date: Thu, 15 Jun 2000 23:54:16 +0000 (+0000) Subject: Bytecode patches from Benjamin Stuhl. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e717db08e9ac58aa42b4beba29a3a135ffd370d0;p=p5sagit%2Fp5-mst-13.2.git Bytecode patches from Benjamin Stuhl. p4raw-id: //depot/cfgperl@6218 --- diff --git a/ext/B/B/Assembler.pm b/ext/B/B/Assembler.pm index 1324f7c..06e7c1a 100644 --- a/ext/B/B/Assembler.pm +++ b/ext/B/B/Assembler.pm @@ -140,16 +140,20 @@ sub strip_comments { return $stmt; } -sub gen_header { # create the ByteCode header +sub gen_header { # create the ByteCode header: magic, archname, ivsize, ptrsize, + # byteorder + # nvtype irrelevant (floats are stored as strings) my $header = B::Asmdata::PUT_U32(0x43424c50); # 'PLBC' - $header .= B::Asmdata::PUT_strconst($Config{archname}); + $header .= B::Asmdata::PUT_strconst(qq["$Config{archname}"]); $header .= B::Asmdata::PUT_U32($Config{ivsize}); - $header .= B::Asmdata::PUT_U32($Config{nvsize}); $header .= B::Asmdata::PUT_U32($Config{ptrsize}); - $header .= B::Asmdata::PUT_strconst($Config{byteorder}); # PV not U32 because - # of varying size + $header .= B::Asmdata::PUT_strconst(sprintf(qq["0x%s"], $Config{byteorder})); + # PV not U32 because + # of varying size + $header; } + sub parse_statement { my $stmt = shift; my ($insn, $arg) = $stmt =~ m{ diff --git a/ext/B/B/Bytecode.pm b/ext/B/B/Bytecode.pm index 8cb60ee..4b2197e 100644 --- a/ext/B/B/Bytecode.pm +++ b/ext/B/B/Bytecode.pm @@ -300,8 +300,7 @@ sub B::COP::bytecode { } my $stashpv = $op->stashpv; my $warnings = $op->warnings; - my $warningsix; - $warningsix = $warnings->objix; + my $warningsix = $warnings->objix; $warnings->bytecode; $op->B::OP::bytecode; printf <<"EOT", pvstring($op->label), pvstring($stashpv), $op->cop_seq, pvstring($file), $op->arybase; @@ -532,7 +531,6 @@ sub B::HV::bytecode { mark_saved($hv); my $name = $hv->NAME; my $ix = $hv->objix; - printf "sv_refcnt %d\nsv_flags 0x%x\n", $hv->REFCNT, $hv->FLAGS; if (!$name) { # It's an ordinary HV. Stashes have NAME set and need no further # saving beyond the gv_stashpv that $hv->objix already ensures. @@ -549,6 +547,7 @@ sub B::HV::bytecode { printf("newpv %s\nhv_store %d\n", pvstring($contents[$i]), $ixes[$i / 2]); } + printf "sv_refcnt %d\nsv_flags 0x%x\n", $hv->REFCNT, $hv->FLAGS; } }