summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-08-05 00:15:52 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-08-05 13:18:50 -0700
commitf2da823f484d421a6bb57e32e442b19b553f4b35 (patch)
treea1257b3e9d3f0b55dd912ce2b17f9fde7dff1492
parent9a7154347977e29a815d93c0097c5a9b660006b2 (diff)
downloadperl-f2da823f484d421a6bb57e32e442b19b553f4b35.tar.gz
Make PL_(top|body|form)target PVIVs
These are only used for storing a string and an IV. Making them into full-blown SVt_PVFMs is overkill. FmLINES was only being used on these three scalars. So make it use the SvIVX field. struct xpvfm no longer needs an xfm_lines member, because SVt_PVFMs no longer use it. This also causes a TODO test in taint.t to start passing, but I do not fully understand why. But at least that’s progress. :-)
-rw-r--r--dump.c2
-rw-r--r--ext/B/B.xs14
-rw-r--r--mg.c6
-rw-r--r--perl.c4
-rw-r--r--sv.h3
-rw-r--r--t/op/taint.t5
6 files changed, 19 insertions, 15 deletions
diff --git a/dump.c b/dump.c
index 022983d8a9..c7a40a6949 100644
--- a/dump.c
+++ b/dump.c
@@ -1924,8 +1924,6 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
Perl_dump_indent(aTHX_ level, file, " DEPTH = %"IVdf"\n", (IV)CvDEPTH(sv));
Perl_dump_indent(aTHX_ level, file, " FLAGS = 0x%"UVxf"\n", (UV)CvFLAGS(sv));
Perl_dump_indent(aTHX_ level, file, " OUTSIDE_SEQ = %"UVuf"\n", (UV)CvOUTSIDE_SEQ(sv));
- if (type == SVt_PVFM)
- Perl_dump_indent(aTHX_ level, file, " LINES = %"IVdf"\n", (IV)FmLINES(sv));
Perl_dump_indent(aTHX_ level, file, " PADLIST = 0x%"UVxf"\n", PTR2UV(CvPADLIST(sv)));
if (nest < maxnest) {
do_dump_pad(level+1, file, CvPADLIST(sv), 0);
diff --git a/ext/B/B.xs b/ext/B/B.xs
index b503611c64..9c9133b9ff 100644
--- a/ext/B/B.xs
+++ b/ext/B/B.xs
@@ -1446,8 +1446,6 @@ MODULE = B PACKAGE = B::IV
#define PVAV_max_ix sv_SSize_tp | offsetof(struct xpvav, xav_max)
-#define PVFM_lines_ix sv_IVp | offsetof(struct xpvfm, xfm_lines)
-
#define PVCV_stash_ix sv_SVp | offsetof(struct xpvcv, xcv_stash)
#define PVCV_gv_ix sv_SVp | offsetof(struct xpvcv, xcv_gv)
#define PVCV_file_ix sv_char_pp | offsetof(struct xpvcv, xcv_file)
@@ -1504,7 +1502,6 @@ IVX(sv)
B::IO::IoTYPE = PVIO_type_ix
B::IO::IoFLAGS = PVIO_flags_ix
B::AV::MAX = PVAV_max_ix
- B::FM::LINES = PVFM_lines_ix
B::CV::STASH = PVCV_stash_ix
B::CV::GV = PVCV_gv_ix
B::CV::FILE = PVCV_file_ix
@@ -1961,6 +1958,17 @@ AvFLAGS(av)
#endif
+MODULE = B PACKAGE = B::FM PREFIX = Fm
+
+#if PERL_VERSION > 7 || (PERL_VERSION == 7 && PERL_SUBVERSION >= 3)
+# undef FmLINES
+# define FmLINES(sv) 0
+#endif
+
+IV
+FmLINES(form)
+ B::FM form
+
MODULE = B PACKAGE = B::CV PREFIX = Cv
U32
diff --git a/mg.c b/mg.c
index 3b4ed1c052..2ac49bff59 100644
--- a/mg.c
+++ b/mg.c
@@ -814,7 +814,8 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
switch (*mg->mg_ptr) {
case '\001': /* ^A */
- sv_setsv(sv, PL_bodytarget);
+ if (SvOK(PL_bodytarget)) sv_copypv(sv, PL_bodytarget);
+ else sv_setsv(sv, &PL_sv_undef);
if (SvTAINTED(PL_bodytarget))
SvTAINTED_on(sv);
break;
@@ -2542,7 +2543,8 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
}
break;
case '\001': /* ^A */
- sv_setsv(PL_bodytarget, sv);
+ if (SvOK(sv)) sv_copypv(PL_bodytarget, sv);
+ else SvOK_off(PL_bodytarget);
FmLINES(PL_bodytarget) = 0;
if (SvPOK(PL_bodytarget)) {
char *s = SvPVX(PL_bodytarget);
diff --git a/perl.c b/perl.c
index d8b8aca63e..d836b0b33b 100644
--- a/perl.c
+++ b/perl.c
@@ -4137,9 +4137,9 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register
PERL_ARGS_ASSERT_INIT_POSTDUMP_SYMBOLS;
- PL_toptarget = newSV_type(SVt_PVFM);
+ PL_toptarget = newSV_type(SVt_PVIV);
sv_setpvs(PL_toptarget, "");
- PL_bodytarget = newSV_type(SVt_PVFM);
+ PL_bodytarget = newSV_type(SVt_PVIV);
sv_setpvs(PL_bodytarget, "");
PL_formtarget = PL_bodytarget;
diff --git a/sv.h b/sv.h
index 056d43b118..b2385d0a6d 100644
--- a/sv.h
+++ b/sv.h
@@ -520,7 +520,6 @@ typedef U16 cv_flags_t;
struct xpvfm {
_XPV_HEAD;
_XPVCV_COMMON;
- IV xfm_lines;
};
@@ -1387,7 +1386,7 @@ sv_force_normal does nothing.
#endif
-#define FmLINES(sv) ((XPVFM*) SvANY(sv))->xfm_lines
+#define FmLINES(sv) ((XPVIV*) SvANY(sv))->xiv_iv
#define LvTYPE(sv) ((XPVLV*) SvANY(sv))->xlv_type
#define LvTARG(sv) ((XPVLV*) SvANY(sv))->xlv_targ
diff --git a/t/op/taint.t b/t/op/taint.t
index c8537fce40..0e89c1f87a 100644
--- a/t/op/taint.t
+++ b/t/op/taint.t
@@ -2050,10 +2050,7 @@ end
formline('@' .('<'*5) . ' | @*', 'hallo', 'welt');
isnt_tainted($^A, "accumulator still untainted");
formline('@' .('<'*(5+$TAINT0)) . ' | @*', 'hallo', 'welt');
- TODO: {
- local $::TODO = "get magic handled too late?";
- is_tainted($^A, "the accumulator should be tainted already");
- }
+ is_tainted($^A, "the accumulator should be tainted already");
is_tainted($^A, "tainted formline picture makes a tainted accumulator");
}