diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-03-07 09:57:24 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-03-07 09:57:24 +0000 |
commit | fc2904571a077900be0708b6f150c27f77e62f18 (patch) | |
tree | f9a9a43d32791298af89c8cb105cf3a11272a9fb /ext | |
parent | 341bd822d2aa170d6da924b2ac1ec314d007122b (diff) | |
download | perl-fc2904571a077900be0708b6f150c27f77e62f18.tar.gz |
get ByteLoader working again
p4raw-id: //depot/perl@5593
Diffstat (limited to 'ext')
-rw-r--r-- | ext/B/B/Asmdata.pm | 2 | ||||
-rw-r--r-- | ext/B/B/Bytecode.pm | 19 | ||||
-rw-r--r-- | ext/B/B/C.pm | 2 | ||||
-rw-r--r-- | ext/ByteLoader/bytecode.h | 19 | ||||
-rw-r--r-- | ext/ByteLoader/byterun.c | 4 |
5 files changed, 32 insertions, 14 deletions
diff --git a/ext/B/B/Asmdata.pm b/ext/B/B/Asmdata.pm index d62967fe12..bc0eda935b 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 cb061f3038..bafec3ffdf 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 dafef33bb1..d0c8159d9f 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 6e19e129df..1621fed4eb 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 595fd4e18d..a1044ab2c0 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; } |