From: Gurusamy Sarathy Date: Tue, 7 Mar 2000 09:57:24 +0000 (+0000) Subject: get ByteLoader working again X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fc2904571a077900be0708b6f150c27f77e62f18;p=p5sagit%2Fp5-mst-13.2.git get ByteLoader working again p4raw-id: //depot/perl@5593 --- diff --git a/bytecode.pl b/bytecode.pl index 0ffe8e4..d1e1c70 100644 --- a/bytecode.pl +++ b/bytecode.pl @@ -343,7 +343,7 @@ xcv_file CvFILE(bytecode_sv) pvcontents xcv_depth CvDEPTH(bytecode_sv) long xcv_padlist *(SV**)&CvPADLIST(bytecode_sv) svindex xcv_outside *(SV**)&CvOUTSIDE(bytecode_sv) svindex -xcv_flags CvFLAGS(bytecode_sv) U8 +xcv_flags CvFLAGS(bytecode_sv) U16 av_extend bytecode_sv SSize_t x av_push bytecode_sv svindex x xav_fill AvFILLp(bytecode_sv) SSize_t diff --git a/ext/B/B/Asmdata.pm b/ext/B/B/Asmdata.pm index d62967f..bc0eda9 100644 --- a/ext/B/B/Asmdata.pm +++ b/ext/B/B/Asmdata.pm @@ -72,7 +72,7 @@ $insn_data{xcv_file} = [48, \&PUT_pvcontents, "GET_pvcontents"]; $insn_data{xcv_depth} = [49, \&PUT_I32, "GET_I32"]; $insn_data{xcv_padlist} = [50, \&PUT_svindex, "GET_svindex"]; $insn_data{xcv_outside} = [51, \&PUT_svindex, "GET_svindex"]; -$insn_data{xcv_flags} = [52, \&PUT_U8, "GET_U8"]; +$insn_data{xcv_flags} = [52, \&PUT_U16, "GET_U16"]; $insn_data{av_extend} = [53, \&PUT_I32, "GET_I32"]; $insn_data{av_push} = [54, \&PUT_svindex, "GET_svindex"]; $insn_data{xav_fill} = [55, \&PUT_I32, "GET_I32"]; diff --git a/ext/B/B/Bytecode.pm b/ext/B/B/Bytecode.pm index cb061f3..bafec3f 100644 --- a/ext/B/B/Bytecode.pm +++ b/ext/B/B/Bytecode.pm @@ -463,20 +463,23 @@ sub B::GV::bytecode { return if saved($gv); my $ix = $gv->objix; mark_saved($gv); - my $gvname = $gv->NAME; - my $name = cstring($gv->STASH->NAME . "::" . $gvname); - my $egv = $gv->EGV; - my $egvix = $egv->objix; ldsv($ix); - printf <<"EOT", $gv->FLAGS, $gv->GvFLAGS, $gv->LINE, pvstring($gv->FILE); + printf <<"EOT", $gv->FLAGS, $gv->GvFLAGS; sv_flags 0x%x xgv_flags 0x%x +EOT + my $refcnt = $gv->REFCNT; + printf("sv_refcnt_add %d\n", $refcnt - 1) if $refcnt > 1; + return if $gv->is_empty; + printf <<"EOT", $gv->LINE, pvstring($gv->FILE); gp_line %d newpv %s gp_file EOT - my $refcnt = $gv->REFCNT; - printf("sv_refcnt_add %d\n", $refcnt - 1) if $refcnt > 1; + my $gvname = $gv->NAME; + my $name = cstring($gv->STASH->NAME . "::" . $gvname); + my $egv = $gv->EGV; + my $egvix = $egv->objix; my $gvrefcnt = $gv->GvREFCNT; printf("gp_refcnt_add %d\n", $gvrefcnt - 1) if $gvrefcnt > 1; if ($gvrefcnt > 1 && $ix != $egvix) { @@ -580,7 +583,7 @@ sub B::CV::bytecode { for ($i = 0; $i < @ixes; $i++) { printf "xcv_%s %d\n", lc($subfield_names[$i]), $ixes[$i]; } - printf "xcv_depth %d\nxcv_flags 0x%x\n", $cv->DEPTH, $cv->FLAGS; + printf "xcv_depth %d\nxcv_flags 0x%x\n", $cv->DEPTH, $cv->CvFLAGS; printf "newpv %s\nxcv_file\n", pvstring($cv->FILE); # Now save all the subfields (except for CvROOT which was handled # above) and CvSTART (now the initial element of @subfields). diff --git a/ext/B/B/C.pm b/ext/B/B/C.pm index dafef33..d0c8159 100644 --- a/ext/B/B/C.pm +++ b/ext/B/B/C.pm @@ -1068,7 +1068,7 @@ typedef struct { perl_mutex *xcv_mutexp; struct perl_thread *xcv_owner; /* current owner thread */ #endif /* USE_THREADS */ - U8 xcv_flags; + cv_flags_t xcv_flags; } XPVCV_or_similar; #define ANYINIT(i) i #else diff --git a/ext/ByteLoader/bytecode.h b/ext/ByteLoader/bytecode.h index 6e19e12..1621fed 100644 --- a/ext/ByteLoader/bytecode.h +++ b/ext/ByteLoader/bytecode.h @@ -30,8 +30,22 @@ typedef IV IV64; } \ } STMT_END -#define BGET_comment_t(arg) \ +#ifdef BYTELOADER_LOG_COMMENTS +# define BGET_comment_t(arg) \ + STMT_START { \ + char buf[1024]; \ + int i = 0; \ + do { \ + arg = BGET_FGETC(); \ + buf[i++] = (char)arg; \ + } while (arg != '\n' && arg != EOF); \ + buf[i] = '\0'; \ + PerlIO_printf(PerlIO_stderr(), "%s", buf); \ + } STMT_END +#else +# define BGET_comment_t(arg) \ do { arg = BGET_FGETC(); } while (arg != '\n' && arg != EOF) +#endif /* * In the following, sizeof(IV)*4 is just a way of encoding 32 on 64-bit-IV @@ -113,7 +127,8 @@ typedef IV IV64; ((PMOP*)o)->op_pmregexp = arg ? \ CALLREGCOMP(aTHX_ arg, arg + bytecode_pv.xpv_cur, ((PMOP*)o)) : 0 #define BSET_newsv(sv, arg) sv = NEWSV(666,0); SvUPGRADE(sv, arg) -#define BSET_newop(o, arg) o = (OP*)safemalloc(optype_size[arg]) +#define BSET_newop(o, arg) ((o = (OP*)safemalloc(optype_size[arg])), \ + memzero((char*)o,optype_size[arg])) #define BSET_newopn(o, arg) STMT_START { \ OP *oldop = o; \ BSET_newop(o, arg); \ diff --git a/ext/ByteLoader/byterun.c b/ext/ByteLoader/byterun.c index 595fd4e..a1044ab 100644 --- a/ext/ByteLoader/byterun.c +++ b/ext/ByteLoader/byterun.c @@ -431,8 +431,8 @@ byterun(pTHXo_ struct bytestream bs) } case INSN_XCV_FLAGS: /* 52 */ { - U8 arg; - BGET_U8(arg); + U16 arg; + BGET_U16(arg); CvFLAGS(bytecode_sv) = arg; break; }