diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-04-26 12:12:34 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-05-18 19:11:03 +0100 |
commit | 74e0ddf711449aba3fac400d9102bd461ee7265b (patch) | |
tree | f6b7d2f148790a56598095c857b3385db5b79c14 /dump.c | |
parent | 75f63940310204509f2935729c2b989e3be7c00d (diff) | |
download | perl-74e0ddf711449aba3fac400d9102bd461ee7265b.tar.gz |
Store the compiled format in mg_ptr instead of after SvCUR() - fixes RT #89218
Formats are compiled down to a sequence of U32 opcodes in doparseform().
Previously the block of opcodes was stored in the buffer of SvPVX() after
the raw string by extending the buffer, and calculating the first U32 aligned
address after SvCUR(). A flag bit on the scalar was set to signal this hackery,
tested with SvCOMPILED()
The flag bit used happened to be the same as one of the two used by to signal
Boyer-Moore compiled scalars. The assumption was that no scalar can be used for
both. Unfortunately, this isn't quite true.
Given that the scalar is alway upgraded to PVMG to add PERL_MAGIC_fm magic,
to clear the cached compiled version, there's no extra memory cost in using
mg_ptr in the MAGIC struct to point directly to the block of U32 opcodes. The
test for "is there a compiled version" can switch to mg_find(..., PERL_MAGIC_fm)
returning a pointer, and the use of a flag bit abolished.
Retain SvCOMPILED() and SvCOMPILED_{on,off}() as compatibility for XS code on
CPAN - the first is always 0, the other two now no-ops.
Diffstat (limited to 'dump.c')
-rw-r--r-- | dump.c | 1 |
1 files changed, 0 insertions, 1 deletions
@@ -1627,7 +1627,6 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo case SVt_PVCV: case SVt_PVFM: append_flags(d, CvFLAGS(sv), cv_flags_names); - if (SvCOMPILED(sv)) sv_catpv(d, "COMPILED,"); break; case SVt_PVHV: append_flags(d, flags, hv_flags_names); |